lephisto / tesla-apiscraper

API Scraper for pulling Vehicle Statistics from the Tesla Owner API into an InfluxDB + Grafana Dashboards
GNU Lesser General Public License v3.0
365 stars 102 forks source link

validity check preventing sleep? #46

Closed notnicehat closed 5 years ago

notnicehat commented 5 years ago

Updated to latest master and now getting "VALIDITY CHECK VIOLATED" notes about charger voltage and it is resetting interval to 1s, so car never went to sleep. I don't understand why charger voltage is showing as "2" - the car was parked overnight unplugged in a garage.

2019-04-21 15:58:52 DEBUG >> Request vehicle data 2019-04-21 15:58:52 DEBUG Only minimal range difference received. No change registered to avoid wakelock. 2019-04-21 15:58:52 DEBUG Value Change, SG: charge_state: Logging...charger_voltage: old value: 0, new value: 2 2019-04-21 15:58:52 DEBUG VALIDITY CHECK VIOLATED >>> charger_voltage:new_value < 10 2019-04-21 15:58:52 DEBUG Only minimal range difference received. No change registered to avoid wakelock. 2019-04-21 15:58:52 DEBUG Only minimal range difference received. No change registered to avoid wakelock. 2019-04-21 15:58:52 INFO Writing Points to Influx: charge_state 2019-04-21 15:58:52 DEBUG Only minimal temperature difference received. No change registered to avoid wakelock. 2019-04-21 15:58:52 DEBUG Only minimal temperature difference received. No change registered to avoid wakelock. 2019-04-21 15:58:52 DEBUG starting thread elevator: 37.336659/-121.886382/1555862332697 2019-04-21 15:58:52 INFO Asleep since: 0 Sleeping for 1.0 seconds.. 2019-04-21 15:58:52 DEBUG Elevation: 23 2019-04-21 15:58:53 DEBUG Car State: online Poll Interval: 1.0

lephisto commented 5 years ago

It would be helpful to have +-1 Minute of Log. The validity check only looks for specific values that could avoid a car from sleeping and writing nonsense values since the Owner API sometimes reports them. That Rule for instance checks if Voltage is < 10 and enforces it to be 0..

notnicehat commented 5 years ago

i will pull more logs tonight. disabled the scraper as it was spewing those every second overnight.

notnicehat commented 5 years ago

Attached logs, though not maybe that helpful...

I left a couple minutes of logs as I entered the garage, showing the heading and lat/long and other things changing.

At 03:16:45, you can see it shift from D to P, and I left the car alone, but the interval continues to be 1 second despite nothing changing-- the rest of the logs after this point are the same entries.

It looks like the validity check forcing the "charger_voltage" to 2 then the stats pull comparing the value 2 to the forced value of 0 is keeping the car awake because "something" is changing, so it keeps the interval at 1?

logs.txt

notnicehat commented 5 years ago

It honestly does not appear to impact the range all that much; I had the car out all day yesterday driving around the SF bay area, but i feel like long term, it should let the car sleep.

Additionally I need to implement a logrotate on my box :-)

lephisto commented 5 years ago

merged. thanks for contributung.