I was wondering how the “Last Changed” and “Last Updated” exactly work regarding ESPHome AM2320 component sensor.
I have a AM2320 temp sensor connected to a Wemos D1 Mini. Update interval set to 5s, running for 15s and deepsleep for 5min.
It works, but I noticed the value is only updated in HA if the temperature has changed since the last data point. The “Last Updated” also does not change until the temperature has gone up or down by 0.1C.
How could I know, if I see the temperature has not changed in a while, if the node is still active?
Is it possible to let the “Last Updated” timestamp change every time the ESP wakes up and sends a new value? Or have a “Last Seen Online” sensor for each esphome node? Any suggestions?
Ideally, I would like a green/yellow/red dot showing if a sensor is online/online-in-the-past-10min/offline-longer-than-10min.
Edit: Actually, the binary sensor also only seems to update its state when either temp or humidity change. Once those values stabilise, the status sensor also doesn’t get updated in HA. Help?
Thanks. The ping method seems to work as expected.
However, since my ESP only comes out of deep sleep for 10s, I have to keep pinging it at a fairly high rate not to miss the sensor when it comes online. Does this have influence on the HA performance?
Could I, as an alternative l, make a dummy sensor, for example called “esp_last_online_time”. And have ESPHome update it after it comes online with the current time? So basically have 2 sensors in the esphome yaml: The AM2320 one, and a timestamp one.
In your case (deep sleep enabled node) you might just want to use the force_update option on your esphome temperature sensor so it will even send the same value again to home assistant.
Under normal circumstances it’s not wanted because in creates unnecessary traffic and fills the ha db, but in your use case it sounds acceptable.