plugwise 0.37.1a2__py3-none-any.whl → 0.37.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
plugwise/legacy/data.py CHANGED
@@ -6,7 +6,7 @@ from __future__ import annotations
6
6
 
7
7
  # Dict as class
8
8
  # Version detection
9
- from plugwise.constants import NONE, SWITCH_GROUP_TYPES, ZONE_THERMOSTATS, DeviceData
9
+ from plugwise.constants import NONE, DeviceData
10
10
  from plugwise.legacy.helper import SmileLegacyHelper
11
11
  from plugwise.util import remove_empty_platform_dicts
12
12
 
@@ -18,16 +18,6 @@ class SmileLegacyData(SmileLegacyHelper):
18
18
  """Init."""
19
19
  SmileLegacyHelper.__init__(self)
20
20
 
21
- def _update_gw_devices(self) -> None:
22
- """Helper-function for _all_device_data() and async_update().
23
-
24
- Collect data for each device and add to self.gw_devices.
25
- """
26
- for device_id, device in self.gw_devices.items():
27
- data = self._get_device_data(device_id)
28
- device.update(data)
29
- remove_empty_platform_dicts(device)
30
-
31
21
  def _all_device_data(self) -> None:
32
22
  """Helper-function for get_all_devices().
33
23
 
@@ -38,7 +28,6 @@ class SmileLegacyData(SmileLegacyHelper):
38
28
  {
39
29
  "gateway_id": self.gateway_id,
40
30
  "item_count": self._count,
41
- "notifications": self._notifications,
42
31
  "smile_name": self.smile_name,
43
32
  }
44
33
  )
@@ -47,20 +36,35 @@ class SmileLegacyData(SmileLegacyHelper):
47
36
  {"heater_id": self._heater_id, "cooling_present": False}
48
37
  )
49
38
 
50
- def _device_data_switching_group(
51
- self, device: DeviceData, data: DeviceData
52
- ) -> None:
53
- """Helper-function for _get_device_data().
39
+ def _update_gw_devices(self) -> None:
40
+ """Helper-function for _all_device_data() and async_update().
54
41
 
55
- Determine switching group device data.
42
+ Collect data for each device and add to self.gw_devices.
56
43
  """
57
- if device["dev_class"] in SWITCH_GROUP_TYPES:
58
- counter = 0
59
- for member in device["members"]:
60
- if self.gw_devices[member]["switches"].get("relay"):
61
- counter += 1
62
- data["switches"]["relay"] = counter != 0
63
- self._count += 1
44
+ for device_id, device in self.gw_devices.items():
45
+ data = self._get_device_data(device_id)
46
+ device.update(data)
47
+ remove_empty_platform_dicts(device)
48
+
49
+ def _get_device_data(self, dev_id: str) -> DeviceData:
50
+ """Helper-function for _all_device_data() and async_update().
51
+
52
+ Provide device-data, based on Location ID (= dev_id), from APPLIANCES.
53
+ """
54
+ device = self.gw_devices[dev_id]
55
+ data = self._get_measurement_data(dev_id)
56
+
57
+ # Switching groups data
58
+ self._device_data_switching_group(device, data)
59
+
60
+ # Skip obtaining data when not a thermostat
61
+ if device["dev_class"] != "thermostat":
62
+ return data
63
+
64
+ # Thermostat data (presets, temperatures etc)
65
+ self._device_data_climate(device, data)
66
+
67
+ return data
64
68
 
65
69
  def _device_data_climate(self, device: DeviceData, data: DeviceData) -> None:
66
70
  """Helper-function for _get_device_data().
@@ -86,23 +90,3 @@ class SmileLegacyData(SmileLegacyHelper):
86
90
  self._count += 1
87
91
  if sel_schedule == NONE:
88
92
  data["mode"] = "heat"
89
-
90
- def _get_device_data(self, dev_id: str) -> DeviceData:
91
- """Helper-function for _all_device_data() and async_update().
92
-
93
- Provide device-data, based on Location ID (= dev_id), from APPLIANCES.
94
- """
95
- device = self.gw_devices[dev_id]
96
- data = self._get_measurement_data(dev_id)
97
-
98
- # Switching groups data
99
- self._device_data_switching_group(device, data)
100
-
101
- # Skip obtaining data for non master-thermostats
102
- if device["dev_class"] not in ZONE_THERMOSTATS:
103
- return data
104
-
105
- # Thermostat data (presets, temperatures etc)
106
- self._device_data_climate(device, data)
107
-
108
- return data