tesla icon indicating copy to clipboard operation
tesla copied to clipboard

has state class total_increasing, but its state is not strictly increasing

Open MarkLyck opened this issue 2 years ago • 2 comments

Version of the custom_component

2.3.0

Describe the bug

My home assistant crashed last night and went through the debug logs and found a warning related to this integration. I'm pretty sure it's not what crashed my home assistant but thought I'd create an issue for it regardless.

It looks like the energy_added_sensor is supposed to be "total_increasing" but it got a state that was not increasing.

Debug log

2022-06-02 04:15:10 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.tesla_energy_added_sensor from integration tesla_custom has state class total_increasing, but its state is not strictly increasing. Triggered by state 47.95 (48.06) with last_updated set to 2022-06-02T08:10:19.803916+00:00. Please report it to the custom component author.

MarkLyck avatar Jun 02 '22 13:06 MarkLyck

Looks like the API does sometimes reduce the value without hitting 0.

alandtse avatar Jun 04 '22 04:06 alandtse

Bump on this issue. Without going back to 0 between charges, it is impossible to aggregate the total amount of charge for a given period. For example, using a utility meter for monthly energy consumption on the energy added sensor does not work.

metrafonic avatar Jul 17 '22 22:07 metrafonic

I am still getting that error:

Entity sensor.domis_tesla_energy_added from integration tesla_custom has state class total_increasing, but its state is not strictly increasing. Triggered by state 49.86 (50.12) with last_updated set to 2022-12-29T12:47:04.912625+00:00. Please report it to the custom integration author.

Dominik-Notzon avatar Dec 29 '22 17:12 Dominik-Notzon

I am still getting that error:

Entity sensor.domis_tesla_energy_added from integration tesla_custom has state class total_increasing, but its state is not strictly increasing. Triggered by state 49.86 (50.12) with last_updated set to 2022-12-29T12:47:04.912625+00:00. Please report it to the custom integration author.

This is because energy added from the car sometimes decreases slightly when the battery cools down, in your case from 50.12 to 49.86. Really we should be using energy used rather than energy added, and that will never decrease. However it would have to be calculated since it's not provided by the API.

The warning doesn't cause any problem however, the value can decrease by up to 10% at a time before the consumption resets.

carleeno avatar Dec 29 '22 21:12 carleeno