plugwise 1.6.2__py3-none-any.whl → 1.6.4__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/smile.py CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Plugwise backend module for Home Assistant Core.
4
4
  """
5
+
5
6
  from __future__ import annotations
6
7
 
7
8
  from collections.abc import Awaitable, Callable
@@ -94,7 +95,6 @@ class SmileAPI(SmileData):
94
95
  self.smile_version = smile_version
95
96
  SmileData.__init__(self)
96
97
 
97
-
98
98
  async def full_xml_update(self) -> None:
99
99
  """Perform a first fetch of all XML data, needed for initialization."""
100
100
  self._domain_objects = await self.request(DOMAIN_OBJECTS)
@@ -131,24 +131,30 @@ class SmileAPI(SmileData):
131
131
  try:
132
132
  await self.full_xml_update()
133
133
  self.get_all_gateway_entities()
134
+ # Set self._cooling_enabled - required for set_temperature,
135
+ # also, check for a failed data-retrieval
134
136
  if "heater_id" in self.gw_data:
135
137
  heat_cooler = self.gw_entities[self.gw_data["heater_id"]]
136
138
  if (
137
139
  "binary_sensors" in heat_cooler
138
140
  and "cooling_enabled" in heat_cooler["binary_sensors"]
139
141
  ):
140
- self._cooling_enabled = heat_cooler["binary_sensors"]["cooling_enabled"]
142
+ self._cooling_enabled = heat_cooler["binary_sensors"][
143
+ "cooling_enabled"
144
+ ]
145
+ else: # cover failed data-retrieval for P1
146
+ _ = self.gw_entities[self.gateway_id]["location"]
141
147
  except KeyError as err:
142
- raise DataMissingError("No Plugwise data received") from err
148
+ raise DataMissingError("No Plugwise actual data received") from err
143
149
 
144
150
  return PlugwiseData(
145
151
  devices=self.gw_entities,
146
152
  gateway=self.gw_data,
147
153
  )
148
154
 
149
- ########################################################################################################
150
- ### API Set and HA Service-related Functions ###
151
- ########################################################################################################
155
+ ########################################################################################################
156
+ ### API Set and HA Service-related Functions ###
157
+ ########################################################################################################
152
158
 
153
159
  async def delete_notification(self) -> None:
154
160
  """Delete the active Plugwise Notification."""
@@ -220,7 +226,9 @@ class SmileAPI(SmileData):
220
226
 
221
227
  await self.call_request(uri, method="put", data=data)
222
228
 
223
- async def set_select(self, key: str, loc_id: str, option: str, state: str | None) -> None:
229
+ async def set_select(
230
+ self, key: str, loc_id: str, option: str, state: str | None
231
+ ) -> None:
224
232
  """Set a dhw/gateway/regulation mode or the thermostat schedule option."""
225
233
  match key:
226
234
  case "select_dhw_mode":
@@ -252,7 +260,12 @@ class SmileAPI(SmileData):
252
260
  valid = ""
253
261
  if mode == "away":
254
262
  time_1 = self._domain_objects.find("./gateway/time").text
255
- away_time = dt.datetime.fromisoformat(time_1).astimezone(dt.UTC).isoformat(timespec="milliseconds").replace("+00:00", "Z")
263
+ away_time = (
264
+ dt.datetime.fromisoformat(time_1)
265
+ .astimezone(dt.UTC)
266
+ .isoformat(timespec="milliseconds")
267
+ .replace("+00:00", "Z")
268
+ )
256
269
  valid = (
257
270
  f"<valid_from>{away_time}</valid_from><valid_to>{end_time}</valid_to>"
258
271
  )
@@ -446,8 +459,8 @@ class SmileAPI(SmileData):
446
459
 
447
460
  if setpoint is None:
448
461
  raise PlugwiseError(
449
- "Plugwise: failed setting temperature: no valid input provided"
450
- ) # pragma: no cover"
462
+ "Plugwise: failed setting temperature: no valid input provided"
463
+ ) # pragma: no cover"
451
464
 
452
465
  temperature = str(setpoint)
453
466
  uri = self._thermostat_uri(loc_id)
plugwise/util.py CHANGED
@@ -1,4 +1,5 @@
1
1
  """Plugwise protocol helpers."""
2
+
2
3
  from __future__ import annotations
3
4
 
4
5
  import datetime as dt
@@ -41,9 +42,7 @@ def check_alternative_location(loc: Munch, legacy: bool) -> Munch:
41
42
  loc.found = False
42
43
  return loc
43
44
 
44
- loc.locator = (
45
- f'./{loc.log_type}[type="{loc.measurement}"]/period/measurement'
46
- )
45
+ loc.locator = f'./{loc.log_type}[type="{loc.measurement}"]/period/measurement'
47
46
  if legacy:
48
47
  loc.locator = (
49
48
  f"./{loc.meas_list[0]}_{loc.log_type}/"
@@ -67,11 +66,11 @@ def in_alternative_location(loc: Munch, legacy: bool) -> bool:
67
66
  """
68
67
  present = "log" in loc.log_type and (
69
68
  "gas" in loc.measurement or "phase" in loc.measurement
70
- )
69
+ )
71
70
  if legacy:
72
71
  present = "meter" in loc.log_type and (
73
72
  "point" in loc.log_type or "gas" in loc.measurement
74
- )
73
+ )
75
74
 
76
75
  return present
77
76
 
@@ -222,8 +221,7 @@ def skip_obsolete_measurements(xml: etree, measurement: str) -> bool:
222
221
  locator = f".//logs/point_log[type='{measurement}']/updated_date"
223
222
  if (
224
223
  measurement in OBSOLETE_MEASUREMENTS
225
- and (updated_date_key := xml.find(locator))
226
- is not None
224
+ and (updated_date_key := xml.find(locator)) is not None
227
225
  ):
228
226
  updated_date = updated_date_key.text.split("T")[0]
229
227
  date_1 = dt.datetime.strptime(updated_date, "%Y-%m-%d")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plugwise
3
- Version: 1.6.2
3
+ Version: 1.6.4
4
4
  Summary: Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3.
5
5
  Home-page: https://github.com/plugwise/python-plugwise
6
6
  Author: Plugwise device owners
@@ -0,0 +1,17 @@
1
+ plugwise/__init__.py,sha256=-c0b3nN7qFxCzr1VPmRHIJVuueRzOhGlQYFJfwzxmlM,17756
2
+ plugwise/common.py,sha256=0A4o5ae3HfUKC3NO6NYiXbEWJgGZgGtc0VvDoVRiqtY,13075
3
+ plugwise/constants.py,sha256=kDMrVqHnwfVmW3P-Qe16WJxzFvHadAUW2teCWTHAEEU,17245
4
+ plugwise/data.py,sha256=mrNnY5gvsBB3MVuQUEqq24i9XUTPthHM6f9FW4dFxlY,12907
5
+ plugwise/exceptions.py,sha256=Ce-tO9uNsMB-8FP6VAxBvsHNJ-NIM9F0onUZOdZI4Ys,1110
6
+ plugwise/helper.py,sha256=YUOBHUdQbIkUa4mK5IMf6YY5QYu0AhF2corW6fCv-Hs,47111
7
+ plugwise/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ plugwise/smile.py,sha256=ksyjj2VNEKFxIfK7Tr_NEb-fnyXIwMfz7wFdEosBXgI,19335
9
+ plugwise/util.py,sha256=YR_dLM1E1KZ6m0eVeQ7ZevrbfPvGzF6EOeC6rjTFktA,8015
10
+ plugwise/legacy/data.py,sha256=YzVhMYTGQJTUzTVMt8TugL2f3Q6YMCjW7-dF7rjb5n4,3612
11
+ plugwise/legacy/helper.py,sha256=KHbjcnptzeFMqUcQwg4_R24l6XgDKje6VRzUsWJIdSc,18168
12
+ plugwise/legacy/smile.py,sha256=5rDlDXltYkHMI3SiRbugSY5fwCfyw1ElBCc7YSyQt6A,11996
13
+ plugwise-1.6.4.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
14
+ plugwise-1.6.4.dist-info/METADATA,sha256=DBAkkLJvhgzpDQwwUmu-lfv91x0g9nLqKjCJMxYMCM0,9148
15
+ plugwise-1.6.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
16
+ plugwise-1.6.4.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
17
+ plugwise-1.6.4.dist-info/RECORD,,
@@ -1,17 +0,0 @@
1
- plugwise/__init__.py,sha256=GzkiJTPI0vFUIjGcIlvL_KS1lIHad_cOIKzCXwY3Eaw,17183
2
- plugwise/common.py,sha256=vyiAbn5SJgcL5A9DYIj2ixHBbPO_6EFa16bK1VJ3In4,13040
3
- plugwise/constants.py,sha256=yTR9uxFyWi0S5-KDtUGbtMI3eb2dGC3ekMxvL8X0qEY,17203
4
- plugwise/data.py,sha256=08QqLDUlK5vR49AqNT_rnqO2FoDwg5vdL5ClWtamUvQ,11856
5
- plugwise/exceptions.py,sha256=Ce-tO9uNsMB-8FP6VAxBvsHNJ-NIM9F0onUZOdZI4Ys,1110
6
- plugwise/helper.py,sha256=e-qd5C0U_N_g3Yyu6Kmc6Kvp0gDv9E-CoPShRmMQNAo,45414
7
- plugwise/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- plugwise/smile.py,sha256=rY2KsANuHXgs5X_NzLP5kJQXscFnrCjGxrzyRiNqD74,18933
9
- plugwise/util.py,sha256=kt7JNcrTQaLT3eW_fzO4YmGsZzRull2Ge_OmHKl-rHk,8054
10
- plugwise/legacy/data.py,sha256=wHNcRQ_qF4A1rUdxn-1MoW1Z1gUwLqOvYvIkN6tJ_sk,3088
11
- plugwise/legacy/helper.py,sha256=ARIJytJNFiIR5G7Bp75DIULqgt56m0pxUXy6Ze8Te-4,18173
12
- plugwise/legacy/smile.py,sha256=RCQ0kHQwmPjq_G3r6aCe75RIvJt339jilzqEKydNopo,11286
13
- plugwise-1.6.2.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
14
- plugwise-1.6.2.dist-info/METADATA,sha256=uc4gSP0Z6oou5-kf8UsYQGe2mDqsWPTGvaJYqtXGUHE,9148
15
- plugwise-1.6.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
16
- plugwise-1.6.2.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
17
- plugwise-1.6.2.dist-info/RECORD,,