openhab-android icon indicating copy to clipboard operation
openhab-android copied to clipboard

Extend HABDroid to support Wearable

Open tobiasamon opened this issue 9 years ago • 20 comments

The HABWear extension for HABDroid should show the sitemap selected on the mobile phone to which the watch is being connected. Data between Wear and Mobile is being exchanged through the DataApi provided by Android. The main sitemap is automatically being sent to the DataApi after chosing the sitemap on the mobile. When starting the app on the Wear this base sitemap is being displayed using the WearableListView layout. Clicking on an item (Group or Frame) will send a message with the requested sitemap url to the mobile app which download the sitemap and put it on the DataApi. The Wearable gets notified about the new data and will forward the user to the new list with the new sitemap data.

Not all widget types will be supported. At the beginning only Group, Frame, Switch, Door/Window Sensor and RollerShutter will be supported.

With this extension a basic control for OpenHAB should be possible.

tobiasamon avatar Mar 19 '15 20:03 tobiasamon

Is it a feature request, or your plan to implement this feature into the app? :-)

belovictor avatar Mar 23 '15 16:03 belovictor

Hi,

I'll implement that and might integrate it into the app if you like. My plan is to separate the integration with the watch as good as possible from the existing code.

best regards Tobias

tobiasamon avatar Mar 24 '15 07:03 tobiasamon

Hi all,

I've committed a first version which supports switch items (to turn lights on and off) and a roller shutter item with which you can open/close/stop a roller shutter. GUI design is a bit ugly.... but I'll improve it later on. The current version is just for demonstration purpose.

-> https://github.com/tobiasamon/openhab.android/tree/73-HABWear

best regards Tobias

tobiasamon avatar Mar 29 '15 11:03 tobiasamon

Ok, from what I understood from our code you've done all openHAB communication in WearService and it mostly copies what current app does in it's own UI. As I can see you didn't do any openHAB2 support. What I think here is that before introducing wear support we should better fully separate openHAB communication into one unified API/Service which then can be used both by mobile and wear apps. What do you think?

belovictor avatar Mar 30 '15 09:03 belovictor

Hi,

yes, there is no support for OpenHAB 2. I need to setup openHAB 2 first, to be able to test the wearable integration. What I can do is to separate the communication with the openHAB backend into a library that can be used by the UI and by the WearService. The wear app itself cannot directly communicate with openHAB... it has to go through the mobile app.

I'll setup some wiki pages with some technical details soon.

best regards Tobias

tobiasamon avatar Mar 30 '15 11:03 tobiasamon

What do you mean by 'library'?

belovictor avatar Mar 30 '15 16:03 belovictor

ok. in this I case I meant "service".

I created a wiki page for the project. It is not finished yet, but I will extend the information as fast as I can.

-> http://wiki.tobiasamon.de/confluence/display/HABWEAR/HABWear+Home

tobiasamon avatar Mar 30 '15 19:03 tobiasamon

Ok, things are clearer about the wearable part with your wiki, thanks a lot! So your proposal is to create a separate (from wear) service which will be responsible for communication with openHAB and this service then will be used both by the mobile app and by wearable part to request data from openHAB and to send commands to openHAB. AFAIK this service will be responsible for discovering openHAB and tracking connectivity changes. Am I right?

belovictor avatar Apr 01 '15 10:04 belovictor

Hi,

yes, the WearService is responsible to handle the communication between the watch and openhab. At the moment the WearService is instantiated when the app starts and ends with the app, so when the mobile app is not running, the watch cannot communicate with openhab... I need to create an android service which can run even if the mobile app is not running. From my point of view the WearService is not responsible to tracking connectivity changes. The OpenHABTracker already does track the changes and will set the url in the WearService.

tobiasamon avatar Apr 04 '15 13:04 tobiasamon

That's what I meant. There should be a separate service (separate from WearService) which will process all interactions with openHAB for both mobile app and wearservice :-) So that there would be no duplication between wearservice and mobile app. But we can go with wearservice right now and then later, probably after 1.7, refactor to separate openHAB connectivity service.

belovictor avatar Apr 05 '15 08:04 belovictor

I've created a branch where the wearservice is running in a bound service. Thus communication between the wearable and openhab works even if the app is not running any more. Additionally the openhabtracker is started in a bound service as well.

Can you check if that's more or less what you expected?

PS: it's not finished yet, but should give an overview over the new behaviour.


EDIT: Seems as pushing the branch did not work... should be available this afternoon


EDIT 2: Branch is now available https://github.com/tobiasamon/openhab.android/tree/73-CONNECTION-SERVICE

tobiasamon avatar Apr 09 '15 05:04 tobiasamon

Does this include also the idea mentioned here?: https://github.com/openhab/openhab.android/issues/52

A simple access to the VoiceAction of HabDroid from AndroidWear seems to me the most logical feature. This could than be integrated (by the user) in their interactive Watch faces.

LKuech avatar Sep 15 '15 05:09 LKuech

At the moment, android does not support custom voice commands like "ok google let openhab open all shutters". What I did now, was to start voice recognition right after starting the app on the watch. You can then immediately say what you want to do and openhab "should" do it (in case you have properly configured your system). I assume that most users will use the voice feature and will not navigate through the sitemap all the time.

So what you have to do to use voice actions is

  1. Open HabWear (using voice command "Ok google start habwear", or by opening it manually)
  2. Say your command

Is this what you would expect?

ps: I did not do anything with interactive watchfaces so far...

tobiasamon avatar Oct 06 '15 07:10 tobiasamon

Yes. It is exactly what I had in mind. I did build myself a small project doing the same thing since some time. But I thing it makes sense to have it in the official app instead of an dedicated one.

LKuech avatar Oct 06 '15 14:10 LKuech

You can checkout the branch here: https://github.com/tobiasamon/openhab.android/tree/OPENHAB_2 It cotains both compatibility with openhab 2 and speech recognition. It is designed to work with the "VoiceCommand" item mentioned here: https://github.com/openhab/openhab/wiki/Controlling-openHAB-with-your-voice

I already created a pullrequest for the basic habwear integration and will create another one after the initial one has been accepted/merged.

tobiasamon avatar Oct 08 '15 06:10 tobiasamon

Hey, is there something already available in the current app on play store? I can see Openhab app in the list of installed wear apps but there's nothing to start on the watch. Any instructions to get this running?

Also tried Tobias Confluence link but spits error 503. Thanks for your help.

MrMontesa avatar Dec 29 '15 13:12 MrMontesa

@MrMontesa: If you like I can give you my self made app that is just bringing the voice action to Android wear. Just give me an address and I will send it. It is fulfilling the need quite well until there is some kind of official support.

LKuech avatar Dec 29 '15 19:12 LKuech

Any news? Latest builds from Jenkins doesn't seems to work :(

Gerrett84 avatar Sep 25 '16 21:09 Gerrett84

Anything we can help to push this forward?

SeoFood avatar May 22 '17 17:05 SeoFood

Possible solution: Have a watchface were you can define which items are displayed. This would make it faster accessable than a wear app

mueller-ma avatar Jun 20 '17 06:06 mueller-ma