|
9 | 9 | class BaseClass: |
10 | 10 | """Plugwise Base Gateway data class.""" |
11 | 11 |
|
12 | | - available: bool | None |
| 12 | + available: bool | None # not for gateway, should always be available |
13 | 13 | dev_class: str |
14 | 14 | firmware: str |
15 | 15 | hardware: str | None |
16 | 16 | location: str |
17 | | - mac_address: str |
| 17 | + mac_address: str |
18 | 18 | model: str |
19 | 19 | model_id: str | None |
20 | 20 | name: str |
21 | 21 | vendor: str |
22 | 22 |
|
23 | 23 |
|
24 | 24 | @dataclass |
25 | | -class SmileP1Gateway(BaseClass): |
26 | | - """Plugwise Smile P1 Gateway data class.""" |
27 | | - |
28 | | - binary_sensors: GatewayBinarySensors # Not for legacy? |
29 | | - |
30 | | - |
31 | | -@dataclass |
32 | | -class StretchGateway(BaseClass): |
33 | | - """Plugwise Stretch Gateway data class.""" |
| 25 | +class AdamGateway(BaseClass): |
| 26 | + """Plugwise Adam HA Gateway data class.""" |
34 | 27 |
|
| 28 | + binary_sensors: GatewayBinarySensors |
| 29 | + gateway_modes: list[str] |
| 30 | + regulation_modes: list[str] |
| 31 | + select_gateway_mode: str |
| 32 | + select_regulation_mode: str |
| 33 | + sensors: Weather |
35 | 34 | zigbee_mac_address: str |
36 | 35 |
|
37 | 36 |
|
38 | 37 | @dataclass |
39 | 38 | class SmileTGateway(BaseClass): |
40 | 39 | """Plugwise Anna Smile-T Gateway data class.""" |
41 | 40 |
|
42 | | - binary_sensors: GatewayBinarySensors | HeaterCentralBinarySensors # Not for legacy? |
43 | | - sensors: GatewaySensors |
| 41 | + binary_sensors: GatewayBinarySensors |
| 42 | + sensors: Weather |
44 | 43 |
|
45 | 44 |
|
46 | 45 | @dataclass |
47 | | -class GatewayBinarySensors: |
48 | | - """Gateway binary_sensors class.""" |
| 46 | +class SmileTLegacyGateway(BaseClass): |
| 47 | + """Plugwise legacy Anna Smile-T Gateway data class.""" |
49 | 48 |
|
50 | | - plugwise_notification: bool # None for some? |
| 49 | + sensors: Weather |
51 | 50 |
|
52 | 51 |
|
53 | 52 | @dataclass |
54 | | -class GatewaySensors: |
55 | | - """Gateway sensors class.""" |
| 53 | +class SmileP1Gateway(BaseClass): |
| 54 | + """Plugwise Smile P1 Gateway data class.""" |
56 | 55 |
|
57 | | - outdoor_temperature: float | None # None when not enabled? |
| 56 | + binary_sensors: GatewayBinarySensors |
58 | 57 |
|
59 | 58 |
|
60 | 59 | @dataclass |
61 | | -class AdamGateway(BaseClass): |
62 | | - """Plugwise Adam HA Gateway data class.""" |
| 60 | +class SmileP1LegacyGateway(BaseClass): |
| 61 | + """Plugwise legacy Smile P1 Gateway data class.""" |
| 62 | + |
| 63 | + |
| 64 | +@dataclass |
| 65 | +class StretchGateway(BaseClass): |
| 66 | + """Plugwise Stretch Gateway data class.""" |
63 | 67 |
|
64 | | - binary_sensors: GatewayBinarySensors | HeaterCentralBinarySensors # Not for legacy? |
65 | | - gateway_modes: list[str] |
66 | | - regulation_modes: list[str] |
67 | | - select_gateway_mode: str |
68 | | - select_regulation_mode: str |
69 | | - sensors: GatewaySensors |
70 | 68 | zigbee_mac_address: str |
71 | 69 |
|
72 | 70 |
|
| 71 | +@dataclass |
| 72 | +class GatewayBinarySensors: |
| 73 | + """Gateway binary_sensors class.""" |
| 74 | + |
| 75 | + plugwise_notification: bool |
| 76 | + |
| 77 | + |
| 78 | +@dataclass |
| 79 | +class Weather: |
| 80 | + """Gateway weather sensor class.""" |
| 81 | + |
| 82 | + outdoor_temperature: float | None # None when not available |
| 83 | + |
| 84 | + |
73 | 85 | @dataclass |
74 | 86 | class SmartEnergyMeter(BaseClass): |
75 | 87 | """DSMR Energy Meter data class.""" |
@@ -335,50 +347,109 @@ class PlugSwitches: |
335 | 347 |
|
336 | 348 | ################################################## |
337 | 349 | class PlugwiseData |
338 | | -""" |
339 | | -Overview of existing options: |
340 | | -
|
341 | | -- Gateway Adam |
342 | | - - Climate device |
343 | | - - OnOff |
344 | | - - Opentherm |
345 | | - - Zones (1 to many) with thermostatic and energy sensors summary, with thermostat setpoint- and mode-, preset- & schedule-setter |
346 | | - - Location (Home) with weather data - only outdoor_temp used |
347 | | - - Single devices (appliances) assigned to a Zone, or not |
348 | | - - Anna (wired thermostat) |
349 | | - - Lisa (ZigBee thermostat) |
350 | | - - Jip (ZigBee thermostat) |
351 | | - - Tom/Floor (ZigBee valve/thermostat) |
352 | | - - Plug (energy switch/meter) |
353 | | - - Aqara Plug (energy switch/meter) |
354 | | - - Noname switch (energy switch) |
355 | | -
|
356 | | -- Gateway SmileT |
357 | | - - Climate device |
358 | | - - OnOff |
359 | | - - OpenTherm |
360 | | - - Zone (Living room) with with thermostatic and energy sensors summary, with thermostat setpoint- and mode-, preset- & schedule-setter |
361 | | - - Location (Home) with weather data - only outdoor_temp used |
362 | | - - Single devices (appliances) |
| 350 | + """ |
| 351 | + Overview of existing options: |
| 352 | +
|
| 353 | + - Gateway Adam |
| 354 | + - Climate device |
| 355 | + - OnOff |
| 356 | + - Opentherm |
| 357 | + - Zones (1 to many) with thermostatic and energy sensors summary, with thermostat setpoint- and mode-, preset- & schedule-setter |
| 358 | + - Location (Home) with weather data - only outdoor_temp used |
| 359 | + - Single devices (appliances) assigned to a Zone, or not |
| 360 | + - Anna (wired thermostat) |
| 361 | + - Lisa (ZigBee thermostat) |
| 362 | + - Jip (ZigBee thermostat) |
| 363 | + - Tom/Floor (ZigBee valve/thermostat) |
| 364 | + - Plug (energy switch/meter) |
| 365 | + - Aqara Plug (energy switch/meter) |
| 366 | + - Noname switch (energy switch) |
| 367 | +
|
| 368 | + - Gateway SmileT |
| 369 | + - Climate device |
| 370 | + - OnOff |
| 371 | + - OpenTherm |
| 372 | + - Zone (Living room) with with thermostatic and energy sensors summary, with thermostat setpoint- and mode-, preset- & schedule-setter |
| 373 | + - Location (Home) with weather data - only outdoor_temp used |
| 374 | + - Single devices (appliances) |
| 375 | + - Anna (wired thermostat) |
| 376 | + - P1-DSMR device (new Anna P1) (?) |
| 377 | +
|
| 378 | + - Gateway SmileT legacy |
| 379 | + - OnOff/OpenTherm device |
363 | 380 | - Anna (wired thermostat) |
364 | | - - P1-DSMR device (new Anna P1) (?) |
| 381 | + - Location (Home) with weather data (optional?) - only outdoor_temp used |
365 | 382 |
|
366 | | -- Gateway SmileT legacy |
367 | | - - OnOff/OpenTherm device |
368 | | - - Anna (wired thermostat) |
369 | | - - Location (Home) with weather data (optional?) - only outdoor_temp used |
| 383 | + - Gateway P1 |
| 384 | + - P1-DSMR device (in Home location) |
370 | 385 |
|
371 | | -- Gateway P1 |
372 | | - - P1-DSMR device (in Home location) |
| 386 | + - Gateway P1 legacy |
| 387 | + - P1-DSMR device (in modules) |
373 | 388 |
|
374 | | -- Gateway P1 legacy |
375 | | - - P1-DSMR device (in modules) |
376 | | -
|
377 | | -- Gateway Stretch (legacy) |
378 | | - - Single devices (Zigbee) |
379 | | - - ?? |
| 389 | + - Gateway Stretch (legacy) |
| 390 | + - Single devices (Zigbee) |
| 391 | + - ?? |
| 392 | + """ |
380 | 393 |
|
381 | | -""" |
| 394 | + adam: AdamGateway() |
| 395 | + smile_t: SmileTGatewayGateway() |
| 396 | + smile_t_legacy: SmileTLegacyGateway() |
| 397 | + smile_t_p1: AnnaP1Gateway() # double? |
| 398 | + smile_p1: SmileP1Gateway() |
| 399 | + smile_p1_legacy: SmileP1LegacyGateway() |
| 400 | + stretch: StretchGateway |
| 401 | + onoff: OnOff() |
| 402 | + opentherm: OpenTherm() |
| 403 | + zones: list[Zone()] |
| 404 | + weather: Weather() |
| 405 | + anna: Anna() |
| 406 | + anna_legacy: AnnaLegacy() |
| 407 | + anna_adam: AnnaAdam() |
| 408 | + lisa: Lisa() |
| 409 | + jip: Jip() |
| 410 | + tom_floor: TomFloor() |
| 411 | + plug: Plug() |
| 412 | + plug_legacy: PlugLegacy() |
| 413 | + aqara_plug: AqaraPlug() |
| 414 | + misc_plug: MiscPlug() |
| 415 | + p1_dsmr: P1_DSMR() |
| 416 | + |
| 417 | + def update_from_dict(self, data: dict[str, Any]) -> PlugwiseData: |
| 418 | + """Update the status object with data received from the Plugwise API.""" |
| 419 | + if "adam" in data: |
| 420 | + self.adam.update_from_dict(data["adam"]) |
| 421 | + if "smile_t" in data: |
| 422 | + self.smile_t.update_from_dict(data["smile_t"]) |
| 423 | + if "smile_t_p1" in data: |
| 424 | + self.smile_t_p1.update_from_dict(data["smile_t_p1"]) |
| 425 | + if "smile_p1" in data: |
| 426 | + self.smile_p1.update_from_dict(data["smile_p1"]) |
| 427 | + if "stretch" in data: |
| 428 | + self.stretch.update_from_dict(data["stretch"]) |
| 429 | + if "onoff" in data: |
| 430 | + self.onoff.update_from_dict(data["onoff"]) |
| 431 | + if "opentherm" in data: |
| 432 | + self.opentherm.update_from_dict(data["opentherm"]) |
| 433 | + if "zones" in data: |
| 434 | + self.zones.update_from_dict(data["zones"]) |
| 435 | + if "anna" in data: |
| 436 | + self.anna.update_from_dict(data["anna"]) |
| 437 | + if "anna_adam" in data: |
| 438 | + self.anna_adam.update_from_dict(data["anna_adam"]) |
| 439 | + if "lisa" in data: |
| 440 | + self.lisa.update_from_dict(data["lisa"]) |
| 441 | + if "jip" in data: |
| 442 | + self.zones.update_from_dict(data["jip"]) |
| 443 | + if "tom_floor" in data: |
| 444 | + self.tom_floor.update_from_dict(data["tom_floor"]) |
| 445 | + if "plug" in data: |
| 446 | + self.plug.update_from_dict(data["plug"]) |
| 447 | + if "aqara_plug" in data: |
| 448 | + self.opentherm.update_from_dict(data["aqara_plug"]) |
| 449 | + if "misc_plug" in data: |
| 450 | + self.misc_plug.update_from_dict(data["misc_plug"]) |
| 451 | + if "p1_dsmr" in data: |
| 452 | + self.p1_dsmr.update_from_dict(data["p1_dsmr"]) |
382 | 453 | ################################################## |
383 | 454 |
|
384 | 455 | # class PlugwiseP1: |
|
0 commit comments