ha-myenergi icon indicating copy to clipboard operation
ha-myenergi copied to clipboard

"Last Updated" entity that stores the date/time the integration last retrieved response from myenergi API

Open LeiChat opened this issue 1 year ago • 5 comments

Please would you consider adding an entity that holds a timestamp of when the integration last received a response from the myenergi API?

Unless there's a way to do this using a Helper/Template in Home Assistant?

Example of two sensor entities from the GivTCP integration:

https://github.com/search?q=repo%3AGivEnergy%2Fgiv_tcp%20last_updated_time&type=code

image

LeiChat avatar Apr 13 '23 12:04 LeiChat

+1, this would be really helpful to be able to set alerts so we know when data isn't getting updated!

avleen avatar Jul 04 '23 20:07 avleen

I did find you can use something like this, and since the latest update it's pretty accurate: states.sensor.myenergi_my_home_home_consumption.last_changed

avleen avatar Jul 04 '23 21:07 avleen

+1 .... seen myenergi server go down, but not away that the data was "out of date"

pickeringar avatar Jul 05 '23 08:07 pickeringar

I had this issue with a previous version of ha-myenergi and HA (I don't know which was the problem specifically): the myenergi servers were up but they hadn't received new data in a while so they returned the old data with the last timestamp. Then the last_updated timestamp in HA would be updated to the current time, so it made it look like the data was recent.

Last night I updated HA to 202306.03 and this plugin to the latest version too. Now the last_updated timestamp is correct and it doesn't update until the myenergi API has a newer timestamp.

This should address the feature request I think? If so, this issue can probably be closed.

avleen avatar Jul 05 '23 12:07 avleen

Will give last_updated and last_changed a look.

pickeringar avatar Jul 06 '23 17:07 pickeringar