aioWiserHeatAPI 1.7.9__tar.gz → 1.7.10__tar.gz
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.
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/PKG-INFO +1 -1
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/__init__.py +1 -1
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/automations.py +3 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/opentherm.py +13 -3
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/rest_controller.py +1 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/room.py +31 -8
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/system.py +2 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/wiserhub.py +16 -8
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI.egg-info/PKG-INFO +1 -1
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI.egg-info/SOURCES.txt +1 -0
- aiowiserheatapi-1.7.10/tests/test_heating_state.py +255 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/LICENSE +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/README.md +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/automation.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/binary_sensor.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/boiler_interface.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/button_panel.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/cli.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/const.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/devices.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/discovery.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/equipments.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/evse.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/exceptions.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/heating.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/heating_actuator.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/__init__.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/battery.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/capabilities.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/cloud.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/device.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/equipment.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/extra_config.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/firmware.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/gps.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/misc.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/network.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/signal.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/special_times.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/status.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/temp.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/threshold.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/uiconfiguration.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/version.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/helpers/zigbee.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/hot_water.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/light.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/moments.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/ptc.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/pte.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/refactor.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/roomstat.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/schedule.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/shutter.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/smartplug.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/smartvalve.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/smokealarm.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/temp_humidity.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI/ufh.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI.egg-info/dependency_links.txt +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI.egg-info/entry_points.txt +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI.egg-info/requires.txt +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI.egg-info/top_level.txt +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/setup.cfg +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/setup.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_device_notifications.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_equipment.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_equipments.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_evse.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_heating_actuator.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_light.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_ptc.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_rest_controller.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_rest_payloads.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_schedule.py +0 -0
- {aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/tests/test_smartplug.py +0 -0
|
@@ -71,6 +71,9 @@ class _WiserHeatingChannelAutomations:
|
|
|
71
71
|
if room.is_passive_mode
|
|
72
72
|
and room.id in heating_channel.room_ids
|
|
73
73
|
and room.current_temperature is not None
|
|
74
|
+
# At a schedule transition the hub's room target can still be
|
|
75
|
+
# from the previous slot. Writing now would create an override.
|
|
76
|
+
and not room.passive_lower_limit_follows_schedule
|
|
74
77
|
]
|
|
75
78
|
|
|
76
79
|
# If no passive mode rooms
|
|
@@ -174,9 +174,11 @@ class _WiserOpentherm(object):
|
|
|
174
174
|
wiser_rest_controller: _WiserRestController,
|
|
175
175
|
data: dict,
|
|
176
176
|
enabled_status: str,
|
|
177
|
+
ever_connected: bool = False,
|
|
177
178
|
):
|
|
178
179
|
self._data = data
|
|
179
180
|
self._enabled_status = enabled_status
|
|
181
|
+
self._ever_connected = ever_connected or enabled_status == "Connected"
|
|
180
182
|
self._wiser_rest_controller = wiser_rest_controller
|
|
181
183
|
|
|
182
184
|
@property
|
|
@@ -219,10 +221,17 @@ class _WiserOpentherm(object):
|
|
|
219
221
|
return tf._from_wiser_temp(self._data.get("ch2FlowSetpoint", None), "current")
|
|
220
222
|
|
|
221
223
|
@property
|
|
222
|
-
def central_heating_active(self) -> bool:
|
|
224
|
+
def central_heating_active(self) -> bool | None:
|
|
223
225
|
"""Return whether the boiler is operating in central-heating mode."""
|
|
224
226
|
slave_status = self.operational_data.slave_status
|
|
225
|
-
|
|
227
|
+
if isinstance(slave_status, bool) or not isinstance(slave_status, int):
|
|
228
|
+
return None
|
|
229
|
+
return bool(slave_status & (1 << 1))
|
|
230
|
+
|
|
231
|
+
@property
|
|
232
|
+
def is_configured(self) -> bool:
|
|
233
|
+
"""Keep a known OpenTherm installation distinct during outages."""
|
|
234
|
+
return self._ever_connected or self.enabled
|
|
226
235
|
|
|
227
236
|
@property
|
|
228
237
|
def connection_status(self) -> str:
|
|
@@ -251,7 +260,8 @@ class _WiserOpentherm(object):
|
|
|
251
260
|
|
|
252
261
|
@property
|
|
253
262
|
def operational_data(self) -> _WiserOpenThermOperationalData:
|
|
254
|
-
|
|
263
|
+
data = self._data.get("operationalData")
|
|
264
|
+
return _WiserOpenThermOperationalData(data if isinstance(data, dict) else {})
|
|
255
265
|
|
|
256
266
|
@property
|
|
257
267
|
def boiler_parameters(self) -> _WiserOpenThermBoilerParameters:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import inspect
|
|
2
2
|
from datetime import datetime
|
|
3
|
+
from math import isfinite
|
|
3
4
|
from typing import Union
|
|
4
5
|
|
|
5
6
|
from aioWiserHeatAPI.helpers.capabilities import _WiserClimateCapabilities
|
|
@@ -254,6 +255,16 @@ class _WiserRoom(object):
|
|
|
254
255
|
)
|
|
255
256
|
return False
|
|
256
257
|
|
|
258
|
+
@property
|
|
259
|
+
def passive_lower_limit_follows_schedule(self) -> bool:
|
|
260
|
+
"""Return whether the hub schedule already supplies the limiter target."""
|
|
261
|
+
return (
|
|
262
|
+
not self.is_override
|
|
263
|
+
and not self.is_away_mode
|
|
264
|
+
and self._auto_uses_scheduled_passive_lower_temp
|
|
265
|
+
and self.passive_mode_lower_temp == self.schedule.current_setting
|
|
266
|
+
)
|
|
267
|
+
|
|
257
268
|
async def set_passive_mode_lower_temp(self, temp):
|
|
258
269
|
if not await self._update_extra_config("min", temp):
|
|
259
270
|
_LOGGER.error(
|
|
@@ -432,18 +443,30 @@ class _WiserRoom(object):
|
|
|
432
443
|
@property
|
|
433
444
|
def is_calling_for_heat(self) -> bool | None:
|
|
434
445
|
"""Return whether the room is requesting heat."""
|
|
435
|
-
|
|
446
|
+
demand = self._data.get("PercentageDemand")
|
|
447
|
+
if (
|
|
448
|
+
isinstance(demand, bool)
|
|
449
|
+
or not isinstance(demand, (int, float))
|
|
450
|
+
or not 0 <= demand <= 100
|
|
451
|
+
or not isfinite(demand)
|
|
452
|
+
):
|
|
436
453
|
return None
|
|
437
|
-
return
|
|
454
|
+
return demand > 0
|
|
438
455
|
|
|
439
456
|
@property
|
|
440
|
-
def is_heating(self) -> bool:
|
|
457
|
+
def is_heating(self) -> bool | None:
|
|
441
458
|
"""Return whether central heating is currently servicing room demand."""
|
|
442
|
-
if self._opentherm and self._opentherm.
|
|
443
|
-
|
|
444
|
-
self.
|
|
445
|
-
|
|
446
|
-
)
|
|
459
|
+
if self._opentherm and self._opentherm.is_configured:
|
|
460
|
+
if (
|
|
461
|
+
self._opentherm.connection_status != "Connected"
|
|
462
|
+
or not self._opentherm.enabled
|
|
463
|
+
):
|
|
464
|
+
return None
|
|
465
|
+
calling = self.is_calling_for_heat
|
|
466
|
+
active = self._opentherm.central_heating_active
|
|
467
|
+
if calling is None or active is None:
|
|
468
|
+
return None
|
|
469
|
+
return calling and active
|
|
447
470
|
return self._data.get("ControlOutputState", TEXT_OFF) == TEXT_ON
|
|
448
471
|
|
|
449
472
|
@property
|
|
@@ -29,6 +29,7 @@ class _WiserSystem(object):
|
|
|
29
29
|
network_data: dict,
|
|
30
30
|
device_data: dict,
|
|
31
31
|
opentherm_data: dict,
|
|
32
|
+
opentherm_ever_connected: bool = False,
|
|
32
33
|
):
|
|
33
34
|
self._wiser_rest_controller = wiser_rest_controller
|
|
34
35
|
self._data = domain_data
|
|
@@ -53,6 +54,7 @@ class _WiserSystem(object):
|
|
|
53
54
|
self._wiser_rest_controller,
|
|
54
55
|
opentherm_data,
|
|
55
56
|
self._system_data.get("OpenThermConnectionStatus", TEXT_UNKNOWN),
|
|
57
|
+
opentherm_ever_connected,
|
|
56
58
|
)
|
|
57
59
|
self._signal = _WiserSignalStrength(self._device_data)
|
|
58
60
|
self._upgrade_data = _WiserFirmareUpgradeInfo(self._data.get("UpgradeInfo", {}))
|
|
@@ -196,11 +196,13 @@ class WiserAPI:
|
|
|
196
196
|
except WiserHubRESTError:
|
|
197
197
|
self._status_data = {}
|
|
198
198
|
|
|
199
|
-
#
|
|
199
|
+
# Do not let an optional boiler endpoint invalidate fresh hub data.
|
|
200
200
|
opentherm = self._domain_data.get("System", {}).get(
|
|
201
201
|
"OpenThermConnectionStatus", ""
|
|
202
202
|
)
|
|
203
|
-
|
|
203
|
+
self._opentherm_data = {}
|
|
204
|
+
if opentherm == "Connected":
|
|
205
|
+
self.api_parameters.opentherm_ever_connected = True
|
|
204
206
|
fw_version = Version(
|
|
205
207
|
self._domain_data.get("System", {}).get(
|
|
206
208
|
"ActiveSystemVersion", "1.0.0"
|
|
@@ -209,12 +211,17 @@ class WiserAPI:
|
|
|
209
211
|
hw_version = self._domain_data.get("System", {}).get(
|
|
210
212
|
"HardwareGeneration", 1
|
|
211
213
|
)
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
try:
|
|
215
|
+
data = await self._wiser_rest_controller.get_hub_data(
|
|
216
|
+
WISERHUBOPENTHERMV2
|
|
217
|
+
if hw_version == 2 and fw_version >= OPENTHERMV2_MIN_VERSION
|
|
218
|
+
else WISERHUBOPENTHERM,
|
|
219
|
+
False,
|
|
220
|
+
)
|
|
221
|
+
if isinstance(data, dict):
|
|
222
|
+
self._opentherm_data = data
|
|
223
|
+
except (WiserHubConnectionError, WiserHubRESTError) as ex:
|
|
224
|
+
_LOGGER.warning("Unable to read OpenTherm data: %s", ex)
|
|
218
225
|
except (
|
|
219
226
|
WiserHubConnectionError,
|
|
220
227
|
WiserHubAuthenticationError,
|
|
@@ -258,6 +265,7 @@ class WiserAPI:
|
|
|
258
265
|
self._network_data,
|
|
259
266
|
_device_data,
|
|
260
267
|
self._opentherm_data,
|
|
268
|
+
self.api_parameters.opentherm_ever_connected,
|
|
261
269
|
)
|
|
262
270
|
|
|
263
271
|
# Schedules Collection
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"""Heating state and refresh regressions using the real API objects."""
|
|
2
|
+
|
|
3
|
+
import unittest
|
|
4
|
+
from types import SimpleNamespace
|
|
5
|
+
from unittest.mock import AsyncMock
|
|
6
|
+
|
|
7
|
+
from aioWiserHeatAPI.const import (
|
|
8
|
+
WISERHUBDOMAIN,
|
|
9
|
+
WISERHUBNETWORK,
|
|
10
|
+
WISERHUBOPENTHERM,
|
|
11
|
+
WISERHUBOPENTHERMV2,
|
|
12
|
+
WISERHUBSCHEDULES,
|
|
13
|
+
WISERHUBSTATUS,
|
|
14
|
+
)
|
|
15
|
+
from aioWiserHeatAPI.exceptions import (
|
|
16
|
+
WiserHubAuthenticationError,
|
|
17
|
+
WiserHubConnectionError,
|
|
18
|
+
WiserHubRESTError,
|
|
19
|
+
)
|
|
20
|
+
from aioWiserHeatAPI.helpers.automations import _WiserHeatingChannelAutomations
|
|
21
|
+
from aioWiserHeatAPI.helpers.opentherm import _WiserOpentherm
|
|
22
|
+
from aioWiserHeatAPI.rest_controller import WiserAPIParams
|
|
23
|
+
from aioWiserHeatAPI.room import _WiserRoom
|
|
24
|
+
from aioWiserHeatAPI.wiserhub import WiserAPI
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def boiler(status="Connected", data=None, ever_connected=False):
|
|
28
|
+
return _WiserOpentherm(None, data or {}, status, ever_connected)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def room(opentherm=None, **data):
|
|
32
|
+
# Only the state properties are under test; no schedule or devices needed.
|
|
33
|
+
result = object.__new__(_WiserRoom)
|
|
34
|
+
result._data = data
|
|
35
|
+
result._opentherm = opentherm
|
|
36
|
+
return result
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class PassiveScheduleTest(unittest.IsolatedAsyncioTestCase):
|
|
40
|
+
async def test_limiter_leaves_matching_schedule_target_to_hub(self):
|
|
41
|
+
for active_demand in (0, 20):
|
|
42
|
+
for lower in (17, 16):
|
|
43
|
+
with self.subTest(active_demand=active_demand, lower=lower):
|
|
44
|
+
limiter = room(
|
|
45
|
+
id=1,
|
|
46
|
+
DisplayedSetPoint=180,
|
|
47
|
+
CalculatedTemperature=179,
|
|
48
|
+
SetpointOrigin="FromSchedule",
|
|
49
|
+
)
|
|
50
|
+
limiter._enable_automations = True
|
|
51
|
+
limiter._name = "Lounge"
|
|
52
|
+
limiter._extra_config = {"passive_mode": True, "max": 22}
|
|
53
|
+
limiter._mode = "Auto"
|
|
54
|
+
limiter._schedule = SimpleNamespace(current_setting=17)
|
|
55
|
+
limiter.set_target_temperature = AsyncMock(return_value=True)
|
|
56
|
+
controller = SimpleNamespace(
|
|
57
|
+
_api_parameters=WiserAPIParams(
|
|
58
|
+
passive_mode_lower_temp_provider=lambda _: lower,
|
|
59
|
+
passive_mode_temperature_limiter_provider=lambda _: True,
|
|
60
|
+
)
|
|
61
|
+
)
|
|
62
|
+
limiter._wiser_rest_controller = controller
|
|
63
|
+
active_room = SimpleNamespace(
|
|
64
|
+
id=2,
|
|
65
|
+
name="Office",
|
|
66
|
+
is_passive_mode=False,
|
|
67
|
+
percentage_demand=active_demand,
|
|
68
|
+
)
|
|
69
|
+
channels = SimpleNamespace(
|
|
70
|
+
all=[SimpleNamespace(id=1, room_ids=[1, 2])],
|
|
71
|
+
_rooms=SimpleNamespace(all=[limiter, active_room]),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
updated = await _WiserHeatingChannelAutomations(
|
|
75
|
+
controller, channels
|
|
76
|
+
).run_automations()
|
|
77
|
+
|
|
78
|
+
if lower == 17:
|
|
79
|
+
self.assertFalse(updated)
|
|
80
|
+
limiter.set_target_temperature.assert_not_awaited()
|
|
81
|
+
else:
|
|
82
|
+
self.assertTrue(updated)
|
|
83
|
+
limiter.set_target_temperature.assert_awaited_once_with(16)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class HeatingStateTest(unittest.TestCase):
|
|
87
|
+
def test_relay_rooms_keep_using_control_output(self):
|
|
88
|
+
for status in ("On", "Off"):
|
|
89
|
+
for demand in (0, 50):
|
|
90
|
+
with self.subTest(status=status, demand=demand):
|
|
91
|
+
result = room(
|
|
92
|
+
boiler("Disconnected"),
|
|
93
|
+
ControlOutputState=status,
|
|
94
|
+
PercentageDemand=demand,
|
|
95
|
+
)
|
|
96
|
+
self.assertIs(result.is_heating, status == "On")
|
|
97
|
+
|
|
98
|
+
def test_opentherm_requires_room_demand_and_ch_activity(self):
|
|
99
|
+
for demand in (0, 50):
|
|
100
|
+
for slave in (0, 2, 4, 8, 12):
|
|
101
|
+
with self.subTest(demand=demand, slave=slave):
|
|
102
|
+
result = room(
|
|
103
|
+
boiler(data={
|
|
104
|
+
"Enabled": True,
|
|
105
|
+
"operationalData": {"SlaveStatus": slave},
|
|
106
|
+
}),
|
|
107
|
+
PercentageDemand=demand,
|
|
108
|
+
ControlOutputState="On",
|
|
109
|
+
)
|
|
110
|
+
self.assertIs(
|
|
111
|
+
result.is_heating, demand > 0 and bool(slave & 2)
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
def test_missing_or_invalid_slave_status_is_unknown(self):
|
|
115
|
+
for value in (None, True, False, "2", 2.0):
|
|
116
|
+
with self.subTest(value=value):
|
|
117
|
+
ot = boiler(data={
|
|
118
|
+
"Enabled": True,
|
|
119
|
+
"operationalData": {"SlaveStatus": value},
|
|
120
|
+
})
|
|
121
|
+
self.assertIsNone(ot.central_heating_active)
|
|
122
|
+
self.assertIsNone(room(ot, PercentageDemand=50).is_heating)
|
|
123
|
+
|
|
124
|
+
def test_missing_or_invalid_operational_data_is_unknown(self):
|
|
125
|
+
for data in ({}, {"operationalData": None}, {"operationalData": []}):
|
|
126
|
+
with self.subTest(data=data):
|
|
127
|
+
self.assertIsNone(boiler(data=data).central_heating_active)
|
|
128
|
+
|
|
129
|
+
def test_missing_or_invalid_room_demand_is_unknown(self):
|
|
130
|
+
ot = boiler(data={
|
|
131
|
+
"Enabled": True, "operationalData": {"SlaveStatus": 2},
|
|
132
|
+
})
|
|
133
|
+
invalid = (None, True, "50", -1, 101, float("nan"), float("inf"))
|
|
134
|
+
for data in ({}, *({"PercentageDemand": v} for v in invalid)):
|
|
135
|
+
with self.subTest(data=data):
|
|
136
|
+
result = room(ot, **data)
|
|
137
|
+
self.assertIsNone(result.is_calling_for_heat)
|
|
138
|
+
self.assertIsNone(result.is_heating)
|
|
139
|
+
|
|
140
|
+
def test_disconnected_or_disabled_opentherm_does_not_use_room_output(self):
|
|
141
|
+
for ot in (
|
|
142
|
+
boiler("Disconnected", {"Enabled": True}),
|
|
143
|
+
boiler("Disconnected", ever_connected=True),
|
|
144
|
+
boiler("Unknown", ever_connected=True),
|
|
145
|
+
boiler(data={"Enabled": False, "operationalData": {"SlaveStatus": 2}}),
|
|
146
|
+
):
|
|
147
|
+
for output in ("On", "Off"):
|
|
148
|
+
with self.subTest(status=ot.connection_status, output=output):
|
|
149
|
+
result = room(
|
|
150
|
+
ot, PercentageDemand=50, ControlOutputState=output
|
|
151
|
+
)
|
|
152
|
+
self.assertIsNone(result.is_heating)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class HeatingRefreshTest(unittest.IsolatedAsyncioTestCase):
|
|
156
|
+
def setUp(self):
|
|
157
|
+
self.hub = WiserAPI("wiser.example", "secret")
|
|
158
|
+
self.domain = {
|
|
159
|
+
"System": {
|
|
160
|
+
"UnixTime": 0,
|
|
161
|
+
"HardwareGeneration": 1,
|
|
162
|
+
"OpenThermConnectionStatus": "Disconnected",
|
|
163
|
+
},
|
|
164
|
+
"Device": [],
|
|
165
|
+
"Room": [{
|
|
166
|
+
"id": 1, "Name": "Room", "Mode": "Auto",
|
|
167
|
+
"PercentageDemand": 50, "ControlOutputState": "On",
|
|
168
|
+
}],
|
|
169
|
+
"HeatingChannel": [{"id": 1, "RoomIds": [1]}],
|
|
170
|
+
"HotWater": [{"id": 2}],
|
|
171
|
+
}
|
|
172
|
+
self.ot_data = {"Enabled": True, "operationalData": {"SlaveStatus": 2}}
|
|
173
|
+
self.ot_error = None
|
|
174
|
+
self.controller = self.hub._wiser_rest_controller
|
|
175
|
+
self.controller.get_hub_data = AsyncMock(side_effect=self.read)
|
|
176
|
+
self.controller.get_extra_config_data = AsyncMock()
|
|
177
|
+
|
|
178
|
+
async def read(self, endpoint, *_args):
|
|
179
|
+
if endpoint in (WISERHUBOPENTHERM, WISERHUBOPENTHERMV2):
|
|
180
|
+
if self.ot_error:
|
|
181
|
+
raise self.ot_error
|
|
182
|
+
return self.ot_data
|
|
183
|
+
return {
|
|
184
|
+
WISERHUBDOMAIN: self.domain,
|
|
185
|
+
WISERHUBNETWORK: {"Station": {}},
|
|
186
|
+
WISERHUBSCHEDULES: [],
|
|
187
|
+
WISERHUBSTATUS: {},
|
|
188
|
+
}[endpoint]
|
|
189
|
+
|
|
190
|
+
async def test_relay_hub_does_not_poll_opentherm(self):
|
|
191
|
+
await self.hub.read_hub_data()
|
|
192
|
+
calls = [
|
|
193
|
+
call.args[0] for call in self.controller.get_hub_data.await_args_list
|
|
194
|
+
]
|
|
195
|
+
self.assertNotIn(WISERHUBOPENTHERM, calls)
|
|
196
|
+
self.assertNotIn(WISERHUBOPENTHERMV2, calls)
|
|
197
|
+
self.assertTrue(self.hub.rooms.get_by_id(1).is_heating)
|
|
198
|
+
|
|
199
|
+
async def test_connection_loss_and_recovery(self):
|
|
200
|
+
self.domain["System"]["OpenThermConnectionStatus"] = "Connected"
|
|
201
|
+
await self.hub.read_hub_data()
|
|
202
|
+
self.assertTrue(self.hub.rooms.get_by_id(1).is_heating)
|
|
203
|
+
self.domain["System"]["OpenThermConnectionStatus"] = "Disconnected"
|
|
204
|
+
await self.hub.read_hub_data()
|
|
205
|
+
self.assertIsNone(self.hub.rooms.get_by_id(1).is_heating)
|
|
206
|
+
self.assertEqual(self.hub.system.opentherm.json_data, {})
|
|
207
|
+
self.domain["System"]["OpenThermConnectionStatus"] = "Connected"
|
|
208
|
+
await self.hub.read_hub_data()
|
|
209
|
+
self.assertTrue(self.hub.rooms.get_by_id(1).is_heating)
|
|
210
|
+
|
|
211
|
+
async def test_known_opentherm_disconnected_on_startup(self):
|
|
212
|
+
self.hub.api_parameters.opentherm_ever_connected = True
|
|
213
|
+
await self.hub.read_hub_data()
|
|
214
|
+
self.assertIsNone(self.hub.rooms.get_by_id(1).is_heating)
|
|
215
|
+
|
|
216
|
+
async def test_optional_endpoint_failure_clears_previous_data(self):
|
|
217
|
+
self.domain["System"]["OpenThermConnectionStatus"] = "Connected"
|
|
218
|
+
await self.hub.read_hub_data()
|
|
219
|
+
for error in (
|
|
220
|
+
WiserHubConnectionError("timeout"), WiserHubRESTError("bad JSON")
|
|
221
|
+
):
|
|
222
|
+
with self.subTest(error=type(error).__name__):
|
|
223
|
+
self.ot_error = error
|
|
224
|
+
await self.hub.read_hub_data()
|
|
225
|
+
self.assertEqual(self.hub.system.opentherm.json_data, {})
|
|
226
|
+
self.assertIsNone(self.hub.rooms.get_by_id(1).is_heating)
|
|
227
|
+
self.assertIsNotNone(self.hub.heating_channels)
|
|
228
|
+
|
|
229
|
+
async def test_malformed_endpoint_response_is_unknown(self):
|
|
230
|
+
self.domain["System"]["OpenThermConnectionStatus"] = "Connected"
|
|
231
|
+
self.ot_data = None
|
|
232
|
+
await self.hub.read_hub_data()
|
|
233
|
+
self.assertIsNone(self.hub.rooms.get_by_id(1).is_heating)
|
|
234
|
+
|
|
235
|
+
async def test_authentication_failure_is_not_suppressed(self):
|
|
236
|
+
self.domain["System"]["OpenThermConnectionStatus"] = "Connected"
|
|
237
|
+
self.ot_error = WiserHubAuthenticationError("unauthorized")
|
|
238
|
+
with self.assertRaises(WiserHubAuthenticationError):
|
|
239
|
+
await self.hub.read_hub_data()
|
|
240
|
+
|
|
241
|
+
async def test_firmware_selects_correct_opentherm_endpoint(self):
|
|
242
|
+
for generation, version, expected in (
|
|
243
|
+
(1, "4.99.0", WISERHUBOPENTHERM),
|
|
244
|
+
(2, "4.32.46", WISERHUBOPENTHERM),
|
|
245
|
+
(2, "4.32.47", WISERHUBOPENTHERMV2),
|
|
246
|
+
):
|
|
247
|
+
with self.subTest(generation=generation, version=version):
|
|
248
|
+
self.domain["System"].update(
|
|
249
|
+
HardwareGeneration=generation,
|
|
250
|
+
ActiveSystemVersion=version,
|
|
251
|
+
OpenThermConnectionStatus="Connected",
|
|
252
|
+
)
|
|
253
|
+
self.controller.get_hub_data.reset_mock()
|
|
254
|
+
await self.hub.read_hub_data()
|
|
255
|
+
self.controller.get_hub_data.assert_any_await(expected, False)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aiowiserheatapi-1.7.9 → aiowiserheatapi-1.7.10}/aioWiserHeatAPI.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|