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
When configuring a sensor, the state_class is optional. This can cause issues where the state_class of a sensor is not set even though it should be set.
I propose that certain types set certain state_classes if the config omits them, similar to how this is done with device_class [1].
Examples:
type: temperature should probably always have a state_class: measurement. Same for power, brightness, illuminance, current, etc...
type: active_energy should probably alway have state_class: total_increasing.
Overriding the state_class would still be possible. Removing a state_class would be harder, maybe setting the config option to false could remove it?
[1] If I understand the code correctly, the device_class is actually set in XKNX based on the sensor type/DPT.
The text was updated successfully, but these errors were encountered:
For reference, here is the initial implementation discussion about state_class in KNX sensor entities - and why it defaults to None (the state_class requirements / restrictions have been a bit different back then) home-assistant/core#53996 (comment)
Removing a state_class would be harder, maybe setting the config option to false could remove it?
setting it explicitly to None / null could be an option too.
If I understand the code correctly, the device_class is actually set in XKNX based on the sensor type/DPT.
Yes, but I'd like to move away from that. I think it would be better to keep HA-specifics in the HA integration and KNX specifics in xknx.
When configuring a sensor, the
state_class
is optional. This can cause issues where the state_class of a sensor is not set even though it should be set.I propose that certain types set certain
state_class
es if the config omits them, similar to how this is done withdevice_class
[1].Examples:
type: temperature
should probably always have astate_class: measurement
. Same forpower
,brightness
,illuminance
,current
, etc...type: active_energy
should probably alway havestate_class: total_increasing
.Overriding the
state_class
would still be possible. Removing astate_class
would be harder, maybe setting the config option tofalse
could remove it?[1] If I understand the code correctly, the
device_class
is actually set in XKNX based on the sensor type/DPT.The text was updated successfully, but these errors were encountered: