File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,12 @@ def state_class(self):
121
121
state_class = None
122
122
if self .device_class is DEVICE_CLASS_ENERGY :
123
123
state_class = STATE_CLASS_TOTAL_INCREASING
124
- elif self .device_class is not None :
124
+ elif self .device_class in [
125
+ DEVICE_CLASS_CURRENT ,
126
+ DEVICE_CLASS_POWER ,
127
+ DEVICE_CLASS_TEMPERATURE ,
128
+ DEVICE_CLASS_BATTERY ,
129
+ ]:
125
130
state_class = STATE_CLASS_MEASUREMENT
126
131
return state_class
127
132
@@ -141,7 +146,11 @@ def device_class(self):
141
146
device_class = DEVICE_CLASS_TEMPERATURE
142
147
elif self .metric .lower ().startswith ("soc" ):
143
148
device_class = DEVICE_CLASS_BATTERY
144
- elif self .metric .lower ().startswith ("heartbeat" ):
149
+ elif self .metric in [
150
+ HAChargerDetails .config_response .value ,
151
+ HAChargerDetails .data_response .value ,
152
+ HAChargerStatuses .heartbeat .value ,
153
+ ]:
145
154
device_class = DEVICE_CLASS_TIMESTAMP
146
155
return device_class
147
156
You can’t perform that action at this time.
0 commit comments