Person to adopt battery level attribute of latest updated state that contains battery_level.
Original by @martinhjelmare
Does this make sense ? I would expect that we should either show all devices in the UI and their battery level or assign a "primary" device and adopt that battery level.
Battery level? Person or droid?
It would make sense if it only showed if there was one device, or maybe the device with the lowest battery.
Does low battery level mean I as a person need food?
Sorry, couldn't resist... 馃槤
But in all seriousness, I like the idea. I have 2 device trackers from my phone reporting into my person, either ones reported battery level would work. The idea of having a primary devicethat battery level is inherited from seems like a good override.
If we do this, we should not make a choice. Instead, we should either include all in a map.
device_battery: {
device_tracker.paulus_pixel3: 43,
device_tracker.paulus_ble_keychain: 92
}
We should not conflate UI needs with backend.
You'd want it to be a sorted map though so the order stays consistent.
What about devices that have not updated their state in a while? A battery of 10% is pretty meaningless if it was 4 days ago. Chuck it out of the map if it's stale? Or mark unavailable?
If it's 'unavailable' that's going to need extra testing of anything using it since it expects a number.
Alright, we should not include it all, and just include the entity IDs of the device trackers linked to the person. That way the consumer (UI, template etc) can decide the latest state and we're not duplicating anything.
Probably makes the most sense really. Just treat it like a group. I have an arch issue coming up about groups when I have a chance to write it up.
Most helpful comment
Battery level? Person or droid?