aioWiserHeatAPI 1.7.10__tar.gz → 1.7.11__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.10 → aiowiserheatapi-1.7.11}/PKG-INFO +1 -1
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/__init__.py +1 -1
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/const.py +15 -1
- aiowiserheatapi-1.7.11/aioWiserHeatAPI/helpers/tariffs.py +120 -0
- aiowiserheatapi-1.7.11/aioWiserHeatAPI/helpers/weather.py +27 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/rest_controller.py +1 -1
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/schedule.py +58 -1
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/shutter.py +52 -3
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/system.py +50 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/wiserhub.py +30 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI.egg-info/PKG-INFO +1 -1
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI.egg-info/SOURCES.txt +6 -1
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_heating_state.py +16 -2
- aiowiserheatapi-1.7.11/tests/test_smart_schedule.py +57 -0
- aiowiserheatapi-1.7.11/tests/test_tariffs.py +147 -0
- aiowiserheatapi-1.7.11/tests/test_weather.py +36 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/LICENSE +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/README.md +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/automation.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/binary_sensor.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/boiler_interface.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/button_panel.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/cli.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/devices.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/discovery.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/equipments.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/evse.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/exceptions.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/heating.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/heating_actuator.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/__init__.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/automations.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/battery.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/capabilities.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/cloud.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/device.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/equipment.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/extra_config.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/firmware.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/gps.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/misc.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/network.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/opentherm.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/signal.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/special_times.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/status.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/temp.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/threshold.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/uiconfiguration.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/version.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/zigbee.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/hot_water.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/light.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/moments.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/ptc.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/pte.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/refactor.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/room.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/roomstat.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/smartplug.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/smartvalve.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/smokealarm.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/temp_humidity.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/ufh.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI.egg-info/dependency_links.txt +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI.egg-info/entry_points.txt +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI.egg-info/requires.txt +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI.egg-info/top_level.txt +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/setup.cfg +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/setup.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_device_notifications.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_equipment.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_equipments.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_evse.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_heating_actuator.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_light.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_ptc.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_rest_controller.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_rest_payloads.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_schedule.py +0 -0
- {aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/tests/test_smartplug.py +0 -0
|
@@ -78,6 +78,11 @@ TEXT_RL_LED = "RL_LED"
|
|
|
78
78
|
TEXT_RELAY = "Relay"
|
|
79
79
|
TEXT_FIL_PILOTE = "FilPilote"
|
|
80
80
|
|
|
81
|
+
# Text for Tariffs
|
|
82
|
+
TEXT_ENERGYTARIFFS = "EnergyTariffs"
|
|
83
|
+
TEXT_FORECAST = "Forecast"
|
|
84
|
+
TEXT_CURRENTDAY = "CurrentDay"
|
|
85
|
+
|
|
81
86
|
# Day Value Lists
|
|
82
87
|
WEEKDAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
|
|
83
88
|
WEEKENDS = ["Saturday", "Sunday"]
|
|
@@ -117,7 +122,8 @@ WISEREQUIPMENT = "Equipment/{}"
|
|
|
117
122
|
WISERTHRESHOLDSENSOR = "ThresholdSensor/{}"
|
|
118
123
|
WISERUICONFIGURATION = "UIConfiguration/{}"
|
|
119
124
|
WISERAUTOMATION = "Automation/{}"
|
|
120
|
-
|
|
125
|
+
WISERTARIFFS = "Tariffs/{}" #add Energytariffs monitoring
|
|
126
|
+
WISERWEATHER = "Weather"
|
|
121
127
|
|
|
122
128
|
# Enums
|
|
123
129
|
class WiserUnitsEnum(enum.Enum):
|
|
@@ -235,3 +241,11 @@ DEFAULT_LEVEL_SCHEDULE = {
|
|
|
235
241
|
"Saturday": {"Time": [], "Level": []},
|
|
236
242
|
"Sunday": {"Time": [], "Level": []},
|
|
237
243
|
}
|
|
244
|
+
|
|
245
|
+
class WiserTariffTypeEnum(enum.Enum):
|
|
246
|
+
energytariffs = TEXT_ENERGYTARIFFS
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class WiserEnergyTariffTypeEnum(enum.Enum):
|
|
250
|
+
forecast = TEXT_FORECAST
|
|
251
|
+
currentday = TEXT_CURRENTDAY
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""Data models for the tariff information returned by a Wiser hub."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class _TariffInterval:
|
|
7
|
+
"""A single tariff interval."""
|
|
8
|
+
|
|
9
|
+
def __init__(self, data: Dict[str, Any]):
|
|
10
|
+
self._data = data or {}
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def id(self) -> Optional[int]:
|
|
14
|
+
return self._data.get("id")
|
|
15
|
+
|
|
16
|
+
@property
|
|
17
|
+
def begin(self) -> Optional[str]:
|
|
18
|
+
"""Start of the interval, as returned by the hub."""
|
|
19
|
+
return self._data.get("from")
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def end(self) -> Optional[str]:
|
|
23
|
+
"""End of the interval, as returned by the hub."""
|
|
24
|
+
return self._data.get("to")
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def price(self) -> Optional[float]:
|
|
28
|
+
return self._data.get("price")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class _TariffIntervals:
|
|
32
|
+
"""A list of tariff intervals, such as Forecast or CurrentDay."""
|
|
33
|
+
|
|
34
|
+
def __init__(self, data: Optional[List[Dict[str, Any]]] = None):
|
|
35
|
+
self._intervals = [
|
|
36
|
+
_TariffInterval(interval) for interval in (data or [])
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def all(self) -> List[_TariffInterval]:
|
|
41
|
+
return list(self._intervals)
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def count(self) -> int:
|
|
45
|
+
return len(self._intervals)
|
|
46
|
+
|
|
47
|
+
def __iter__(self):
|
|
48
|
+
return iter(self._intervals)
|
|
49
|
+
|
|
50
|
+
def __len__(self) -> int:
|
|
51
|
+
return len(self._intervals)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class _EnergyTariff:
|
|
55
|
+
"""Tariff data containing forecast, current day, and price summaries."""
|
|
56
|
+
|
|
57
|
+
def __init__(self, data: Optional[Dict[str, Any]] = None):
|
|
58
|
+
self._data = data or {}
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def forecast(self) -> _TariffIntervals:
|
|
62
|
+
return _TariffIntervals(self._data.get("Forecast"))
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def current_day(self) -> _TariffIntervals:
|
|
66
|
+
return _TariffIntervals(self._data.get("CurrentDay"))
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def daily_average(self) -> Optional[float]:
|
|
70
|
+
return self._data.get("DailyAverage")
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def daily_averagex100(self) -> Optional[float]:
|
|
74
|
+
return self._data.get("DailyAverage100Multiplier")
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def current_price(self) -> Optional[float]:
|
|
78
|
+
return self._data.get("CurrentPrice")
|
|
79
|
+
|
|
80
|
+
@property
|
|
81
|
+
def current_pricex100(self) -> Optional[float]:
|
|
82
|
+
return self._data.get("CurrentPrice100Multiplier")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class _WiserTariffs:
|
|
86
|
+
"""Top-level Tariffs response from the Wiser hub."""
|
|
87
|
+
|
|
88
|
+
def __init__(self, tariff_data: Optional[Dict[str, Any]] = None):
|
|
89
|
+
data = tariff_data or {}
|
|
90
|
+
# Accept either the full response (containing EnergyTariff) or the
|
|
91
|
+
# EnergyTariff object itself.
|
|
92
|
+
self._energy_tariff_data = data.get("EnergyTariff", data)
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def energy_tariff(self) -> _EnergyTariff:
|
|
96
|
+
return _EnergyTariff(self._energy_tariff_data)
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def forecast(self) -> _TariffIntervals:
|
|
100
|
+
return self.energy_tariff.forecast
|
|
101
|
+
|
|
102
|
+
@property
|
|
103
|
+
def current_day(self) -> _TariffIntervals:
|
|
104
|
+
return self.energy_tariff.current_day
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def daily_average(self) -> Optional[float]:
|
|
108
|
+
return self.energy_tariff.daily_average
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def daily_averagex100(self) -> Optional[float]:
|
|
112
|
+
return self.energy_tariff.daily_averagex100
|
|
113
|
+
|
|
114
|
+
@property
|
|
115
|
+
def current_price(self) -> Optional[float]:
|
|
116
|
+
return self.energy_tariff.current_price
|
|
117
|
+
|
|
118
|
+
@property
|
|
119
|
+
def current_pricex100(self) -> Optional[float]:
|
|
120
|
+
return self.energy_tariff.current_pricex100
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Handles weather data
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from ..const import TEMP_ERROR
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class _WiserWeather:
|
|
9
|
+
def __init__(self, weather_data: dict):
|
|
10
|
+
self._weather_data = weather_data
|
|
11
|
+
|
|
12
|
+
def _get_temperature(self, key: str) -> float | None:
|
|
13
|
+
"""Convert weather readings without applying indoor temperature limits."""
|
|
14
|
+
temperature = self._weather_data.get(key)
|
|
15
|
+
if temperature is None or abs(temperature) >= TEMP_ERROR:
|
|
16
|
+
return None
|
|
17
|
+
return round(temperature / 10, 1)
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def temperature(self) -> float | None:
|
|
21
|
+
"""Get the outside temperature."""
|
|
22
|
+
return self._get_temperature("Temperature")
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def next_day_2pm_temperature(self) -> float | None:
|
|
26
|
+
"""Get the outside temperature next day at 2PM"""
|
|
27
|
+
return self._get_temperature("NextDay2pmTemperature")
|
|
@@ -202,7 +202,7 @@ class _WiserRestController(object):
|
|
|
202
202
|
|
|
203
203
|
try:
|
|
204
204
|
async with aiohttp.ClientSession(
|
|
205
|
-
version=http_version, connector=aiohttp.TCPConnector(
|
|
205
|
+
version=http_version, connector=aiohttp.TCPConnector(ssl=False)
|
|
206
206
|
) as session:
|
|
207
207
|
async with session.request(action.value, url, **kwargs) as response:
|
|
208
208
|
await asyncio.sleep(0)
|
|
@@ -171,6 +171,7 @@ class _WiserSchedule:
|
|
|
171
171
|
"""
|
|
172
172
|
return None
|
|
173
173
|
|
|
174
|
+
|
|
174
175
|
def _convert_yaml_to_wiser_day(self, day_schedule) -> list | None:
|
|
175
176
|
"""
|
|
176
177
|
Convert from yaml format to wiser v2 schedule format.
|
|
@@ -508,6 +509,43 @@ class _WiserSchedule:
|
|
|
508
509
|
)
|
|
509
510
|
|
|
510
511
|
|
|
512
|
+
class _WiserSmartSchedule:
|
|
513
|
+
"""Read-only Smart overview data returned alongside regular schedules."""
|
|
514
|
+
|
|
515
|
+
def __init__(self, schedule_data: dict):
|
|
516
|
+
self._schedule_data = schedule_data
|
|
517
|
+
|
|
518
|
+
@property
|
|
519
|
+
def id(self) -> int | None:
|
|
520
|
+
return self._schedule_data.get("id")
|
|
521
|
+
|
|
522
|
+
@property
|
|
523
|
+
def schedule_type(self) -> str:
|
|
524
|
+
return "Smart"
|
|
525
|
+
|
|
526
|
+
@property
|
|
527
|
+
def rolling24h_view(self) -> dict:
|
|
528
|
+
"""Return the Rolling24HView details without altering the hub payload."""
|
|
529
|
+
return self._schedule_data.get("Rolling24HView") or {}
|
|
530
|
+
|
|
531
|
+
@property
|
|
532
|
+
def expiration_date(self) -> str | None:
|
|
533
|
+
return self.rolling24h_view.get("expirationDate")
|
|
534
|
+
|
|
535
|
+
@property
|
|
536
|
+
def current_state(self) -> str | None:
|
|
537
|
+
return self.rolling24h_view.get("currentState")
|
|
538
|
+
|
|
539
|
+
@property
|
|
540
|
+
def commands(self) -> list[dict]:
|
|
541
|
+
return self.rolling24h_view.get("commands", [])
|
|
542
|
+
|
|
543
|
+
@property
|
|
544
|
+
def schedule_data(self) -> dict:
|
|
545
|
+
"""Return the raw Smart entry, including any fields added by the hub."""
|
|
546
|
+
return self._schedule_data
|
|
547
|
+
|
|
548
|
+
|
|
511
549
|
class _WiserHeatingSchedule(_WiserSchedule):
|
|
512
550
|
"""Class for Wiser Heating Schedule"""
|
|
513
551
|
|
|
@@ -950,12 +988,16 @@ class _WiserScheduleCollection(object):
|
|
|
950
988
|
self._heating_schedules = []
|
|
951
989
|
self._onoff_schedules = []
|
|
952
990
|
self._level_schedules = []
|
|
991
|
+
self._smart_schedules = []
|
|
953
992
|
|
|
954
993
|
self._build(schedule_data)
|
|
955
994
|
|
|
956
995
|
def _build(self, schedule_data):
|
|
957
996
|
for schedule_type in schedule_data:
|
|
958
|
-
|
|
997
|
+
schedules = schedule_data.get(schedule_type) or []
|
|
998
|
+
if schedule_type == "Smart" and isinstance(schedules, dict):
|
|
999
|
+
schedules = [schedules]
|
|
1000
|
+
for schedule in schedules:
|
|
959
1001
|
if schedule_type == WiserScheduleTypeEnum.heating.value:
|
|
960
1002
|
self._heating_schedules.append(
|
|
961
1003
|
_WiserHeatingSchedule(
|
|
@@ -986,6 +1028,11 @@ class _WiserScheduleCollection(object):
|
|
|
986
1028
|
self._sunsets,
|
|
987
1029
|
)
|
|
988
1030
|
)
|
|
1031
|
+
if schedule_type == "Smart":
|
|
1032
|
+
self._smart_schedules.extend(
|
|
1033
|
+
_WiserSmartSchedule(item)
|
|
1034
|
+
for item in (schedule.get("Overview") or [])
|
|
1035
|
+
)
|
|
989
1036
|
|
|
990
1037
|
async def _send_schedule_command(
|
|
991
1038
|
self, action: str, schedule_data: dict, id: int = 0
|
|
@@ -1030,6 +1077,16 @@ class _WiserScheduleCollection(object):
|
|
|
1030
1077
|
def onoff_schedules(self) -> list[_WiserOnOffSchedule]:
|
|
1031
1078
|
return self._onoff_schedules
|
|
1032
1079
|
|
|
1080
|
+
@property
|
|
1081
|
+
def smart_schedules(self) -> list[_WiserSmartSchedule]:
|
|
1082
|
+
"""List Smart overview schedules (read-only hub data)."""
|
|
1083
|
+
return self._smart_schedules
|
|
1084
|
+
|
|
1085
|
+
@property
|
|
1086
|
+
def smarts(self) -> list[_WiserSmartSchedule]:
|
|
1087
|
+
"""Alias for :attr:`smart_schedules`."""
|
|
1088
|
+
return self._smart_schedules
|
|
1089
|
+
|
|
1033
1090
|
def get_by_id(
|
|
1034
1091
|
self, schedule_type: WiserScheduleTypeEnum, schedule_id: int
|
|
1035
1092
|
) -> _WiserHeatingSchedule | _WiserLevelSchedule | _WiserOnOffSchedule | None:
|
|
@@ -9,7 +9,6 @@ from .const import (
|
|
|
9
9
|
)
|
|
10
10
|
from .helpers.device import _WiserElectricalDevice
|
|
11
11
|
|
|
12
|
-
|
|
13
12
|
class _WiserLiftMovementRange(object):
|
|
14
13
|
"""Data structure for min/max output range"""
|
|
15
14
|
|
|
@@ -91,7 +90,6 @@ class _WiserLiftMovementRange(object):
|
|
|
91
90
|
"""Set tilt enable"""
|
|
92
91
|
return await self._shutter_instance._send_command({"TiltEnabled": en})
|
|
93
92
|
|
|
94
|
-
|
|
95
93
|
class _WiserShutter(_WiserElectricalDevice):
|
|
96
94
|
"""Class representing a Wiser Shutter device"""
|
|
97
95
|
|
|
@@ -266,6 +264,9 @@ class _WiserShutter(_WiserElectricalDevice):
|
|
|
266
264
|
if await self._send_command({"RespectSummerComfort": en}):
|
|
267
265
|
return True
|
|
268
266
|
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
269
270
|
@property
|
|
270
271
|
def summer_comfort_lift(self) -> int:
|
|
271
272
|
"""Get the shutter summer comfort lift"""
|
|
@@ -286,6 +287,55 @@ class _WiserShutter(_WiserElectricalDevice):
|
|
|
286
287
|
self._summer_comfort_tilt = tilt
|
|
287
288
|
return True
|
|
288
289
|
|
|
290
|
+
#Added by LGO Seasonal comfort
|
|
291
|
+
@property
|
|
292
|
+
def respect_seasonal_comfort(self) -> bool:
|
|
293
|
+
"""Get if the shutter respect seasonal comfort"""
|
|
294
|
+
return self._device_type_data.get("RespectSeasonalComfort", False)
|
|
295
|
+
|
|
296
|
+
async def set_respect_seasonal_comfort(self, en: bool):
|
|
297
|
+
"""Set respect seasonal comfort"""
|
|
298
|
+
if await self._send_command({"RespectSeasonalComfort": en}):
|
|
299
|
+
return True
|
|
300
|
+
|
|
301
|
+
@property
|
|
302
|
+
def seasonal_target_lift(self) -> int:
|
|
303
|
+
"""Get seasonal target lift of shutter"""
|
|
304
|
+
return self._device_type_data.get("SeasonalTargetLift", 0)
|
|
305
|
+
|
|
306
|
+
async def set_seasonal_target_lift(self, lift: int):
|
|
307
|
+
if await self._send_command({"SeasonalTargetLift": lift}):
|
|
308
|
+
self._seasonal_target_lift = lift
|
|
309
|
+
return True
|
|
310
|
+
|
|
311
|
+
@property
|
|
312
|
+
def facade(self) -> str:
|
|
313
|
+
"""Get facade of shutter"""
|
|
314
|
+
return self._device_type_data.get("Facade", TEXT_UNKNOWN)
|
|
315
|
+
|
|
316
|
+
@property
|
|
317
|
+
def room_with_temperature_sensor (self) -> int:
|
|
318
|
+
"""Get the index of the temperature sensor of the room for shutter"""
|
|
319
|
+
return self._device_type_data.get("RoomWithTemperatureSensor", 0)
|
|
320
|
+
|
|
321
|
+
@property
|
|
322
|
+
def use_average_temperature (self) -> bool:
|
|
323
|
+
"""Get use average temperature of shutter"""
|
|
324
|
+
return self._device_type_data.get("UseAverageTemperature", False)
|
|
325
|
+
|
|
326
|
+
@property
|
|
327
|
+
def seasonal_derogation_utc_timestamp (self) -> int:
|
|
328
|
+
"""Get derogation timestamp of shutter"""
|
|
329
|
+
return self._device_type_data.get("SeasonalDerogationUtcTimestamp", False)
|
|
330
|
+
|
|
331
|
+
@property
|
|
332
|
+
def covering_type (self) -> str:
|
|
333
|
+
"""Get the covering type Door?"""
|
|
334
|
+
return self._device_type_data.get("CoveringType", TEXT_UNKNOWN)
|
|
335
|
+
|
|
336
|
+
#End Added by LGO Seasonal comfort
|
|
337
|
+
|
|
338
|
+
|
|
289
339
|
async def open(self, percentage: int = 100):
|
|
290
340
|
"""Fully open shutter"""
|
|
291
341
|
if percentage >= 0 and percentage <= 100:
|
|
@@ -340,7 +390,6 @@ class _WiserShutter(_WiserElectricalDevice):
|
|
|
340
390
|
{"RequestAction": {"Action": "StopTilt"}}
|
|
341
391
|
)
|
|
342
392
|
|
|
343
|
-
|
|
344
393
|
class _WiserShutterCollection(object):
|
|
345
394
|
"""Class holding all wiser heating actuators"""
|
|
346
395
|
|
|
@@ -18,6 +18,7 @@ from .helpers.temp import _WiserTemperatureFunctions as tf
|
|
|
18
18
|
from .helpers.zigbee import _WiserZigbee
|
|
19
19
|
from .rest_controller import _WiserRestController
|
|
20
20
|
|
|
21
|
+
from .helpers.weather import _WiserWeather
|
|
21
22
|
|
|
22
23
|
class _WiserSystem(object):
|
|
23
24
|
"""Class representing a Wiser Hub device"""
|
|
@@ -60,6 +61,9 @@ class _WiserSystem(object):
|
|
|
60
61
|
self._upgrade_data = _WiserFirmareUpgradeInfo(self._data.get("UpgradeInfo", {}))
|
|
61
62
|
self._zigbee_data = _WiserZigbee(self._data.get("Zigbee", {}))
|
|
62
63
|
|
|
64
|
+
# Weather
|
|
65
|
+
self._weather_data = _WiserWeather(self._data.get("Weather", {}))
|
|
66
|
+
|
|
63
67
|
# Variables to hold values for settabel values
|
|
64
68
|
self._automatic_daylight_saving = self._system_data.get(
|
|
65
69
|
"AutomaticDaylightSaving"
|
|
@@ -93,7 +97,11 @@ class _WiserSystem(object):
|
|
|
93
97
|
self._summer_discomfort_prevention = self._system_data.get(
|
|
94
98
|
"SummerDiscomfortPrevention"
|
|
95
99
|
)
|
|
100
|
+
self._seasonal_comfort_enabled = self._system_data.get(
|
|
101
|
+
"SeasonalComfortEnabled")
|
|
96
102
|
|
|
103
|
+
self._timezone_identifier = self._system_data.get("TimeZoneIdentifier", TEXT_UNKNOWN)
|
|
104
|
+
|
|
97
105
|
# End Added by LGO
|
|
98
106
|
|
|
99
107
|
def _get_system_device(self, device_data: dict):
|
|
@@ -336,6 +344,18 @@ class _WiserSystem(object):
|
|
|
336
344
|
self._summer_comfort_enabled = enabled
|
|
337
345
|
return True
|
|
338
346
|
|
|
347
|
+
# Wiser app V7 seasonnal comfort
|
|
348
|
+
|
|
349
|
+
@property
|
|
350
|
+
def seasonal_comfort_enabled(self) -> bool:
|
|
351
|
+
"""Get or set if seasonal comfort is enabled"""
|
|
352
|
+
return self._seasonal_comfort_enabled
|
|
353
|
+
|
|
354
|
+
async def set_seasonal_comfort_enabled(self, enabled: bool):
|
|
355
|
+
if await self._send_command({"SeasonalComfortEnabled": enabled}):
|
|
356
|
+
self._seasonal_comfort_enabled = enabled
|
|
357
|
+
return True
|
|
358
|
+
|
|
339
359
|
@property
|
|
340
360
|
def indoor_discomfort_temperature(self) -> float:
|
|
341
361
|
"""Get indoor discomfort temperature for summer comfort"""
|
|
@@ -381,6 +401,11 @@ class _WiserSystem(object):
|
|
|
381
401
|
"""Get type of zigbee device"""
|
|
382
402
|
return self._device_data.get("Type", TEXT_UNKNOWN)
|
|
383
403
|
|
|
404
|
+
@property
|
|
405
|
+
def weather(self) -> _WiserWeather:
|
|
406
|
+
"""Get weather info"""
|
|
407
|
+
return self._weather_data
|
|
408
|
+
|
|
384
409
|
@property
|
|
385
410
|
def uuid(self) -> str:
|
|
386
411
|
"""Get UUID zigbee"""
|
|
@@ -407,6 +432,26 @@ class _WiserSystem(object):
|
|
|
407
432
|
"""Get Can activate PCM"""
|
|
408
433
|
return self._system_data.get("CanActivatePCM", False)
|
|
409
434
|
|
|
435
|
+
@property
|
|
436
|
+
def pcm_online(self) -> bool:
|
|
437
|
+
"""Get PCM online"""
|
|
438
|
+
return self._system_data.get("PCMOnline", False)
|
|
439
|
+
|
|
440
|
+
@property
|
|
441
|
+
def wec_version(self) -> str:
|
|
442
|
+
"""Get WEC Web Energy Center version"""
|
|
443
|
+
return self._system_data.get("WECVersion", TEXT_UNKNOWN)
|
|
444
|
+
|
|
445
|
+
@property
|
|
446
|
+
def wes_status_available(self) -> bool:
|
|
447
|
+
"""Get WES Web Energy Supervisor status available"""
|
|
448
|
+
return self._system_data.get("WESStatusAvailable", False)
|
|
449
|
+
|
|
450
|
+
@property
|
|
451
|
+
def rmb_follow_smart(self) -> bool:
|
|
452
|
+
"""Get RMB Rduce My Bill follow smart"""
|
|
453
|
+
return self._system_data.get("RMBFollowSmart", False)
|
|
454
|
+
|
|
410
455
|
# End Added LGO
|
|
411
456
|
|
|
412
457
|
@property
|
|
@@ -424,6 +469,11 @@ class _WiserSystem(object):
|
|
|
424
469
|
"""Get current system mode"""
|
|
425
470
|
return self._system_data.get("SystemMode", TEXT_UNKNOWN)
|
|
426
471
|
|
|
472
|
+
@property
|
|
473
|
+
def timezone_identifier(self) -> str:
|
|
474
|
+
"""Get the timezone identifier reported by the hub."""
|
|
475
|
+
return self._timezone_identifier
|
|
476
|
+
|
|
427
477
|
@property
|
|
428
478
|
def timezone_offset(self) -> int:
|
|
429
479
|
"""Get timezone offset in minutes"""
|
|
@@ -39,6 +39,8 @@ from .const import (
|
|
|
39
39
|
WISERHUBSCHEDULES,
|
|
40
40
|
WISERHUBSTATUS,
|
|
41
41
|
WISERHUBURL,
|
|
42
|
+
WISERTARIFFS,
|
|
43
|
+
WiserTariffTypeEnum,
|
|
42
44
|
WiserUnitsEnum,
|
|
43
45
|
)
|
|
44
46
|
from .automation import _WiserAutomationCollection
|
|
@@ -52,6 +54,7 @@ from .exceptions import (
|
|
|
52
54
|
from .heating import _WiserHeatingChannelCollection
|
|
53
55
|
from .helpers.automations import _WiserHeatingChannelAutomations
|
|
54
56
|
from .helpers.status import WiserStatus
|
|
57
|
+
from .helpers.tariffs import _WiserTariffs
|
|
55
58
|
from .hot_water import _WiserHotwater
|
|
56
59
|
from .moments import _WiserMomentCollection
|
|
57
60
|
from .refactor import refactor
|
|
@@ -97,6 +100,7 @@ class WiserAPI:
|
|
|
97
100
|
self._schedule_data = {}
|
|
98
101
|
self._opentherm_data = {}
|
|
99
102
|
self._status_data = {}
|
|
103
|
+
self._tariff_data = {}
|
|
100
104
|
|
|
101
105
|
# Data stores for exposed properties
|
|
102
106
|
self._devices = None
|
|
@@ -107,6 +111,7 @@ class WiserAPI:
|
|
|
107
111
|
self._rooms = None
|
|
108
112
|
self._schedules = None
|
|
109
113
|
self._system = None
|
|
114
|
+
self._tariffs = _WiserTariffs()
|
|
110
115
|
|
|
111
116
|
self._enable_automations = enable_automations
|
|
112
117
|
self._extra_config_file = extra_config_file
|
|
@@ -196,6 +201,23 @@ class WiserAPI:
|
|
|
196
201
|
except WiserHubRESTError:
|
|
197
202
|
self._status_data = {}
|
|
198
203
|
|
|
204
|
+
# Some hub firmware includes tariffs in the main domain response;
|
|
205
|
+
# use that data before trying the optional dedicated endpoint.
|
|
206
|
+
self._tariff_data = self._domain_data.get("Tariffs", {})
|
|
207
|
+
if not self._tariff_data:
|
|
208
|
+
try:
|
|
209
|
+
self._tariff_data = await self._wiser_rest_controller.get_hub_data(
|
|
210
|
+
WISERHUBURL
|
|
211
|
+
+ WISERTARIFFS.format(WiserTariffTypeEnum.energytariffs.value),
|
|
212
|
+
raise_for_endpoint_error=False,
|
|
213
|
+
)
|
|
214
|
+
except (WiserHubConnectionError, WiserHubRESTError) as ex:
|
|
215
|
+
_LOGGER.warning(
|
|
216
|
+
"Unable to retrieve optional energy tariff data: %s", ex
|
|
217
|
+
)
|
|
218
|
+
self._tariff_data = {}
|
|
219
|
+
|
|
220
|
+
# Only get opentherm data if connected
|
|
199
221
|
# Do not let an optional boiler endpoint invalidate fresh hub data.
|
|
200
222
|
opentherm = self._domain_data.get("System", {}).get(
|
|
201
223
|
"OpenThermConnectionStatus", ""
|
|
@@ -257,6 +279,8 @@ class WiserAPI:
|
|
|
257
279
|
await self._wiser_rest_controller.get_extra_config_data()
|
|
258
280
|
|
|
259
281
|
if self._domain_data != {} and self._network_data != {}:
|
|
282
|
+
self._tariffs = _WiserTariffs(self._tariff_data)
|
|
283
|
+
|
|
260
284
|
# System Object
|
|
261
285
|
_device_data = self._domain_data.get("Device", [])
|
|
262
286
|
self._system = _WiserSystem(
|
|
@@ -381,6 +405,11 @@ class WiserAPI:
|
|
|
381
405
|
"""Hub status info"""
|
|
382
406
|
return WiserStatus(self._status_data)
|
|
383
407
|
|
|
408
|
+
@property
|
|
409
|
+
def tariffs(self) -> _WiserTariffs:
|
|
410
|
+
"""Energy tariff information reported by the hub."""
|
|
411
|
+
return self._tariffs
|
|
412
|
+
|
|
384
413
|
@property
|
|
385
414
|
def system(self) -> _WiserSystem:
|
|
386
415
|
"""Entity of the Wiser Hub"""
|
|
@@ -409,6 +438,7 @@ class WiserAPI:
|
|
|
409
438
|
"Schedule": self._schedule_data,
|
|
410
439
|
"OpenTherm": self._opentherm_data,
|
|
411
440
|
"Status": self._status_data,
|
|
441
|
+
"Tariffs": self._tariff_data,
|
|
412
442
|
}
|
|
413
443
|
|
|
414
444
|
# @property
|
|
@@ -56,10 +56,12 @@ aioWiserHeatAPI/helpers/opentherm.py
|
|
|
56
56
|
aioWiserHeatAPI/helpers/signal.py
|
|
57
57
|
aioWiserHeatAPI/helpers/special_times.py
|
|
58
58
|
aioWiserHeatAPI/helpers/status.py
|
|
59
|
+
aioWiserHeatAPI/helpers/tariffs.py
|
|
59
60
|
aioWiserHeatAPI/helpers/temp.py
|
|
60
61
|
aioWiserHeatAPI/helpers/threshold.py
|
|
61
62
|
aioWiserHeatAPI/helpers/uiconfiguration.py
|
|
62
63
|
aioWiserHeatAPI/helpers/version.py
|
|
64
|
+
aioWiserHeatAPI/helpers/weather.py
|
|
63
65
|
aioWiserHeatAPI/helpers/zigbee.py
|
|
64
66
|
tests/test_device_notifications.py
|
|
65
67
|
tests/test_equipment.py
|
|
@@ -72,4 +74,7 @@ tests/test_ptc.py
|
|
|
72
74
|
tests/test_rest_controller.py
|
|
73
75
|
tests/test_rest_payloads.py
|
|
74
76
|
tests/test_schedule.py
|
|
75
|
-
tests/
|
|
77
|
+
tests/test_smart_schedule.py
|
|
78
|
+
tests/test_smartplug.py
|
|
79
|
+
tests/test_tariffs.py
|
|
80
|
+
tests/test_weather.py
|
|
@@ -11,6 +11,9 @@ from aioWiserHeatAPI.const import (
|
|
|
11
11
|
WISERHUBOPENTHERMV2,
|
|
12
12
|
WISERHUBSCHEDULES,
|
|
13
13
|
WISERHUBSTATUS,
|
|
14
|
+
WISERHUBURL,
|
|
15
|
+
WISERTARIFFS,
|
|
16
|
+
WiserTariffTypeEnum,
|
|
14
17
|
)
|
|
15
18
|
from aioWiserHeatAPI.exceptions import (
|
|
16
19
|
WiserHubAuthenticationError,
|
|
@@ -171,11 +174,12 @@ class HeatingRefreshTest(unittest.IsolatedAsyncioTestCase):
|
|
|
171
174
|
}
|
|
172
175
|
self.ot_data = {"Enabled": True, "operationalData": {"SlaveStatus": 2}}
|
|
173
176
|
self.ot_error = None
|
|
177
|
+
self.schedule_data = []
|
|
174
178
|
self.controller = self.hub._wiser_rest_controller
|
|
175
179
|
self.controller.get_hub_data = AsyncMock(side_effect=self.read)
|
|
176
180
|
self.controller.get_extra_config_data = AsyncMock()
|
|
177
181
|
|
|
178
|
-
async def read(self, endpoint,
|
|
182
|
+
async def read(self, endpoint, raise_for_endpoint_error=True):
|
|
179
183
|
if endpoint in (WISERHUBOPENTHERM, WISERHUBOPENTHERMV2):
|
|
180
184
|
if self.ot_error:
|
|
181
185
|
raise self.ot_error
|
|
@@ -183,10 +187,20 @@ class HeatingRefreshTest(unittest.IsolatedAsyncioTestCase):
|
|
|
183
187
|
return {
|
|
184
188
|
WISERHUBDOMAIN: self.domain,
|
|
185
189
|
WISERHUBNETWORK: {"Station": {}},
|
|
186
|
-
WISERHUBSCHEDULES:
|
|
190
|
+
WISERHUBSCHEDULES: self.schedule_data,
|
|
187
191
|
WISERHUBSTATUS: {},
|
|
192
|
+
WISERHUBURL + WISERTARIFFS.format(
|
|
193
|
+
WiserTariffTypeEnum.energytariffs.value
|
|
194
|
+
): {},
|
|
188
195
|
}[endpoint]
|
|
189
196
|
|
|
197
|
+
async def test_null_smart_overview_does_not_prevent_heating_refresh(self):
|
|
198
|
+
self.schedule_data = {"Smart": {"Overview": None}}
|
|
199
|
+
await self.hub.read_hub_data()
|
|
200
|
+
self.assertEqual(self.hub.schedules.smart_schedules, [])
|
|
201
|
+
self.assertTrue(self.hub.rooms.get_by_id(1).is_heating)
|
|
202
|
+
self.assertIsNotNone(self.hub.heating_channels)
|
|
203
|
+
|
|
190
204
|
async def test_relay_hub_does_not_poll_opentherm(self):
|
|
191
205
|
await self.hub.read_hub_data()
|
|
192
206
|
calls = [
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Regression tests for optional Smart schedule data."""
|
|
2
|
+
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
from aioWiserHeatAPI.schedule import _WiserScheduleCollection, _WiserSmartSchedule
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class WiserSmartScheduleCollectionTest(unittest.TestCase):
|
|
9
|
+
def test_missing_or_null_overview_is_empty(self):
|
|
10
|
+
for smart in ({}, {"Overview": None}, {"Overview": []}):
|
|
11
|
+
for data in (smart, [smart]):
|
|
12
|
+
with self.subTest(data=data):
|
|
13
|
+
schedules = _WiserScheduleCollection(
|
|
14
|
+
None, {"Smart": data}, {}, {}
|
|
15
|
+
)
|
|
16
|
+
self.assertEqual(schedules.smart_schedules, [])
|
|
17
|
+
|
|
18
|
+
def test_populated_overview_survives_null_overview(self):
|
|
19
|
+
entry = {"id": 7, "Rolling24HView": {"currentState": "On"}}
|
|
20
|
+
schedules = _WiserScheduleCollection(
|
|
21
|
+
None,
|
|
22
|
+
{"Smart": [{"Overview": None}, {"Overview": [entry]}]},
|
|
23
|
+
{},
|
|
24
|
+
{},
|
|
25
|
+
)
|
|
26
|
+
self.assertEqual(len(schedules.smart_schedules), 1)
|
|
27
|
+
self.assertEqual(schedules.smart_schedules[0].id, 7)
|
|
28
|
+
self.assertEqual(schedules.smart_schedules[0].current_state, "On")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class WiserSmartScheduleViewTest(unittest.TestCase):
|
|
32
|
+
def test_missing_or_null_rolling_view_is_unavailable(self):
|
|
33
|
+
for data in (
|
|
34
|
+
{"id": 7},
|
|
35
|
+
{"id": 7, "Rolling24HView": None},
|
|
36
|
+
{"id": 7, "Rolling24HView": {}},
|
|
37
|
+
):
|
|
38
|
+
with self.subTest(data=data):
|
|
39
|
+
schedule = _WiserSmartSchedule(data)
|
|
40
|
+
self.assertEqual(schedule.rolling24h_view, {})
|
|
41
|
+
self.assertIsNone(schedule.expiration_date)
|
|
42
|
+
self.assertIsNone(schedule.current_state)
|
|
43
|
+
self.assertEqual(schedule.commands, [])
|
|
44
|
+
self.assertEqual(schedule.schedule_data, data)
|
|
45
|
+
|
|
46
|
+
def test_populated_rolling_view_preserves_hub_values(self):
|
|
47
|
+
view = {
|
|
48
|
+
"expirationDate": "2026-11-24T12:00:00Z",
|
|
49
|
+
"currentState": "Off",
|
|
50
|
+
"commands": [{"time": "12:00", "state": "On"}],
|
|
51
|
+
}
|
|
52
|
+
data = {"id": 7, "Rolling24HView": view, "ExtraField": "preserved"}
|
|
53
|
+
schedule = _WiserSmartSchedule(data)
|
|
54
|
+
self.assertEqual(schedule.expiration_date, view["expirationDate"])
|
|
55
|
+
self.assertEqual(schedule.current_state, view["currentState"])
|
|
56
|
+
self.assertEqual(schedule.commands, view["commands"])
|
|
57
|
+
self.assertEqual(schedule.schedule_data, data)
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"""Regression tests for optional tariff polling."""
|
|
2
|
+
|
|
3
|
+
import unittest
|
|
4
|
+
from unittest.mock import AsyncMock, call
|
|
5
|
+
|
|
6
|
+
from aioWiserHeatAPI.const import (
|
|
7
|
+
WISERHUBDOMAIN,
|
|
8
|
+
WISERHUBNETWORK,
|
|
9
|
+
WISERHUBSCHEDULES,
|
|
10
|
+
WISERHUBSTATUS,
|
|
11
|
+
WISERHUBURL,
|
|
12
|
+
WISERTARIFFS,
|
|
13
|
+
WiserTariffTypeEnum,
|
|
14
|
+
)
|
|
15
|
+
from aioWiserHeatAPI.exceptions import (
|
|
16
|
+
WiserHubAuthenticationError,
|
|
17
|
+
WiserHubConnectionError,
|
|
18
|
+
WiserHubRESTError,
|
|
19
|
+
)
|
|
20
|
+
from aioWiserHeatAPI.helpers.tariffs import _WiserTariffs
|
|
21
|
+
from aioWiserHeatAPI.wiserhub import WiserAPI
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
TARIFF_ENDPOINT = WISERHUBURL + WISERTARIFFS.format(
|
|
25
|
+
WiserTariffTypeEnum.energytariffs.value
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class TariffModelsTest(unittest.TestCase):
|
|
30
|
+
def test_wrapped_and_direct_payloads_preserve_prices_and_intervals(self):
|
|
31
|
+
energy = {
|
|
32
|
+
"CurrentPrice": -0.05,
|
|
33
|
+
"CurrentPrice100Multiplier": -5.0,
|
|
34
|
+
"DailyAverage": 0.0,
|
|
35
|
+
"DailyAverage100Multiplier": 0.0,
|
|
36
|
+
"Forecast": [{
|
|
37
|
+
"id": 1, "from": "2026-11-23T12:00:00Z",
|
|
38
|
+
"to": "2026-11-23T13:00:00Z", "price": -0.05,
|
|
39
|
+
}],
|
|
40
|
+
"CurrentDay": [{"id": 2, "price": 0.0}],
|
|
41
|
+
}
|
|
42
|
+
for payload in (energy, {"EnergyTariff": energy}):
|
|
43
|
+
with self.subTest(payload=payload):
|
|
44
|
+
tariffs = _WiserTariffs(payload)
|
|
45
|
+
self.assertEqual(tariffs.current_price, -0.05)
|
|
46
|
+
self.assertEqual(tariffs.current_pricex100, -5.0)
|
|
47
|
+
self.assertEqual(tariffs.daily_average, 0.0)
|
|
48
|
+
self.assertEqual(tariffs.daily_averagex100, 0.0)
|
|
49
|
+
self.assertEqual(tariffs.forecast.count, 1)
|
|
50
|
+
interval = tariffs.forecast.all[0]
|
|
51
|
+
self.assertEqual(interval.id, 1)
|
|
52
|
+
self.assertEqual(interval.begin, energy["Forecast"][0]["from"])
|
|
53
|
+
self.assertEqual(interval.end, energy["Forecast"][0]["to"])
|
|
54
|
+
self.assertEqual(interval.price, -0.05)
|
|
55
|
+
self.assertEqual(list(tariffs.current_day)[0].price, 0.0)
|
|
56
|
+
self.assertEqual(tariffs.energy_tariff.current_price, -0.05)
|
|
57
|
+
|
|
58
|
+
def test_missing_data_remains_unavailable(self):
|
|
59
|
+
for payload in (None, {}, {"EnergyTariff": None}, {"EnergyTariff": {}}):
|
|
60
|
+
with self.subTest(payload=payload):
|
|
61
|
+
tariffs = _WiserTariffs(payload)
|
|
62
|
+
self.assertIsNone(tariffs.current_price)
|
|
63
|
+
self.assertIsNone(tariffs.current_pricex100)
|
|
64
|
+
self.assertIsNone(tariffs.daily_average)
|
|
65
|
+
self.assertIsNone(tariffs.daily_averagex100)
|
|
66
|
+
self.assertEqual(list(tariffs.forecast), [])
|
|
67
|
+
self.assertEqual(list(tariffs.current_day), [])
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class TariffInitializationTest(unittest.TestCase):
|
|
71
|
+
def test_tariffs_are_available_before_first_refresh(self):
|
|
72
|
+
tariffs = WiserAPI("wiser.example", "secret").tariffs
|
|
73
|
+
self.assertIsNone(tariffs.current_price)
|
|
74
|
+
self.assertIsNone(tariffs.daily_average)
|
|
75
|
+
self.assertEqual(list(tariffs.forecast), [])
|
|
76
|
+
self.assertEqual(list(tariffs.current_day), [])
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class TariffRefreshTest(unittest.IsolatedAsyncioTestCase):
|
|
80
|
+
def setUp(self):
|
|
81
|
+
self.hub = WiserAPI("wiser.example", "secret")
|
|
82
|
+
self.domain = {"System": {"OpenThermConnectionStatus": "Disconnected"}}
|
|
83
|
+
self.tariffs = {"EnergyTariff": {"CurrentPrice": 0.25}}
|
|
84
|
+
self.tariff_error = None
|
|
85
|
+
self.controller = self.hub._wiser_rest_controller
|
|
86
|
+
self.controller.get_hub_data = AsyncMock(side_effect=self.read)
|
|
87
|
+
|
|
88
|
+
async def read(self, endpoint, raise_for_endpoint_error=True):
|
|
89
|
+
if endpoint == TARIFF_ENDPOINT:
|
|
90
|
+
if self.tariff_error is not None:
|
|
91
|
+
raise self.tariff_error
|
|
92
|
+
return self.tariffs
|
|
93
|
+
return {
|
|
94
|
+
WISERHUBDOMAIN: self.domain,
|
|
95
|
+
WISERHUBNETWORK: {"Station": {}},
|
|
96
|
+
WISERHUBSCHEDULES: [],
|
|
97
|
+
WISERHUBSTATUS: {},
|
|
98
|
+
}[endpoint]
|
|
99
|
+
|
|
100
|
+
async def test_domain_tariffs_avoid_optional_endpoint(self):
|
|
101
|
+
self.domain["Tariffs"] = self.tariffs
|
|
102
|
+
await self.hub._get_hub_data()
|
|
103
|
+
self.assertEqual(self.hub.raw_hub_data["Tariffs"], self.tariffs)
|
|
104
|
+
self.assertNotIn(
|
|
105
|
+
call(TARIFF_ENDPOINT, raise_for_endpoint_error=False),
|
|
106
|
+
self.controller.get_hub_data.await_args_list,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
async def test_missing_domain_tariffs_use_optional_endpoint(self):
|
|
110
|
+
await self.hub._get_hub_data()
|
|
111
|
+
self.assertEqual(self.hub.raw_hub_data["Tariffs"], self.tariffs)
|
|
112
|
+
self.controller.get_hub_data.assert_any_await(
|
|
113
|
+
TARIFF_ENDPOINT, raise_for_endpoint_error=False
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
async def test_unsupported_tariffs_do_not_prevent_refresh(self):
|
|
117
|
+
self.tariffs = {}
|
|
118
|
+
self.assertTrue(await self.hub._get_hub_data())
|
|
119
|
+
self.assertEqual(self.hub.raw_hub_data["Tariffs"], {})
|
|
120
|
+
|
|
121
|
+
async def test_optional_failure_clears_previous_tariffs(self):
|
|
122
|
+
await self.hub._get_hub_data()
|
|
123
|
+
for error in (WiserHubConnectionError("timeout"), WiserHubRESTError("bad JSON")):
|
|
124
|
+
with self.subTest(error=type(error).__name__):
|
|
125
|
+
self.tariff_error = error
|
|
126
|
+
self.assertTrue(await self.hub._get_hub_data())
|
|
127
|
+
self.assertEqual(self.hub.raw_hub_data["Tariffs"], {})
|
|
128
|
+
|
|
129
|
+
async def test_authentication_error_is_not_suppressed(self):
|
|
130
|
+
self.tariff_error = WiserHubAuthenticationError("unauthorized")
|
|
131
|
+
with self.assertRaises(WiserHubAuthenticationError):
|
|
132
|
+
await self.hub._get_hub_data()
|
|
133
|
+
|
|
134
|
+
async def test_refresh_rebuilds_public_tariffs_and_clears_missing_data(self):
|
|
135
|
+
self.domain["System"]["UnixTime"] = 0
|
|
136
|
+
self.domain["Device"] = []
|
|
137
|
+
self.hub._enable_automations = False
|
|
138
|
+
self.controller.get_extra_config_data = AsyncMock()
|
|
139
|
+
await self.hub.read_hub_data()
|
|
140
|
+
self.assertIsInstance(self.hub.tariffs, _WiserTariffs)
|
|
141
|
+
self.assertEqual(self.hub.tariffs.current_price, 0.25)
|
|
142
|
+
self.tariffs = {"EnergyTariff": {"CurrentPrice": -0.05}}
|
|
143
|
+
await self.hub.read_hub_data()
|
|
144
|
+
self.assertEqual(self.hub.tariffs.current_price, -0.05)
|
|
145
|
+
self.tariffs = {}
|
|
146
|
+
await self.hub.read_hub_data()
|
|
147
|
+
self.assertIsNone(self.hub.tariffs.current_price)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Tests for outdoor weather temperature conversion."""
|
|
2
|
+
|
|
3
|
+
import unittest
|
|
4
|
+
|
|
5
|
+
from aioWiserHeatAPI.const import TEMP_ERROR
|
|
6
|
+
from aioWiserHeatAPI.helpers.weather import _WiserWeather
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class WiserWeatherTest(unittest.TestCase):
|
|
10
|
+
def test_outdoor_temperatures_are_not_clamped_to_indoor_limits(self):
|
|
11
|
+
for raw, expected in (
|
|
12
|
+
(-405, -40.5), (-250, -25.0), (-200, -20.0),
|
|
13
|
+
(-195, -19.5), (0, 0.0), (215, 21.5),
|
|
14
|
+
):
|
|
15
|
+
with self.subTest(raw=raw):
|
|
16
|
+
weather = _WiserWeather(
|
|
17
|
+
{"Temperature": raw, "NextDay2pmTemperature": raw}
|
|
18
|
+
)
|
|
19
|
+
self.assertEqual(weather.temperature, expected)
|
|
20
|
+
self.assertEqual(weather.next_day_2pm_temperature, expected)
|
|
21
|
+
|
|
22
|
+
def test_missing_temperatures_remain_unavailable(self):
|
|
23
|
+
for data in ({}, {"Temperature": None, "NextDay2pmTemperature": None}):
|
|
24
|
+
with self.subTest(data=data):
|
|
25
|
+
weather = _WiserWeather(data)
|
|
26
|
+
self.assertIsNone(weather.temperature)
|
|
27
|
+
self.assertIsNone(weather.next_day_2pm_temperature)
|
|
28
|
+
|
|
29
|
+
def test_error_temperatures_remain_unavailable(self):
|
|
30
|
+
for raw in (TEMP_ERROR, -TEMP_ERROR, TEMP_ERROR + 1):
|
|
31
|
+
with self.subTest(raw=raw):
|
|
32
|
+
weather = _WiserWeather(
|
|
33
|
+
{"Temperature": raw, "NextDay2pmTemperature": raw}
|
|
34
|
+
)
|
|
35
|
+
self.assertIsNone(weather.temperature)
|
|
36
|
+
self.assertIsNone(weather.next_day_2pm_temperature)
|
|
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.10 → aiowiserheatapi-1.7.11}/aioWiserHeatAPI/helpers/uiconfiguration.py
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
|
{aiowiserheatapi-1.7.10 → aiowiserheatapi-1.7.11}/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
|