mKeRix / room-assistant

Presence tracking and more for automation on the room-level
https://www.room-assistant.io
MIT License
1.26k stars 122 forks source link

Add battery information for iBeacons #160

Open gruijter opened 4 years ago

gruijter commented 4 years ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like iBeacons (and maybe other types) report the battery status. Can this be included in the MQTT reports?

Describe alternatives you've considered

Additional context I would like to integrate room-assistant into my own headend (not HASS.IO)

mKeRix commented 4 years ago

Unfortunately I can't seem to find the battery level in the iBeacon standard - am I overlooking something? I know that some manufacturers include it in the advertising data though. Maybe we can support some of those specific algorithms, then I would need to know which beacons you're looking at specifically though.

gruijter commented 4 years ago

My bad. It seems to be a ble standard, not iBeacon specific. 0x180F is the battery service. Some reading here https://www.andreasjakl.com/read-battery-level-bluetooth-le-devices/

PeteBa commented 4 years ago

I was thinking about this as well. My iBeacons use the upper byte of the Minor field to carry the battery level. I contributed the "minor/major_mask" to the legacy version to provide a way to expose this to home-assistance. But this required config on the HA side which kind of goes against the discovery benefits of this new solution.

I havent look at the Tag Override functionality yet - is there any docs on this ? - but I did wonder if it could evolve into something like HA templates, i.e. add a new field to the ibeacon message that is derived from internal variables and logic. Something like battery: "ibeacon.minor & 0xFF00 >> 8".

I think that could have potential way beyond battery level as it would provide a mechanism to access things like advertising data and augment the information available to room-assistant in a very structured way.

I'm guessing one for V3.0 8)

septeven commented 4 years ago

hi, any chance to get it implemented ? that would be great :)