pycarwings2 icon indicating copy to clipboard operation
pycarwings2 copied to clipboard

Homeassistant "lies" about how recent a reading was.

Open sweavo opened this issue 1 year ago • 0 comments

Scenario: HA polls the car once an hour for SOC, plugged status, etc., and shows the results on a dashboard along with "3 minutes ago" etc. When I go for a drive, the car stops responding to the API calls, but pycarwings (init.py line 417) pretends it is getting data, passing stale data up to HA. When I get home and plug in again, HA might tell me that it read a SoC of 90% 3 minutes ago, when an hour later it is now reading 60%.

I would like the "3 minutes ago" to say "4 hours ago" if that's how old the sample is.

I have two strategies to consider:

  1. make a new sensor that is "time of last successful query" so that it can be displayed on the dash along with the (sometimes stale) data
  2. cause the entities not to be updated when the car is unavailable, e.g. by not falling back to latest server values at line 417

Before I go down the rabbithole learning how to run my development python on my HA setup, does point (2) make sense? or will it have some other consequences to fail to return a value?

sweavo avatar Sep 03 '23 20:09 sweavo