aioWiserHeatAPI 1.5.13__tar.gz → 1.5.15__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.5.13 → aiowiserheatapi-1.5.15}/PKG-INFO +14 -2
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/README.md +13 -1
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/__init__.py +1 -1
- aiowiserheatapi-1.5.15/aioWiserHeatAPI/automation.py +85 -0
- aiowiserheatapi-1.5.15/aioWiserHeatAPI/binary_sensor.py +67 -0
- aiowiserheatapi-1.5.15/aioWiserHeatAPI/boiler_interface.py +40 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/cli.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/const.py +35 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/devices.py +54 -47
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/discovery.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/exceptions.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/heating.py +6 -6
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/heating_actuator.py +11 -22
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/__init__.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/automations.py +40 -10
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/battery.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/capabilities.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/cloud.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/device.py +10 -8
- aiowiserheatapi-1.5.15/aioWiserHeatAPI/helpers/equipment.py +274 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/extra_config.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/firmware.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/gps.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/misc.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/network.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/opentherm.py +39 -12
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/signal.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/special_times.py +11 -5
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/status.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/temp.py +21 -18
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/helpers/zigbee.py +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/hot_water.py +166 -24
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/light.py +110 -28
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/moments.py +18 -8
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/pte.py +3 -3
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/rest_controller.py +26 -24
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/room.py +34 -21
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/roomstat.py +5 -7
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/schedule.py +151 -170
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/shutter.py +7 -6
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/smartplug.py +11 -12
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/smartvalve.py +8 -6
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/smokealarm.py +11 -6
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/system.py +41 -52
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/ufh.py +17 -13
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI/wiserhub.py +13 -23
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI.egg-info/PKG-INFO +14 -2
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI.egg-info/SOURCES.txt +3 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/setup.cfg +0 -0
- aioWiserHeatAPI-1.5.13/aioWiserHeatAPI/helpers/equipment.py +0 -137
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/LICENSE +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI.egg-info/dependency_links.txt +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI.egg-info/entry_points.txt +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI.egg-info/requires.txt +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/aioWiserHeatAPI.egg-info/top_level.txt +0 -0
- {aioWiserHeatAPI-1.5.13 → aiowiserheatapi-1.5.15}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aioWiserHeatAPI
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.15
|
|
4
4
|
Summary: An AsyncIO API for controlling the Drayton Wiser Heating system
|
|
5
5
|
Home-page: https://github.com/msp1974/aioWiserHeatAPI
|
|
6
6
|
Author: Mark Parker
|
|
@@ -18,7 +18,7 @@ Requires-Dist: aiohttp>=3.9.3
|
|
|
18
18
|
Requires-Dist: aiofiles>=23.2.1
|
|
19
19
|
Requires-Dist: pyyaml>=6.0.1
|
|
20
20
|
|
|
21
|
-
# Drayton Wiser Hub API Async v1.5.
|
|
21
|
+
# Drayton Wiser Hub API Async v1.5.15
|
|
22
22
|
|
|
23
23
|
This repository contains a simple API which queries the Drayton Wiser Heating sysystem used in the UK.
|
|
24
24
|
|
|
@@ -72,6 +72,18 @@ Documentation available in [info.md](https://github.com/msp1974/wiserHeatAPIv2/b
|
|
|
72
72
|
|
|
73
73
|
## Changelog
|
|
74
74
|
|
|
75
|
+
### v1.5.15
|
|
76
|
+
|
|
77
|
+
* Added addiitonal functions for v2 hub lights, equipments etc
|
|
78
|
+
* Added support for WindowDoor sensors
|
|
79
|
+
* Added support for Boiler Interface device
|
|
80
|
+
|
|
81
|
+
### v1.5.14
|
|
82
|
+
|
|
83
|
+
* Fix presets not using defined boost temp
|
|
84
|
+
* Set return value of energy sensors to None if not provided by hub
|
|
85
|
+
* Updated headers for hub query
|
|
86
|
+
|
|
75
87
|
### v1.5.13
|
|
76
88
|
|
|
77
89
|
* Updates to support v2 hub functions - @LGO44
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Drayton Wiser Hub API Async v1.5.
|
|
1
|
+
# Drayton Wiser Hub API Async v1.5.15
|
|
2
2
|
|
|
3
3
|
This repository contains a simple API which queries the Drayton Wiser Heating sysystem used in the UK.
|
|
4
4
|
|
|
@@ -52,6 +52,18 @@ Documentation available in [info.md](https://github.com/msp1974/wiserHeatAPIv2/b
|
|
|
52
52
|
|
|
53
53
|
## Changelog
|
|
54
54
|
|
|
55
|
+
### v1.5.15
|
|
56
|
+
|
|
57
|
+
* Added addiitonal functions for v2 hub lights, equipments etc
|
|
58
|
+
* Added support for WindowDoor sensors
|
|
59
|
+
* Added support for Boiler Interface device
|
|
60
|
+
|
|
61
|
+
### v1.5.14
|
|
62
|
+
|
|
63
|
+
* Fix presets not using defined boost temp
|
|
64
|
+
* Set return value of energy sensors to None if not provided by hub
|
|
65
|
+
* Updated headers for hub query
|
|
66
|
+
|
|
55
67
|
### v1.5.13
|
|
56
68
|
|
|
57
69
|
* Updates to support v2 hub functions - @LGO44
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
|
|
3
|
+
from . import _LOGGER
|
|
4
|
+
from .const import TEXT_UNKNOWN, WISERSYSTEM
|
|
5
|
+
from .rest_controller import _WiserRestController
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class _WiserAutomation:
|
|
9
|
+
def __init__(
|
|
10
|
+
self, wiser_rest_controller: _WiserRestController, automation_data: dict
|
|
11
|
+
):
|
|
12
|
+
self._wiser_rest_controller = wiser_rest_controller
|
|
13
|
+
self._automation_data = automation_data
|
|
14
|
+
|
|
15
|
+
async def _send_command(self, cmd: dict) -> bool:
|
|
16
|
+
"""
|
|
17
|
+
Send system control command to Wiser Hub
|
|
18
|
+
param cmd: json command structure
|
|
19
|
+
return: boolen - true = success, false = failed
|
|
20
|
+
"""
|
|
21
|
+
result = await self._wiser_rest_controller._send_command(WISERSYSTEM, cmd)
|
|
22
|
+
if result:
|
|
23
|
+
_LOGGER.debug(
|
|
24
|
+
"Wiser hub - %s command successful", format(inspect.stack()[1].function)
|
|
25
|
+
)
|
|
26
|
+
return True
|
|
27
|
+
return False
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def id(self) -> int:
|
|
31
|
+
return self._automation_data.get("id", 0)
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def name(self) -> str:
|
|
35
|
+
return self._automation_data.get("Name", TEXT_UNKNOWN)
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def enabled(self) -> bool:
|
|
39
|
+
return self._automation_data.get("Enabled", False)
|
|
40
|
+
|
|
41
|
+
async def trigger(self):
|
|
42
|
+
"""Activate automation"""
|
|
43
|
+
return await self._send_command({"TriggerAutomation": self.id})
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def notification_enabled(self) -> bool:
|
|
47
|
+
return self._automation_data.get("EnableNotification", False)
|
|
48
|
+
|
|
49
|
+
async def enable_notification(self):
|
|
50
|
+
"""Activate automation"""
|
|
51
|
+
return await self._send_command({"EnableNotification": self.id})
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class _WiserAutomationCollection(object):
|
|
55
|
+
def __init__(
|
|
56
|
+
self, wiser_rest_controller: _WiserRestController, automations_data: dict
|
|
57
|
+
):
|
|
58
|
+
self._automation_data = automations_data
|
|
59
|
+
self._automations = []
|
|
60
|
+
self._wiser_rest_controller = wiser_rest_controller
|
|
61
|
+
self._build()
|
|
62
|
+
|
|
63
|
+
def _build(self):
|
|
64
|
+
for automation in self._automation_data:
|
|
65
|
+
self._automations.append(
|
|
66
|
+
_WiserAutomation(self._wiser_rest_controller, automation)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def all(self) -> list[_WiserAutomation]:
|
|
71
|
+
"""Return list of automations"""
|
|
72
|
+
return self._automations
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def count(self) -> int:
|
|
76
|
+
"""Count of automations"""
|
|
77
|
+
return len(self._automations)
|
|
78
|
+
|
|
79
|
+
def get_by_id(self, automation_id: int) -> _WiserAutomation:
|
|
80
|
+
try:
|
|
81
|
+
return [
|
|
82
|
+
automation for automation in self.all if automation.id == automation_id
|
|
83
|
+
][0]
|
|
84
|
+
except IndexError:
|
|
85
|
+
return None
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Handles binary_sensor devices
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .helpers.battery import _WiserBattery
|
|
6
|
+
from .helpers.device import _WiserDevice
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class _WiserBinarySensor(_WiserDevice):
|
|
10
|
+
"""Class representing a Wiser Binary Sensor"""
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def active(self) -> bool:
|
|
14
|
+
"""Get if is active"""
|
|
15
|
+
return self._device_type_data.get("Active")
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def interacts_with_room_climate(self) -> bool:
|
|
19
|
+
"""Get the if interacts with room climate"""
|
|
20
|
+
return self._device_type_data.get("InteractsWithRoomClimate")
|
|
21
|
+
|
|
22
|
+
@property
|
|
23
|
+
def type(self) -> str:
|
|
24
|
+
"""Get the type of device"""
|
|
25
|
+
return self._device_type_data.get("Type")
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def enable_notification(self) -> str:
|
|
29
|
+
"""Get if notifications is enable"""
|
|
30
|
+
return self._device_type_data.get("EnableNotification")
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def battery(self) -> _WiserBattery:
|
|
34
|
+
"""Get the battery information for the smokealarm"""
|
|
35
|
+
return _WiserBattery(self._data)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class _WiserWindowDoorSensor(_WiserBinarySensor):
|
|
39
|
+
"""Class representing a Wiser WindowDoor Sensor"""
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class _WiserBinarySensorCollection:
|
|
43
|
+
"""Class holding all Wiser Binary Sensors"""
|
|
44
|
+
|
|
45
|
+
def __init__(self):
|
|
46
|
+
self._items = []
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def all(self) -> list[_WiserBinarySensor]:
|
|
50
|
+
return list(self._items)
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def count(self) -> int:
|
|
54
|
+
return len(self.all)
|
|
55
|
+
|
|
56
|
+
def get_by_id(self, id: int) -> _WiserBinarySensor:
|
|
57
|
+
"""
|
|
58
|
+
Gets a binarysensor object from the binary sensor id
|
|
59
|
+
param id: id of binary sensor
|
|
60
|
+
return: _WiserBinarySensor object
|
|
61
|
+
"""
|
|
62
|
+
try:
|
|
63
|
+
return [binarysensor for binarysensor in self.all if binarysensor.id == id][
|
|
64
|
+
0
|
|
65
|
+
]
|
|
66
|
+
except IndexError:
|
|
67
|
+
return None
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from .helpers.device import _WiserDevice
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class _WiserBoilerInterface(_WiserDevice):
|
|
5
|
+
"""Class representing a Wiser Boiler Interface"""
|
|
6
|
+
|
|
7
|
+
@property
|
|
8
|
+
def heating_channel_ids(self) -> list[int]:
|
|
9
|
+
"""Heating channel ids."""
|
|
10
|
+
return self._device_type_data.get("HeatingChannelIds")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class _WiserBoilerInterfaceCollection:
|
|
14
|
+
"""Class holding all Wiser Boiler Interfaces"""
|
|
15
|
+
|
|
16
|
+
def __init__(self):
|
|
17
|
+
self._items = []
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def all(self) -> list[_WiserBoilerInterface]:
|
|
21
|
+
return list(self._items)
|
|
22
|
+
|
|
23
|
+
@property
|
|
24
|
+
def count(self) -> int:
|
|
25
|
+
return len(self.all)
|
|
26
|
+
|
|
27
|
+
def get_by_id(self, id: int) -> _WiserBoilerInterface:
|
|
28
|
+
"""
|
|
29
|
+
Gets a boiler interface object from the binary sensor id
|
|
30
|
+
param id: id of boiler interface
|
|
31
|
+
return: _WiserBoilerInterface object
|
|
32
|
+
"""
|
|
33
|
+
try:
|
|
34
|
+
return [
|
|
35
|
+
boilerinterface
|
|
36
|
+
for boilerinterface in self.all
|
|
37
|
+
if boilerinterface.id == id
|
|
38
|
+
][0]
|
|
39
|
+
except IndexError:
|
|
40
|
+
return None
|
|
File without changes
|
|
@@ -60,6 +60,17 @@ TEXT_WEEKDAYS = "Weekdays"
|
|
|
60
60
|
TEXT_WEEKENDS = "Weekends"
|
|
61
61
|
TEXT_ALL = "All"
|
|
62
62
|
TEXT_UNABLE = "Unable"
|
|
63
|
+
# added by Lgo44
|
|
64
|
+
|
|
65
|
+
TEXT_REVERSE = "ReverseWithLoad"
|
|
66
|
+
TEXT_CONSISTENT = "ConsistentWithLoad"
|
|
67
|
+
TEXT_ALWAYSON = "AlwaysOn"
|
|
68
|
+
TEXT_ALWAYSOFF = "AlwaysOff"
|
|
69
|
+
|
|
70
|
+
TEXT_LASTON = "LastOnBrightness"
|
|
71
|
+
TEXT_LEVELPERCENT = "LevelPercent"
|
|
72
|
+
|
|
73
|
+
# End added by Lgo44
|
|
63
74
|
|
|
64
75
|
# Day Value Lists
|
|
65
76
|
WEEKDAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]
|
|
@@ -88,6 +99,8 @@ WISERSHUTTER = "Shutter/{}"
|
|
|
88
99
|
WISERLIGHT = "Light/{}"
|
|
89
100
|
WISERPOWERTAGENERGY = "PTE/{}"
|
|
90
101
|
WISERSMOKEALARM = "SmokeAlarmDevice/{}"
|
|
102
|
+
WISERBINARYSENSOR = "BinarySensor/{}"
|
|
103
|
+
WISERBOILERINTERFACE = "BoilerInterface/{}"
|
|
91
104
|
|
|
92
105
|
|
|
93
106
|
# Enums
|
|
@@ -116,11 +129,33 @@ class WiserShutterAwayActionEnum(enum.Enum):
|
|
|
116
129
|
nochange = TEXT_NO_CHANGE
|
|
117
130
|
|
|
118
131
|
|
|
132
|
+
# added by Lgo44
|
|
133
|
+
class WiserLightLedIndicatorEnum(enum.Enum):
|
|
134
|
+
reverse = TEXT_REVERSE
|
|
135
|
+
consistent = TEXT_CONSISTENT
|
|
136
|
+
allwayson = TEXT_ALWAYSON
|
|
137
|
+
allwaysoff = TEXT_ALWAYSOFF
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class WiserLightPowerOnBehaviourEnum(enum.Enum):
|
|
141
|
+
last = TEXT_LASTON
|
|
142
|
+
levelpercent = TEXT_LEVELPERCENT
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# End added by Lgo44
|
|
146
|
+
|
|
147
|
+
|
|
119
148
|
class WiserDeviceModeEnum(enum.Enum):
|
|
120
149
|
auto = TEXT_AUTO
|
|
121
150
|
manual = TEXT_MANUAL
|
|
122
151
|
|
|
123
152
|
|
|
153
|
+
class WiserHotWaterClimateModeEnum(enum.Enum):
|
|
154
|
+
auto = TEXT_AUTO
|
|
155
|
+
manual = TEXT_MANUAL
|
|
156
|
+
off = TEXT_OFF
|
|
157
|
+
|
|
158
|
+
|
|
124
159
|
class WiserHeatingModeEnum(enum.Enum):
|
|
125
160
|
off = TEXT_OFF
|
|
126
161
|
auto = TEXT_AUTO
|
|
@@ -4,8 +4,15 @@ Module to manage all devices
|
|
|
4
4
|
|
|
5
5
|
import enum
|
|
6
6
|
|
|
7
|
+
from .binary_sensor import (
|
|
8
|
+
_WiserBinarySensorCollection,
|
|
9
|
+
_WiserWindowDoorSensor,
|
|
10
|
+
)
|
|
11
|
+
from .boiler_interface import _WiserBoilerInterface, _WiserBoilerInterfaceCollection
|
|
7
12
|
from .const import (
|
|
8
13
|
TEXT_UNKNOWN,
|
|
14
|
+
WISERBINARYSENSOR,
|
|
15
|
+
WISERBOILERINTERFACE,
|
|
9
16
|
WISERHEATINGACTUATOR,
|
|
10
17
|
WISERLIGHT,
|
|
11
18
|
WISERPOWERTAGENERGY,
|
|
@@ -20,6 +27,7 @@ from .heating_actuator import (
|
|
|
20
27
|
_WiserHeatingActuator,
|
|
21
28
|
_WiserHeatingActuatorCollection,
|
|
22
29
|
)
|
|
30
|
+
from .helpers.device import _WiserDevice
|
|
23
31
|
from .light import _WiserDimmableLight, _WiserLight, _WiserLightCollection
|
|
24
32
|
from .pte import _WiserPowerTagEnergy, _WiserPowerTagEnergyCollection
|
|
25
33
|
from .rest_controller import _WiserRestController
|
|
@@ -43,6 +51,8 @@ class _WiserDeviceTypeEnum(enum.Enum):
|
|
|
43
51
|
DimmableLight = "Light"
|
|
44
52
|
PowerTagE = "PTE"
|
|
45
53
|
SmokeAlarmDevice = "SmokeAlarmDevice"
|
|
54
|
+
WindowDoorSensor = "BinarySensor"
|
|
55
|
+
BoilerInterface = "BoilerInterface"
|
|
46
56
|
|
|
47
57
|
|
|
48
58
|
PRODUCT_TYPE_CONFIG = {
|
|
@@ -112,6 +122,18 @@ PRODUCT_TYPE_CONFIG = {
|
|
|
112
122
|
"endpoint": WISERSMOKEALARM,
|
|
113
123
|
"device_id_field": "DeviceId",
|
|
114
124
|
},
|
|
125
|
+
"WindowDoorSensor": {
|
|
126
|
+
"class": _WiserWindowDoorSensor,
|
|
127
|
+
"collection": _WiserBinarySensorCollection,
|
|
128
|
+
"endpoint": WISERBINARYSENSOR,
|
|
129
|
+
"device_id_field": "DeviceId",
|
|
130
|
+
},
|
|
131
|
+
"BoilerInterface": {
|
|
132
|
+
"class": _WiserBoilerInterface,
|
|
133
|
+
"collection": _WiserBoilerInterfaceCollection,
|
|
134
|
+
"endpoint": WISERBOILERINTERFACE,
|
|
135
|
+
"device_id_field": "DeviceId",
|
|
136
|
+
},
|
|
115
137
|
}
|
|
116
138
|
|
|
117
139
|
|
|
@@ -127,9 +149,7 @@ class _WiserDeviceCollection:
|
|
|
127
149
|
self._wiser_rest_controller = wiser_rest_controller
|
|
128
150
|
self._device_data = domain_data.get("Device", {})
|
|
129
151
|
self._domain_data = domain_data
|
|
130
|
-
self._equipment_data = domain_data.get(
|
|
131
|
-
"Equipment", {}
|
|
132
|
-
) # Supported by v2 hub
|
|
152
|
+
self._equipment_data = domain_data.get("Equipment", {}) # Supported by v2 hub
|
|
133
153
|
self._schedules = schedules
|
|
134
154
|
self._device_collection = {}
|
|
135
155
|
|
|
@@ -153,9 +173,9 @@ class _WiserDeviceCollection:
|
|
|
153
173
|
device_type.value not in self._device_collection
|
|
154
174
|
and device_type.name in PRODUCT_TYPE_CONFIG
|
|
155
175
|
):
|
|
156
|
-
self._device_collection[
|
|
157
|
-
device_type.
|
|
158
|
-
]
|
|
176
|
+
self._device_collection[device_type.value] = PRODUCT_TYPE_CONFIG[
|
|
177
|
+
device_type.name
|
|
178
|
+
].get("collection")()
|
|
159
179
|
|
|
160
180
|
# Iterate device data for all known device types
|
|
161
181
|
if self._device_data:
|
|
@@ -168,22 +188,16 @@ class _WiserDeviceCollection:
|
|
|
168
188
|
for device_info in self._domain_data.get(
|
|
169
189
|
_WiserDeviceTypeEnum[device_type].value
|
|
170
190
|
)
|
|
171
|
-
if device_info.get(
|
|
172
|
-
device_config.get("device_id_field", "id")
|
|
173
|
-
)
|
|
191
|
+
if device_info.get(device_config.get("device_id_field", "id"))
|
|
174
192
|
== device.get("id")
|
|
175
193
|
]
|
|
176
194
|
|
|
177
195
|
# Get class to create and collection to append for device
|
|
178
|
-
device_class = PRODUCT_TYPE_CONFIG[device_type].get(
|
|
179
|
-
"class"
|
|
180
|
-
)
|
|
196
|
+
device_class = PRODUCT_TYPE_CONFIG[device_type].get("class")
|
|
181
197
|
|
|
182
198
|
# If heating device add room id
|
|
183
199
|
if device_config.get("heating"):
|
|
184
|
-
device_info[0][
|
|
185
|
-
"RoomId"
|
|
186
|
-
] = self._get_temp_device_room_id(
|
|
200
|
+
device_info[0]["RoomId"] = self._get_temp_device_room_id(
|
|
187
201
|
self._domain_data, device.get("id")
|
|
188
202
|
)
|
|
189
203
|
|
|
@@ -201,9 +215,7 @@ class _WiserDeviceCollection:
|
|
|
201
215
|
|
|
202
216
|
# If has equipment entry, add equipment to device info data
|
|
203
217
|
if device_config.get("has_v2_equipment"):
|
|
204
|
-
device_info[0][
|
|
205
|
-
"EquipmentData"
|
|
206
|
-
] = self._get_equipment_data(
|
|
218
|
+
device_info[0]["EquipmentData"] = self._get_equipment_data(
|
|
207
219
|
device_info[0].get("EquipmentId")
|
|
208
220
|
)
|
|
209
221
|
|
|
@@ -220,9 +232,7 @@ class _WiserDeviceCollection:
|
|
|
220
232
|
)
|
|
221
233
|
)
|
|
222
234
|
|
|
223
|
-
def _get_temp_device_room_id(
|
|
224
|
-
self, domain_data: dict, device_id: int
|
|
225
|
-
) -> int:
|
|
235
|
+
def _get_temp_device_room_id(self, domain_data: dict, device_id: int) -> int:
|
|
226
236
|
rooms = domain_data.get("Room")
|
|
227
237
|
for room in rooms:
|
|
228
238
|
room_device_list = []
|
|
@@ -235,7 +245,7 @@ class _WiserDeviceCollection:
|
|
|
235
245
|
return 0
|
|
236
246
|
|
|
237
247
|
@property
|
|
238
|
-
def all(self):
|
|
248
|
+
def all(self) -> list[_WiserDevice]:
|
|
239
249
|
"""Return all devices"""
|
|
240
250
|
items = []
|
|
241
251
|
for key in self._device_collection:
|
|
@@ -248,51 +258,56 @@ class _WiserDeviceCollection:
|
|
|
248
258
|
return len(self.all)
|
|
249
259
|
|
|
250
260
|
@property
|
|
251
|
-
def heating_actuators(self):
|
|
261
|
+
def heating_actuators(self) -> _WiserHeatingActuatorCollection:
|
|
252
262
|
"""Return all heating actuators"""
|
|
253
263
|
return self._device_collection["HeatingActuator"]
|
|
254
264
|
|
|
255
265
|
@property
|
|
256
|
-
def lights(self):
|
|
266
|
+
def lights(self) -> _WiserLightCollection:
|
|
257
267
|
"""Return all lights"""
|
|
258
268
|
return self._device_collection["Light"]
|
|
259
269
|
|
|
260
270
|
@property
|
|
261
|
-
def power_tags(self):
|
|
271
|
+
def power_tags(self) -> _WiserPowerTagEnergyCollection:
|
|
262
272
|
"""Return all power tags"""
|
|
263
273
|
return self._device_collection["PTE"]
|
|
264
274
|
|
|
265
275
|
@property
|
|
266
|
-
def roomstats(self):
|
|
276
|
+
def roomstats(self) -> _WiserRoomStatCollection:
|
|
267
277
|
"""Return all roomstats"""
|
|
268
278
|
return self._device_collection["RoomStat"]
|
|
269
279
|
|
|
270
280
|
@property
|
|
271
|
-
def shutters(self):
|
|
281
|
+
def shutters(self) -> _WiserShutterCollection:
|
|
272
282
|
"""Return all shutters"""
|
|
273
283
|
return self._device_collection["Shutter"]
|
|
274
284
|
|
|
275
285
|
@property
|
|
276
|
-
def smartplugs(self):
|
|
286
|
+
def smartplugs(self) -> _WiserSmartPlugCollection:
|
|
277
287
|
"""Return all smart plugs"""
|
|
278
288
|
return self._device_collection["SmartPlug"]
|
|
279
289
|
|
|
280
290
|
@property
|
|
281
|
-
def smartvalves(self):
|
|
291
|
+
def smartvalves(self) -> _WiserSmartValveCollection:
|
|
282
292
|
"""Return all smart valves (iTRVs)"""
|
|
283
293
|
return self._device_collection["SmartValve"]
|
|
284
294
|
|
|
285
295
|
@property
|
|
286
|
-
def smokealarms(self):
|
|
296
|
+
def smokealarms(self) -> _WiserSmokeAlarmCollection:
|
|
287
297
|
"""Return all smoke alarms"""
|
|
288
298
|
return self._device_collection["SmokeAlarmDevice"]
|
|
289
299
|
|
|
290
300
|
@property
|
|
291
|
-
def ufh_controllers(self):
|
|
301
|
+
def ufh_controllers(self) -> _WiserUFHControllerCollection:
|
|
292
302
|
"""Return all UFH controllers"""
|
|
293
303
|
return self._device_collection["UnderFloorHeating"]
|
|
294
304
|
|
|
295
|
-
|
|
305
|
+
@property
|
|
306
|
+
def binary_sensor(self):
|
|
307
|
+
"""Return all binary sensors"""
|
|
308
|
+
return self._device_collection["BinarySensor"]
|
|
309
|
+
|
|
310
|
+
def get_by_id(self, device_id: int) -> _WiserDevice:
|
|
296
311
|
"""
|
|
297
312
|
Gets a device object from the devices id
|
|
298
313
|
param id: id of device
|
|
@@ -303,7 +318,7 @@ class _WiserDeviceCollection:
|
|
|
303
318
|
except IndexError:
|
|
304
319
|
return None
|
|
305
320
|
|
|
306
|
-
def get_by_room_id(self, room_id: int) -> list:
|
|
321
|
+
def get_by_room_id(self, room_id: int) -> list[_WiserDevice]:
|
|
307
322
|
"""
|
|
308
323
|
Gets a list of devices belonging to the room id
|
|
309
324
|
param room_id: the id of the room
|
|
@@ -314,20 +329,18 @@ class _WiserDeviceCollection:
|
|
|
314
329
|
except IndexError:
|
|
315
330
|
return None
|
|
316
331
|
|
|
317
|
-
def get_by_node_id(self, node_id: int):
|
|
332
|
+
def get_by_node_id(self, node_id: int) -> _WiserDevice:
|
|
318
333
|
"""
|
|
319
334
|
Gets a device object from the devices zigbee node id
|
|
320
335
|
param node_id: zigbee node id of device
|
|
321
336
|
return: Device type class
|
|
322
337
|
"""
|
|
323
338
|
try:
|
|
324
|
-
return [
|
|
325
|
-
device for device in self.all if device.node_id == node_id
|
|
326
|
-
][0]
|
|
339
|
+
return [device for device in self.all if device.node_id == node_id][0]
|
|
327
340
|
except IndexError:
|
|
328
341
|
return None
|
|
329
342
|
|
|
330
|
-
def get_by_serial_number(self, serial_number: str):
|
|
343
|
+
def get_by_serial_number(self, serial_number: str) -> _WiserDevice:
|
|
331
344
|
"""
|
|
332
345
|
Gets a device object from the devices serial number
|
|
333
346
|
param node_id: serial number of device
|
|
@@ -335,24 +348,18 @@ class _WiserDeviceCollection:
|
|
|
335
348
|
"""
|
|
336
349
|
try:
|
|
337
350
|
return [
|
|
338
|
-
device
|
|
339
|
-
for device in self.all
|
|
340
|
-
if device.serial_number == serial_number
|
|
351
|
+
device for device in self.all if device.serial_number == serial_number
|
|
341
352
|
][0]
|
|
342
353
|
except IndexError:
|
|
343
354
|
return None
|
|
344
355
|
|
|
345
|
-
def get_by_parent_node_id(self, node_id: int) -> list:
|
|
356
|
+
def get_by_parent_node_id(self, node_id: int) -> list[_WiserDevice]:
|
|
346
357
|
"""
|
|
347
358
|
Gets a list of device from the devices zigbee parent node id
|
|
348
359
|
param node_id: zigbee parent node id of device
|
|
349
360
|
return: Device type class
|
|
350
361
|
"""
|
|
351
362
|
try:
|
|
352
|
-
return [
|
|
353
|
-
device
|
|
354
|
-
for device in self.all
|
|
355
|
-
if device.parent_node_id == node_id
|
|
356
|
-
]
|
|
363
|
+
return [device for device in self.all if device.parent_node_id == node_id]
|
|
357
364
|
except IndexError:
|
|
358
365
|
return None
|
|
File without changes
|
|
File without changes
|
|
@@ -60,36 +60,36 @@ class _WiserHeatingChannelCollection(object):
|
|
|
60
60
|
self._heating_channels.append(_WiserHeatingChannel(heat_channel))
|
|
61
61
|
|
|
62
62
|
@property
|
|
63
|
-
def all(self):
|
|
63
|
+
def all(self) -> list[_WiserHeatingChannel]:
|
|
64
64
|
return list(self._heating_channels)
|
|
65
65
|
|
|
66
66
|
@property
|
|
67
67
|
def count(self) -> int:
|
|
68
68
|
return len(self.all)
|
|
69
69
|
|
|
70
|
-
def get_by_id(self,
|
|
70
|
+
def get_by_id(self, channel_id: int) -> _WiserHeatingChannel:
|
|
71
71
|
"""
|
|
72
72
|
Gets a Heating Channel object from the Heating Channels id
|
|
73
73
|
param id: id of heating channel
|
|
74
74
|
return: _WiserHeatingChannel object
|
|
75
75
|
"""
|
|
76
76
|
for heating_channel in self.all:
|
|
77
|
-
if
|
|
77
|
+
if channel_id == heating_channel.id:
|
|
78
78
|
return heating_channel
|
|
79
79
|
return None
|
|
80
80
|
|
|
81
|
-
def get_by_room_id(self,
|
|
81
|
+
def get_by_room_id(self, room_id: int) -> _WiserHeatingChannel:
|
|
82
82
|
"""
|
|
83
83
|
Gets a Heating Channel object from a Room ID
|
|
84
84
|
param id: id of the room
|
|
85
85
|
return: _WiserHeatingChannel object
|
|
86
86
|
"""
|
|
87
87
|
for heating_channel in self.all:
|
|
88
|
-
if
|
|
88
|
+
if room_id in heating_channel.room_ids:
|
|
89
89
|
return heating_channel
|
|
90
90
|
return None
|
|
91
91
|
|
|
92
|
-
def get_by_room_name(self, room_name: str):
|
|
92
|
+
def get_by_room_name(self, room_name: str) -> _WiserHeatingChannel:
|
|
93
93
|
"""
|
|
94
94
|
Gets a Heating Channel object from a Room Name
|
|
95
95
|
param id: name of the room
|