My battery levels in my Ikea Tradfri Zigbee remotes bounce around a lot. That’s fine, I understand they’re polling the voltage levels. So I’d like to report on the 24 hour average of the voltage level.
As you can see from the image some devices really bounce all over the place. So when I try to report on low battery levels I’m always getting false positives like this:
(by the way I built that sensor list using the auto-entities card which is pretty cool)
So my question is:
how can I make ALL of my batteries report their 24 or 48 hour average? I suspect I could probably template each one of them and create a jinja2 calc off each individual device, but I have >20 battery powered devices. So is there a way I can dynamically calculate the average of a range of sensor batteries?
For those who are interested, here is where I’m at so far. I had to add an entry for every battery under sensor section of my configuration.yaml. Ikea remote battery levels are problematic and need to be smoothed.
I’ve started recording the 24 hour average of the battery readings for each battery. I couldn’t find a way to do it automatically for all entities matching a glob* pattern.
But then I realised that unless the statistics are being recorded a simple reboot of HA will cause me to lose statistics. So I had to turn on the recorder, like this:
recorder:
purge_keep_days: 4
It has levelled out the battery recorder readings so I can alert on a consistently low battery reading: