I have a Konnected Pro module with a DHT temp sensor connected to it. This is feeding in to HA via the Konnected integration. I have it configured to send an update/event every 1 minute.
The issue I have is that HA is not updating the sensor’s last_updated value if the temperature value has not changed, even though the module is sending a new event/message every minute.
I can see the the event is being sent to HA (I have enabled debug - homeassistant.components.konnected.handlers). So why isn’t HA updating the sensor entities attributes?
If the state changes, last_changed is modified
If the state or an attribute is modified, last_updated is modified.
If there is no state or attribute changes, neither is updated.
There is no fix, it works as designed. If updates are sent without any actual changes, the last_* won’t be changed either.
What are you trying to achieve?
Maybe I’m trying to be too clever, but I have an automation that checks HA to see if it hasn’t been updated by a sensor in a set period, it then generates an alert/notification.
I do also check for the sensor being offline too.
Ps - In my simple mind the design/logic/use of last_changed and last_updated seems wrong. I would have thought last_updated should be updated even if the values are the same, last_changed should be used for when a value actually changes. The temp sensor doesn’t have any attributes that change, so with the current design I believe the two timestamps will be the same. If necessary there could be another time stamp variable used for attributes.
Bump. I have this issue as well. Currently I can’t see if I am still receiving the same value, or if my sensor has died (which happens a lot with various integrations).
This is an issue with some graphing cards as well, as they just continue on charting a line even if the sensor is dead.
Is there a solution to this??
I keep track of the number of hours my heating system runs. From that I can calculate my fuel consumption as I know the average consumption per hour. My set up is as follows.
I have a sensor.runtime which is updated every day with the daily value. This sensor is updated through MQTT.
Actually (and sorry forgot to mention that in my update) there is. As I use MQTT I can define force_update: true for MQTT (binary) sensors. But if it were an ordinary sensor, you’re correct.
I did, but I does not solve my case where I need the sum of a set of sensor states. The runtime sensor returns values like 1.03, 2.11, 2.11, 3.0. After this sequence the runtime_since_refill sensor should be 8.25 not 6.14. So using a state does not really work. I do not get state changes, I get how much work the system did.
Secondly, my current solution takes network issues and HA downtime into account (I use a mail account to buffer information). But that is specific to my situation.