You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm developing a HASS integration that imports water meter readings and I deal with similar problems.
I've tried to use the ha-historical-sensor and I have some questions about the usage.
I see that the code example suggests not setting the _attr_state_class and the _state. The sensor works with Energy Dashboard (but shows a warning message here and there). But I see some other sensor usage is limited.
Is it anyhow possible to overcome setting the _attr_state_class and _state to None?
The text was updated successfully, but these errors were encountered:
By setting the _state attr you are telling HA that you have a current state, which is not true if your are importing data from the past. You may think that the last state (now-X hours) may be the current _state but it's not, in X hours you will import new data and that point may have a different value. Also messes graphs with inconsistent data points.
Setting _attr_state_class causes HA to calculate statistics data which is not what you want since your are working with historical data and not present data. Statistical data will be incorrect, if any is calculated. Historical sensors have helper functions to deal with statistics
I have a pending PR with some valuable info: #9
Also, check this issue and following discussion.
Hi,
I'm developing a HASS integration that imports water meter readings and I deal with similar problems.
I've tried to use the ha-historical-sensor and I have some questions about the usage.
I see that the code example suggests not setting the _attr_state_class and the _state. The sensor works with Energy Dashboard (but shows a warning message here and there). But I see some other sensor usage is limited.
Is it anyhow possible to overcome setting the _attr_state_class and _state to None?
The text was updated successfully, but these errors were encountered: