Sensor information for battery is milliVolts, not percentage value
As the sensor is an entity instead of a device, there is no device_class (battery) for these sensors
Where I need some assistance is
a) How to create an entity that converts the mV value to %-value. The sensor works, to my understanding, until somewhere 1800 mV and the CR2477 battery has max mV around 3000 mV. So I need some kind of encoding of the mV to % in the ballpark of 1800 mV: 0% - 3000 mV: 100%
b) How to create a device and link it to the sensor so that I’d have the %-value from a) defined as ‘device_class: battery’ enabling the blueprint to work with these sensors too
so now I can see entities sensor.ruuvibedroom_battery and sensor.ruuvikitchen_battery both having ‘device_class: battery’
Neither of the state assignations I’ve inserted works as the State (in Developer Tools) is ‘unavailable’. The state setting format is too cryptic for me at least at the moment.
For example current sensor.kitchen_battery is 2985, unit_of_measurement: mV
CR2477 battery is theoretically 3000 mV but all I’ve seen provide ~3200 mV as full. RuuviTag seems to run all the way until 1200 mV so using that as 0% value.
this is great, especially with the new Ruuvi integration released today! no more need to do platform: ruuvitag in the esphome yaml. this is what I used so that I could have the names consistent with the other ruuvi entities, while providing another sensor…
Looks like one of my Ruuvi’s is showing battery replacement notifcation in Ruuvi Station Android app at 2.25 Volts. Might be worth tuning the formula a bit…
Switching my own values to 1800 and 14.
Also checked that newly installed Varta CR2477 shows 3.20 V on Ruuvi Station app.
Can anyone figure out how this could be configured for HA via templates or blueprints or whatevers so that the values could be dynamically changed in the Home Assistant UI?