@@ -144,91 +144,93 @@ class SmartEnergyLegacySensors:
144
144
net_electricity_point : int
145
145
146
146
147
- class AnnaData (TypedDict , total = False ):
148
- """Plugwise Anna data class."""
147
+ @dataclass
148
+ class AnnaData :
149
+ """Plugwise Anna data class, also for legacy Anna."""
149
150
150
- active_preset : str
151
+ active_preset : str | None
151
152
available_schedules : list [str ]
153
+ climate_mode : str
154
+ control_state : str
152
155
dev_class : str
153
156
firmware : str
154
157
hardware : str
155
158
location : str
156
- mode : str
157
159
model : str
158
- model_id : str
159
160
name : str
160
- preset_modes : list [str ]
161
- select_schedule : str
161
+ preset_modes : list [str ] | None
162
+ select_schedule : str | None
162
163
sensors : AnnaSensors
163
- temperature_offset : SetpointDict
164
+ temperature_offset : SetpointDict | None # not for legacy
164
165
thermostat : ThermostatDict
165
166
vendor : str
166
167
167
168
168
- class AnnaSensors (TypedDict , total = False ):
169
+ @dataclass
170
+ class AnnaSensors :
169
171
"""Anna sensors class."""
170
172
171
- cooling_activation_outdoor_temperature : float
172
- cooling_deactivation_threshold : float
173
173
illuminance : float
174
- setpoint : float
175
- setpoint_high : float
176
- setpoint_low : float
174
+ setpoint : float | None
175
+ setpoint_high : float | None
176
+ setpoint_low : float | None
177
177
temperature : float
178
178
179
179
180
180
@dataclass
181
181
class ThermoZone :
182
182
"""Plugwise Adam ThermoZone data class."""
183
183
184
- active_preset : str
184
+ active_preset : str | None
185
185
available_schedules : list [str ]
186
186
climate_mode : str
187
187
control_state : str
188
+ dev_class : str
189
+ model : str
190
+ name : str
188
191
preset_modes : list [str ]
189
192
select_schedule : str
190
193
sensors : ThermoZoneSensors
191
194
thermostat : ThermostatDict
195
+ thermostats : ThermostatsDict
196
+ vendor : str
192
197
193
198
194
- class ThermoZoneSensors (TypedDict , total = False ):
199
+ @dataclass
200
+ class ThermoZoneSensors :
195
201
"""ThermoZone sensors class."""
196
202
197
- electricity_consumed : float
198
- electricity_produced : float
203
+ electricity_consumed : float | None # only with Plug(s) in the zone
204
+ electricity_produced : float | None # only with Plug(s) in the zone
199
205
temperature : float
200
206
201
207
202
- class AnnaAdamData (TypedDict , total = False ):
208
+ @dataclass
209
+ class AnnaAdamData :
203
210
"""Plugwise Anna-connected-to-Adam data class."""
204
211
205
- available : bool
206
212
dev_class : str
207
- firmware : str
208
- hardware : str
209
213
location : str
210
- mode : str
211
214
model : str
212
215
model_id : str
213
216
name : str
214
217
sensors : AnnaSensors
215
- temperature_offset : SetpointDict
216
218
vendor : str
217
219
218
220
219
- class JipLisaTomData (TypedDict , total = False ):
221
+ @dataclass
222
+ class JipLisaTomData :
220
223
"""JipLisaTomData data class.
221
224
222
225
Covering Plugwise Jip, Lisa and Tom/Floor devices.
223
226
"""
224
227
225
228
available : bool
226
- binary_sensors : WirelessThermostatBinarySensors
229
+ binary_sensors : WirelessThermostatBinarySensors | None # Not for AC powered Lisa/Tom
227
230
dev_class : str
228
231
firmware : str
229
232
hardware : str
230
233
location : str
231
- mode : str
232
234
model : str
233
235
model_id : str
234
236
name : str
@@ -238,17 +240,18 @@ class JipLisaTomData(TypedDict, total=False):
238
240
zigbee_mac_address : str
239
241
240
242
241
- class JipLisaTomSensors (TypedDict , total = False ):
243
+ @dataclass
244
+ class JipLisaTomSensors :
242
245
"""Tom sensors class."""
243
246
244
- battery : int
245
- humidity : int # Jip only
246
- setpoint : float # heat or cool
247
- setpoint_high : float # heat_cool
248
- setpoint_low : float # heat_cool
247
+ battery : int | None # not when AC powered, Lisa/Tom
248
+ humidity : int | None # Jip only
249
+ setpoint : float | None # heat or cool
250
+ setpoint_high : float | None # heat_cool
251
+ setpoint_low : float | None # heat_cool
249
252
temperature : float
250
- temperature_difference : float
251
- valve_position : float
253
+ temperature_difference : float | None # Tom only
254
+ valve_position : float | None # Tom only
252
255
253
256
254
257
@dataclass
@@ -271,17 +274,26 @@ class SetpointDict:
271
274
upper_bound : float
272
275
273
276
274
- class ThermostatDict (TypedDict , total = False ):
277
+ @dataclass
278
+ class ThermostatDict :
275
279
"""Thermostat dict class."""
276
280
277
281
lower_bound : float
278
282
resolution : float
279
- setpoint : float # heat or cool
280
- setpoint_high : float # heat_cool
281
- setpoint_low : float # heat_cool
283
+ setpoint : float | None # heat or cool
284
+ setpoint_high : float | None # heat_cool
285
+ setpoint_low : float | None # heat_cool
282
286
upper_bound : float
283
287
284
288
289
+ @dataclass
290
+ class ThermostatsDict :
291
+ """Thermostats dict class."""
292
+
293
+ primary : list [str ]
294
+ secondary : list [str ]
295
+
296
+
285
297
@dataclass
286
298
class OnOffTherm :
287
299
"""On-off heater/cooler device class."""
@@ -293,68 +305,72 @@ class OnOffTherm:
293
305
name : str
294
306
295
307
296
- class OpenTherm (TypedDict , total = False ):
308
+ @dataclass
309
+ class OpenTherm :
297
310
"""OpenTherm heater/cooler device class."""
298
311
299
312
available : str
300
313
binary_sensors : HeaterCentralBinarySensors
301
314
dev_class : str
302
315
location : str
303
- maximum_boiler_temperature : SetpointDict
304
- max_dhw_temperature : SetpointDict
316
+ maximum_boiler_temperature : SetpointDict | None
317
+ max_dhw_temperature : SetpointDict | None
305
318
model : str
306
- model_id : str
319
+ model_id : str | None
307
320
name : str
308
321
sensors : HeaterCentralSensors
309
322
switches : HeaterCentralSwitches
310
323
vendor : str
311
324
312
325
313
- class HeaterCentralBinarySensors (TypedDict , total = False ):
326
+ @dataclass
327
+ class HeaterCentralBinarySensors :
314
328
"""Heater-central binary_sensors class."""
315
329
316
- compressor_state : bool
317
- cooling_enabled : bool
318
- cooling_state : bool
330
+ compressor_state : bool | None
331
+ cooling_enabled : bool | None
332
+ cooling_state : bool | None
319
333
dhw_state : bool
320
334
flame_state : bool
321
335
heating_state : bool
322
- secondary_boiler_state : bool
336
+ secondary_boiler_state : bool | None
323
337
324
338
325
- class HeaterCentralSensors (TypedDict , total = False ):
339
+ @dataclass
340
+ class HeaterCentralSensors :
326
341
"""Heater-central sensors class."""
327
342
328
- dhw_temperature : float
329
- domestic_hot_water_setpoint : float
330
- intended_boiler_temperature : float
331
- modulation_level : float
332
- outdoor_air_temperature : float
343
+ dhw_temperature : float | None
344
+ domestic_hot_water_setpoint : float | None
345
+ intended_boiler_temperature : float | None
346
+ modulation_level : float | None
347
+ outdoor_air_temperature : float | None
333
348
return_temperature : float
334
- water_pressure : float
349
+ water_pressure : float | None
335
350
water_temperature : float
336
351
337
352
338
- class HeaterCentralSwitches (TypedDict , total = False ):
353
+ @dataclass
354
+ class HeaterCentralSwitches :
339
355
"""Heater-central switches class."""
340
356
341
- cooling_ena_switch : bool
357
+ cooling_ena_switch : bool | None
342
358
dhw_cm_switch : bool
343
359
344
360
345
361
@dataclass
346
362
class PlugData :
347
- """Plug data class."""
363
+ """Plug data class covering Plugwise Adam/Stretch and Aqara Plugs, and generic ZigBee type Switches ."""
348
364
349
- available : bool
365
+ available : bool | None
350
366
dev_class : str
351
- firmware : str
352
- # hardware: str
367
+ firmware : str | None
368
+ hardware : str | None
353
369
location : str
354
- model : str
370
+ model : str | None
355
371
model_id : str
356
372
name : str
357
- sensors : PlugSensors
373
+ sensors : PlugSensors | None
358
374
switches : PlugSwitches
359
375
vendor : str
360
376
zigbee_mac_address : str
@@ -364,17 +380,17 @@ class PlugData:
364
380
class PlugSensors :
365
381
"""Plug sensors class."""
366
382
367
- electricity_consumed : float
383
+ electricity_consumed : float | None
368
384
electricity_consumed_interval : float
369
- electricity_produced : float
370
- electricity_produced_interval : float
385
+ electricity_produced : float | None
386
+ electricity_produced_interval : float | None
371
387
372
388
373
389
@dataclass
374
390
class PlugSwitches (TypedDict , total = False ):
375
391
"""Plug switches class."""
376
392
377
- lock : bool
393
+ lock : bool | None
378
394
relay : bool
379
395
380
396
0 commit comments