Open shiner66 opened 6 months ago
Why this change ? Are you sure ?
I don't really think that's causing any issue, besides not being "up to" HA standards and issuing log messages about the state classes non being correct for their type. Still I haven't really tested this change aside from booting up my instance and checking logs, being night I didn't check any calculations from the integration for possible issues, still, should be an insignificant change
Please see
Entities not representing a total amount
Home Assistant tracks the min, max and mean value during the statistics period. The state_class property must be set to measurement, and the device_class must not be either of energy, gas, or monetary
https://developers.home-assistant.io/docs/core/entity/sensor/
issuing log messages about the state classes non being correct for their type
I don't have any message like that on my side. Strange. But I think now that all Sensor should be MEASUREMENT and not TOTAL even this gives no impact this is more on the HA philosophie. TOTAL should always increase and that is not the case here. It is a MEASURE of the current cycle.
If you want, you can change for MEASUREMENT (just replace TOTAL by MEASUREMENT) and I will merge it.
If you only work with measurement, then HA will freak out about the class being wrong for monetary value and it suggests to use total for it, which per ha documentation does have a bit of sense.
See from the same doc (examples section)
The sensor's state is reset with every state update, for example a sensor updating every minute with the energy consumption during the past minute: state class total, last_reset updated every state change.
Why this change ? Are you sure ?
I wonder that every SensorStateClass should be MEASUREMENT. Why do you think "best_objective" is a TOTAL?