Erroneous "last updated" #35
Labels
bug
Something isn't working
good first issue
Good for newcomers
help wanted
Extra attention is needed
shouldbefixed
Hi,
I'm a noob with Home Assistant and the state machine so please bare with me. I could not get the departure card to properly show adjusted time remaining to departure, so I decided to take a look.
I have specified a 300s refresh rate for the sensor, but it seems the culprit of the issue is that the value defined in line 62:
var updatedDate = new Date(entity_data.last_updated);
increment every minute and not every 5 minutes (300s) as expected. It seems the departure data fields refresh every 5 min as expected, but the attributes..next_departure_minutes keep ticking down every minute, which cause the last_changed to have an erroneous value. This disturbs the calculated time remaining.
I tried to google, and I suspect (but I am not sure) that this may be changed behaviour for the last_updated field. So to make it work I had to change the above line to:
var updatedDate = new Date(entity_data.attributes.last_refresh);
I also stumbled upon another issue with the integration which seems unable to properly update the config for the sensor (it always revert to the initial settings), but I see that someone has submitted a PR for that already. But this issue meant that I could not change the primary measure (state?) of the sensor from 'min' to 'updated' to see how that would affect the issue described here. But I think regardless the above is the correct value to use for determining when the sensor data was last read from server.
The text was updated successfully, but these errors were encountered: