plugwise 0.37.7__py3-none-any.whl → 0.37.9__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/__init__.py CHANGED
@@ -306,14 +306,24 @@ class Smile(SmileComm):
306
306
  ### API Set and HA Service-related Functions ###
307
307
  ########################################################################################################
308
308
 
309
+ async def set_select(
310
+ self,
311
+ key: str,
312
+ loc_id: str,
313
+ option: str,
314
+ state: str | None = None,
315
+ ) -> None:
316
+ """Set the selected option for the applicable Select."""
317
+ await self._smile_api.set_select(key, loc_id, option, state)
318
+
309
319
  async def set_schedule_state(
310
320
  self,
311
321
  loc_id: str,
312
- new_state: str,
322
+ state: str | None,
313
323
  name: str | None = None,
314
324
  ) -> None:
315
325
  """Activate/deactivate the Schedule, with the given name, on the relevant Thermostat."""
316
- await self._smile_api.set_schedule_state(loc_id, new_state, name)
326
+ await self._smile_api.set_schedule_state(loc_id, state, name)
317
327
 
318
328
  async def set_preset(self, loc_id: str, preset: str) -> None:
319
329
  """Set the given Preset on the relevant Thermostat."""
@@ -344,15 +354,15 @@ class Smile(SmileComm):
344
354
 
345
355
  async def set_gateway_mode(self, mode: str) -> None:
346
356
  """Set the gateway mode."""
347
- await self._smile_api.set_gateway_mode(mode)
357
+ await self._smile_api.set_gateway_mode(mode) # pragma: no cover
348
358
 
349
359
  async def set_regulation_mode(self, mode: str) -> None:
350
360
  """Set the heating regulation mode."""
351
- await self._smile_api.set_regulation_mode(mode)
361
+ await self._smile_api.set_regulation_mode(mode) # pragma: no cover
352
362
 
353
363
  async def set_dhw_mode(self, mode: str) -> None:
354
364
  """Set the domestic hot water heating regulation mode."""
355
- await self._smile_api.set_dhw_mode(mode)
365
+ await self._smile_api.set_dhw_mode(mode) # pragma: no cover
356
366
 
357
367
  async def delete_notification(self) -> None:
358
368
  """Delete the active Plugwise Notification."""
plugwise/legacy/smile.py CHANGED
@@ -182,7 +182,12 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
182
182
  async def set_regulation_mode(self, mode: str) -> None:
183
183
  """Set-function placeholder for legacy devices."""
184
184
 
185
- async def set_schedule_state(self, _: str, state: str, name: str | None) -> None:
185
+ async def set_select(self, key: str, loc_id: str, option: str, state: str | None) -> None:
186
+ """Set the thermostat schedule option."""
187
+ # schedule name corresponds to select option
188
+ await self.set_schedule_state("dummy", state, option)
189
+
190
+ async def set_schedule_state(self, _: str, state: str | None, name: str | None) -> None:
186
191
  """Activate/deactivate the Schedule.
187
192
 
188
193
  Determined from - DOMAIN_OBJECTS.
plugwise/smile.py CHANGED
@@ -149,39 +149,6 @@ class SmileAPI(SmileComm, SmileData):
149
149
  """Delete the active Plugwise Notification."""
150
150
  await self._request(NOTIFICATIONS, method="delete")
151
151
 
152
- async def set_dhw_mode(self, mode: str) -> None:
153
- """Set the domestic hot water heating regulation mode."""
154
- if mode not in self._dhw_allowed_modes:
155
- raise PlugwiseError("Plugwise: invalid dhw mode.")
156
-
157
- uri = f"{APPLIANCES};type=heater_central/domestic_hot_water_mode_control"
158
- data = f"<domestic_hot_water_mode_control_functionality><mode>{mode}</mode></domestic_hot_water_mode_control_functionality>"
159
-
160
- await self._request(uri, method="put", data=data)
161
-
162
- async def set_gateway_mode(self, mode: str) -> None:
163
- """Set the gateway mode."""
164
- if mode not in self._gw_allowed_modes:
165
- raise PlugwiseError("Plugwise: invalid gateway mode.")
166
-
167
- end_time = "2037-04-21T08:00:53.000Z"
168
- valid = ""
169
- if mode == "away":
170
- time_1 = self._domain_objects.find("./gateway/time").text
171
- away_time = dt.datetime.fromisoformat(time_1).astimezone(dt.UTC).isoformat(timespec="milliseconds").replace("+00:00", "Z")
172
- valid = (
173
- f"<valid_from>{away_time}</valid_from><valid_to>{end_time}</valid_to>"
174
- )
175
- if mode == "vacation":
176
- time_2 = str(dt.date.today() - dt.timedelta(1))
177
- vacation_time = time_2 + "T23:00:00.000Z"
178
- valid = f"<valid_from>{vacation_time}</valid_from><valid_to>{end_time}</valid_to>"
179
-
180
- uri = f"{APPLIANCES};id={self.gateway_id}/gateway_mode_control"
181
- data = f"<gateway_mode_control_functionality><mode>{mode}</mode>{valid}</gateway_mode_control_functionality>"
182
-
183
- await self._request(uri, method="put", data=data)
184
-
185
152
  async def set_number(
186
153
  self,
187
154
  dev_id: str,
@@ -241,6 +208,52 @@ class SmileAPI(SmileComm, SmileData):
241
208
 
242
209
  await self._request(uri, method="put", data=data)
243
210
 
211
+ async def set_select(self, key: str, loc_id: str, option: str, state: str | None) -> None:
212
+ """Set a dhw/gateway/regulation mode or the thermostat schedule option."""
213
+ match key:
214
+ case "select_dhw_mode":
215
+ await self.set_dhw_mode(option)
216
+ case "select_gateway_mode":
217
+ await self.set_gateway_mode(option)
218
+ case "select_regulation_mode":
219
+ await self.set_regulation_mode(option)
220
+ case "select_schedule":
221
+ # schedule name corresponds to select option
222
+ await self.set_schedule_state(loc_id, state, option)
223
+
224
+ async def set_dhw_mode(self, mode: str) -> None:
225
+ """Set the domestic hot water heating regulation mode."""
226
+ if mode not in self._dhw_allowed_modes:
227
+ raise PlugwiseError("Plugwise: invalid dhw mode.")
228
+
229
+ uri = f"{APPLIANCES};type=heater_central/domestic_hot_water_mode_control"
230
+ data = f"<domestic_hot_water_mode_control_functionality><mode>{mode}</mode></domestic_hot_water_mode_control_functionality>"
231
+
232
+ await self._request(uri, method="put", data=data)
233
+
234
+ async def set_gateway_mode(self, mode: str) -> None:
235
+ """Set the gateway mode."""
236
+ if mode not in self._gw_allowed_modes:
237
+ raise PlugwiseError("Plugwise: invalid gateway mode.")
238
+
239
+ end_time = "2037-04-21T08:00:53.000Z"
240
+ valid = ""
241
+ if mode == "away":
242
+ time_1 = self._domain_objects.find("./gateway/time").text
243
+ away_time = dt.datetime.fromisoformat(time_1).astimezone(dt.UTC).isoformat(timespec="milliseconds").replace("+00:00", "Z")
244
+ valid = (
245
+ f"<valid_from>{away_time}</valid_from><valid_to>{end_time}</valid_to>"
246
+ )
247
+ if mode == "vacation":
248
+ time_2 = str(dt.date.today() - dt.timedelta(1))
249
+ vacation_time = time_2 + "T23:00:00.000Z"
250
+ valid = f"<valid_from>{vacation_time}</valid_from><valid_to>{end_time}</valid_to>"
251
+
252
+ uri = f"{APPLIANCES};id={self.gateway_id}/gateway_mode_control"
253
+ data = f"<gateway_mode_control_functionality><mode>{mode}</mode>{valid}</gateway_mode_control_functionality>"
254
+
255
+ await self._request(uri, method="put", data=data)
256
+
244
257
  async def set_regulation_mode(self, mode: str) -> None:
245
258
  """Set the heating regulation mode."""
246
259
  if mode not in self._reg_allowed_modes:
@@ -257,8 +270,8 @@ class SmileAPI(SmileComm, SmileData):
257
270
  async def set_schedule_state(
258
271
  self,
259
272
  loc_id: str,
260
- new_state: str,
261
- name: str | None = None,
273
+ new_state: str | None,
274
+ name: str | None,
262
275
  ) -> None:
263
276
  """Activate/deactivate the Schedule, with the given name, on the relevant Thermostat.
264
277
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plugwise
3
- Version: 0.37.7
3
+ Version: 0.37.9
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
@@ -1,17 +1,17 @@
1
- plugwise/__init__.py,sha256=KMLU90T2k_z1MuZGEPnLPtHoNbw32kboeGK8rCqjibE,14084
1
+ plugwise/__init__.py,sha256=mI2mFZWucme1PJbsZssV7L7957nQot_LVS-ZeIcE-80,14427
2
2
  plugwise/common.py,sha256=P4sUYzgVcFsIR2DmQxeVeOiZvFZWpZXgwHA3XRc1Sx0,12538
3
3
  plugwise/constants.py,sha256=dvafW3u7LBbWUN05D1Tss7s4jxEDJiZDqnh4-q9isUM,16580
4
4
  plugwise/data.py,sha256=9sH2FkwGh5Uvbf42LmZPWutY9Qa-j9qmFZBobwJkLQo,9022
5
5
  plugwise/exceptions.py,sha256=rymGtWnXosdFkzSehc_41HVl2jXJEg_9Hq9APDEUwrk,1223
6
6
  plugwise/helper.py,sha256=nF1xJEw-frvuGMAydFAJrz_tN24Q3PcBnYNIwPeueZg,42817
7
7
  plugwise/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- plugwise/smile.py,sha256=9eJR8iLyYOMrWq8MMw3-uQrN8fS5sZCHdJpp5Kspszo,17177
8
+ plugwise/smile.py,sha256=tzE6yxWd8oOO3pK0g2bTw8WcuVQ9tM7tG3p0z7-LqWU,17815
9
9
  plugwise/util.py,sha256=9ld46KJHWFze2eUrVSgUYn0g3zNerlpboM0iUa0H3ak,7830
10
10
  plugwise/legacy/data.py,sha256=DsHR9xgiFDg_Vh_6ZpOskw8ZhNQ3CmwjstI3yiH6MEk,3048
11
11
  plugwise/legacy/helper.py,sha256=6-tYQMEXepE5rec-hn6lt2EeknADI3J8UFuBSLgu8dk,17878
12
- plugwise/legacy/smile.py,sha256=Jo0ynhhxfOC6NGemgVNN-LBwUWmA736lHTO5WXQ65r4,10492
13
- plugwise-0.37.7.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
14
- plugwise-0.37.7.dist-info/METADATA,sha256=dEKKzLXlGY7SRjbD2PXNGMPG17dN-7g4faHxtM_lmwI,8939
15
- plugwise-0.37.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
16
- plugwise-0.37.7.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
17
- plugwise-0.37.7.dist-info/RECORD,,
12
+ plugwise/legacy/smile.py,sha256=kU6eOh0c4Ao_S0yOJeggDuicRR7r3gScjYCEGJTMowA,10760
13
+ plugwise-0.37.9.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
14
+ plugwise-0.37.9.dist-info/METADATA,sha256=imJmtku4hd0Dnxjf7QKpc9BOUPNCNTfuQhjwVhj6FZc,8939
15
+ plugwise-0.37.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
16
+ plugwise-0.37.9.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
17
+ plugwise-0.37.9.dist-info/RECORD,,