Does state_attr query the HA database or does it actively poll a sensor?

As the battery in my Eve Weather thread outdoor sensor went from 100% to 0% in two days, I wonder if it’s related to me using its temperature value in many templates controlling thermostatic radiator valves. Therefor:

Does state_attr(entity, "current_temp") query the HA database or does it actively poll the sensor?

And: Does it make a difference if a sensor is Thread, Zigbee, BLE or something else? E.g. I think my BLE devices only send out the current temperature whenever it changes, but do not listen to anything. Now I wonder if the Eve Weather sensor listens and replies to queries, which would explain why the battery I replaced a few days ago fell to 0% so quickly.

Thanks!

Neither. It gets the attribute value from the state machine.

How often it does that depends on where you are using the template.

Hmm, I can’t find much about the HA state machine, but maybe that’s too technical for me anyways. My question is: can the frequent usage of state_attr have an effect on the battery state of a thread based temperature sensor? If yes, can I somehow only poll every 10 minutes and cache the value in HA?

No. The state is pushed to home assistant on a schedule or delta change determined by the device designers.

Thanks, so the frequency of accessing a sensor in HA has no effect on the battery usage of the device. Then the battery seems to be dying for another reason.

1 Like

Yes, that is correct. Look at the device configuration to see how often or the rules as to when the temperature data is sent. For a battery powered device this should be no more than every 15 minutes, ideally an hour. Alternatively if it’s has a threshold reporting configure it for reporting every 1-2 degrees. If you need faster you’ll want a line powered device (or replace the batteries every day)

Thanks. I can’t find any information about the update frequency & threshold for the Eve Weather, but based on the temperature graph its about 5 minutes. The first CR2450 battery was okay for an entire year. Only last week I replaced batteries and moved it from Apple Home to Home Assistant. Yesterday I added templates to automate heating, and now it fell from 100% to 0% within a day. Must have been a coincidence and a bad battery.

Or it is communicating using a fundamentally different path. I’d look at troubleshooting that. See if others had issues with that sensor after connecting it to HA.

Thanks. In the past days I’ve seen a couple of reports regarding Eve devices sending false battery percentages – sometimes they stay at 100% for more than a year, sometimes they drop rapidly to 10% but are back at 100% when removing the battery for s few seconds, sometimes they show 100% but the battery is already so dead that only the display remains on, but all transmissions are off. So it was a false alarm, I will not trust these percentages anymore.