android
android copied to clipboard
Add iBeacon capability to the Wear OS app
Is your feature request related to a problem? Please describe.
Room presence is a fun addition to a home automation setup, and the phone app beacon has been working well for me, but I sometimes leave my phone in a different room. Tracking a watch that's always on my wrist would be nice.
Describe the solution you'd like
An additional setting for the companion app to enable iBeacon advertisements, similar to the phone app.
Describe alternatives you've considered, if any
I'm going to tinker with writing my own app as the APIs for this don't seem too convoluted, but I've not done it before and it's not scalable.
Additional context
All current phone sensors will be evaluated once the wear OS app has a sensor UI for enabling and adding settings. Will come sometime after #2033
Got it, thanks
If anyone else is interested in this and lands at this issue, I have a working proof of concept at https://github.com/rpatel3001/BeaconWear
Credit to the good folks at @AltBeacon, this was forked from https://github.com/davidgyoung/android-beacon-library-reference-kotlin and modified with code from https://altbeacon.github.io/android-beacon-library/beacon-transmitter.html.
There's still a ton of cruft for scanning and absolutely no user interface, but I'll probably clean it up eventually.
be handy to have beacon capability on the home assistant wear os app for sure.
Would love to see this in combination with ESPresense. @rpatel3001 can you please explain a bit more about your PoC. Can I use it on my GW4 by just compiling and installing it?
@maartendamen there is an apk available here. The UI doesn't actually do anything, the UUID and reference power are hard coded. You can clone the repo and build in Android Studio if you need to change those values.
@maartendamen there is an apk available here. The UI doesn't actually do anything, the UUID and reference power are hard coded. You can clone the repo and build in Android Studio if you need to change those values.
Very cool, I got it working. Thanks for your efforts! I will do some writing about this on my blog soon if you don't mind.
Very cool, I got it working. Thanks for your efforts! I will do some writing about this on my blog soon if you don't mind.
Not at all, drop a link here when you do.
Any updates about this?
Any updates about this?
the wear OS app still needs to handle permissions and sensor settings before beacon capabilities can be added.
Thinking more about this request, in addition to needing permissions and sensor settings I think we will also need notifications supported directly in Wear OS so the user can control the transmitter. I don't think it makes sense to add this sensor until that is the case given that it can drain the battery and I don't expect any user to want this enabled 24/7.
I am open to consider other ideas but we should do some proper consideration on how this feature will work on Wear OS before adding it.
Idea: to not drain battery, the transmitter could be enabled for a specific (short) amount of time, for eg. quickly detecting which room the user is in.
I don't see how you'd implement that, the watch won't know when you're changing room and if you're talking about enabling it only every few minutes it's going to make it a bit useless for automation.
I do like the idea of enabling it / disabling it through notifications though, you could have HA enable it when you're at home and disable it when away for example, neat but not essential IMHO
Sorry, I didn't explain my whole concept that I had in my head.
- It could be enabled triggered by motion sensors in the roooms.
- Some watches have multiple buttons. If the HA Wear OS app would have multiple launcher icons, that would trigger some event in HA, they could be used to eg. toggle the light in the current room you're in, by pressing the button on the watch, then enabling the BLE beacon for a short amount of time, then one of the beacon monitors would pick the signal up, and an automation can toggle the lights in the detected room that you're in. (FYI there's an app called Button Launcher that lets you open more than one app or launcher item with a physical button. It could be useful for these kind of things.)
Not sure what the delay on detection might actually be but that's a neat idea. Sounds like the opposite might be better suited for this (having beacons broadcasting which room you're in and let the watch relay that over to HA) but that's a whole different feature.
Either way IMHO a first version always on / always off would be great, and it can be refined later with notification or events, but that's ultimately left to people who know how to make WearOS stuff :)
Idea: to not drain battery, the transmitter could be enabled for a specific (short) amount of time, for eg. quickly detecting which room the user is in.
how would that work? How would the transmitter know to turn itself on and off to make it useful to any automation when we cant send that data back to the watch to process (i.e. notification command on the watch)?
I do like the idea of enabling it / disabling it through notifications though, you could have HA enable it when you're at home and disable it when away for example, neat but not essential IMHO
Thats what the phone app supports. The reason why its essential for a watch is because the only way you can enable and disable a sensor is to dig into settings on the watch, find the sensor and enable or disable it as you please. On a watch thats not really ideal. When this sensor was added to the phone app the notification command was added at the same time because you need a good and reliable way to enable or disable it. Not having it automated defeats the purpose of a wearable here where its all about short interactions instead of needing to dig into places.
- It could be enabled triggered by motion sensors in the roooms.
thats exactly what a notification command will allow you to do
- Some watches have multiple buttons. If the HA Wear OS app would have multiple launcher icons, that would trigger some event in HA, they could be used to eg. toggle the light in the current room you're in, by pressing the button on the watch, then enabling the BLE beacon for a short amount of time, then one of the beacon monitors would pick the signal up, and an automation can toggle the lights in the detected room that you're in. (FYI there's an app called Button Launcher that lets you open more than one app or launcher item with a physical button. It could be useful for these kind of things.)
I believe apps only have access to those buttons when the app is open.
https://developer.android.com/training/wearables/user-input/physical-buttons
The link to the button launcher is giving a 404
Not sure what the delay on detection might actually be but that's a neat idea.
the delay may be there until the screen turns on the wearable due to doze restrictions
Sounds like the opposite might be better suited for this (having beacons broadcasting which room you're in and let the watch relay that over to HA) but that's a whole different feature.
we have the opposite already on teh phone side, a beacon monitor sensor to report distance on nearby beacons. However this one also has a corresponding notification command that was introduced alongside the sensor and has the same battery considerations as the transmitter.
Either way IMHO a first version always on / always off would be great, and it can be refined later with notification or events, but that's ultimately left to people who know how to make WearOS stuff :)
So if you can only enable and disable by physically interacting with the app how do you see that being useful? Are you goign to manually turn the sensor when you park your car and turn it off when you get in your house? Are you going to remember to turn it on and off before and after bed? What about when you leave the house? The first version introduced in the phone side contained the notification command.
So if you can only enable and disable by physically interacting with the app how do you see that being useful? Are you goign to manually turn the sensor when you park your car and turn it off when you get in your house? Are you going to remember to turn it on and off before and after bed? What about when you leave the house? The first version introduced in the phone side contained the notification command.
I'd just leave it on all the time, most likely. The notification support would be great, just saying I don't see it as a blocker myself as long as it defaults off. But I understand the blocker now is the settings menu so this is moot
I'd just leave it on all the time, most likely.
Good to know I did not expect anyone to want to leave it on all the time lol
The notification support would be great, just saying I don't see it as a blocker myself as long as it defaults off.
it defaults to on actually because you are enabling the sensor so the expectation is that the transmitter also gets enabled. The transmitter itself is controlled by a sensor setting which is not available in Wear OS yet, the notification command makes it easier to use and automate.
We still need to do battery implication testing too, for example would you really want the sensor if your battery goes to 0 in 2 hours?
One thing I also considered was maybe adding a tile for turning the transmitter/monitor on and off, while it would make it faster it still wouldn't be automated.
The link to the button launcher is giving a 404
Hmm, maybe it's because the developer didn't update it to comply with the latest targetSdkVersion
requirements, and the link works for me just because I still have it installed. Btw here's the app's source code on GitHub: https://github.com/moneytoo/ButtonLauncher
About battery drain: I am using Xiaomi Mi Band 6 as "Beacon simulator". Sending ble advertisements is switched on all the time. It sends every 5 seconds. Battery capacity from Mi Band is small, but it holds for more than 10 days. Therefore, I don't expect to face battery drain on wear OS. It should have an impact, but not so heavy as discussed. Has anyone tested POC from @rpatel3001 and checked battery impact?
I am trying to install the apk from @rpatel3001. When I then try to start the app on my smartphone, I always get an error message:
But I can't find a way to give the app the desired permission.
Oh yes, I use a Pixel 7 Pro in conjunction with the Pixel Watch.
@Mausbiber there's no error message in your comment, but it doesn't matter because the apk is meant to be installed on the watch not the phone. I can't say if the pixel watch will work, I've only tried on the galaxy watch 4.
okay, trying to sideload
Okay, I installed the app on the Pixel Watch via adb. I can also start the app and the "useless" GUI appears. But that's it, I'm not asked for rights and no iBeacon is sent.
Hey guys as this app you are installing is not the HA android app I am going to ask you to please move this conversation to the appropriate location.
This would be a great addition, nothing better to make tracking that a watch!
Still waiting!
@maartendamen there is an apk available here. The UI doesn't actually do anything, the UUID and reference power are hard coded. You can clone the repo and build in Android Studio if you need to change those values.
This saved me from returning my 300$ pixel watch. thank you. this is awesome.
Hey everyone I submitted a draft PR to migrate over the sensors to get some early feedback. I see a lot of users are coming in this thread looking for a quick solution. As of now there are no settings or notification commands but the transmitter and monitor should function just like the phone app does. If possible please test and provide us some feedback regarding your usage and battery life and also if you feel that the other options are a necessity for your use case. Its important for us to get some feedback here to see if things are good as it stands or if we really need to take care of other considerations first.
You can grab the test debug wear APK from the below link, just download the archive and extract it:
https://github.com/home-assistant/android/actions/runs/3744776429
Note you may need to install the debug phone APK in order to login on the watch, both APKs can be found in the archive from above.
once done with the test you can leave it installed or uninstall it, the debug builds are designed to be installed side by side the production apps so they dont interfere with them.
Hey @dshokouhi, that's great news, thank you very much !
I've just installed it now and I'll test it over the next while, I'm going to need to setup presence tracking here to see if it works but I'll be off for a few days there so I'll work on that. For anyone else wanting to try this, you need to install the 'full' app on the phone, looks like the minimal one doesn't support wearos.
I'll update back once I've had a chance to test it out properly, thanks again !