plugwise 1.1.0a0__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plugwise/constants.py +2 -2
- plugwise/data.py +9 -10
- plugwise/util.py +1 -1
- {plugwise-1.1.0a0.dist-info → plugwise-1.2.0.dist-info}/METADATA +1 -1
- {plugwise-1.1.0a0.dist-info → plugwise-1.2.0.dist-info}/RECORD +8 -8
- {plugwise-1.1.0a0.dist-info → plugwise-1.2.0.dist-info}/WHEEL +1 -1
- {plugwise-1.1.0a0.dist-info → plugwise-1.2.0.dist-info}/LICENSE +0 -0
- {plugwise-1.1.0a0.dist-info → plugwise-1.2.0.dist-info}/top_level.txt +0 -0
plugwise/constants.py
CHANGED
@@ -258,13 +258,13 @@ ApplianceType = Literal[
|
|
258
258
|
]
|
259
259
|
|
260
260
|
BinarySensorType = Literal[
|
261
|
-
"battery_state",
|
262
261
|
"compressor_state",
|
263
262
|
"cooling_enabled",
|
264
263
|
"cooling_state",
|
265
264
|
"dhw_state",
|
266
265
|
"flame_state",
|
267
266
|
"heating_state",
|
267
|
+
"low_battery",
|
268
268
|
"plugwise_notification",
|
269
269
|
"secondary_boiler_state",
|
270
270
|
]
|
@@ -410,13 +410,13 @@ class ModelData(TypedDict):
|
|
410
410
|
class SmileBinarySensors(TypedDict, total=False):
|
411
411
|
"""Smile Binary Sensors class."""
|
412
412
|
|
413
|
-
battery_state: bool
|
414
413
|
compressor_state: bool
|
415
414
|
cooling_enabled: bool
|
416
415
|
cooling_state: bool
|
417
416
|
dhw_state: bool
|
418
417
|
flame_state: bool
|
419
418
|
heating_state: bool
|
419
|
+
low_battery: bool
|
420
420
|
plugwise_notification: bool
|
421
421
|
secondary_boiler_state: bool
|
422
422
|
|
plugwise/data.py
CHANGED
@@ -62,25 +62,21 @@ class SmileData(SmileHelper):
|
|
62
62
|
self._add_or_update_notifications(device_id, device, data)
|
63
63
|
|
64
64
|
device.update(data)
|
65
|
-
|
66
65
|
is_battery_low = (
|
67
66
|
mac_list
|
68
|
-
and "
|
67
|
+
and "low_battery" in device["binary_sensors"]
|
69
68
|
and device["zigbee_mac_address"] in mac_list
|
70
|
-
and (
|
71
|
-
(device["dev_class"] in ("thermo_sensor", "thermostatic_radiator_valve") and device["sensors"]["battery"] < 30)
|
72
|
-
or (device["dev_class"] in ("zone_thermometer", "zone_thermostat") and device["sensors"]["battery"] < 15)
|
73
|
-
)
|
69
|
+
and device["dev_class"] in ("thermo_sensor", "thermostatic_radiator_valve", "zone_thermometer", "zone_thermostat")
|
74
70
|
)
|
75
71
|
if is_battery_low:
|
76
|
-
device["binary_sensors"]["
|
72
|
+
device["binary_sensors"]["low_battery"] = True
|
77
73
|
|
78
74
|
self._update_for_cooling(device)
|
79
75
|
|
80
76
|
remove_empty_platform_dicts(device)
|
81
77
|
|
82
78
|
def _detect_low_batteries(self) -> list[str]:
|
83
|
-
"""Helper-function updating the
|
79
|
+
"""Helper-function updating the low-battery binary_sensor status from a Battery-is-low message."""
|
84
80
|
mac_address_list: list[str] = []
|
85
81
|
mac_pattern = re.compile(r"(?:[0-9A-F]{2}){8}")
|
86
82
|
matches = ["Battery", "below"]
|
@@ -88,12 +84,15 @@ class SmileData(SmileHelper):
|
|
88
84
|
for msg_id, notification in list(self._notifications.items()):
|
89
85
|
mac_address: str | None = None
|
90
86
|
message: str | None = notification.get("message")
|
91
|
-
|
87
|
+
warning: str | None = notification.get("warning")
|
88
|
+
notify = message or warning
|
89
|
+
if notify is not None and all(x in notify for x in matches) and (mac_addresses := mac_pattern.findall(notify)):
|
92
90
|
mac_address = mac_addresses[0] # re.findall() outputs a list
|
93
91
|
|
94
92
|
if mac_address is not None:
|
95
|
-
self._notifications.pop(msg_id)
|
96
93
|
mac_address_list.append(mac_address)
|
94
|
+
if message is not None: # only block message-type notifications
|
95
|
+
self._notifications.pop(msg_id)
|
97
96
|
|
98
97
|
return mac_address_list
|
99
98
|
|
plugwise/util.py
CHANGED
@@ -139,7 +139,7 @@ def common_match_cases(
|
|
139
139
|
data[sp_key] = value
|
140
140
|
|
141
141
|
if "battery" in data["sensors"]:
|
142
|
-
data["binary_sensors"]["
|
142
|
+
data["binary_sensors"]["low_battery"] = False
|
143
143
|
|
144
144
|
|
145
145
|
def escape_illegal_xml_characters(xmldata: str) -> str:
|
@@ -1,17 +1,17 @@
|
|
1
1
|
plugwise/__init__.py,sha256=EXiTp-N8kQqOUAaczDbULS176NwA2C1FcfWiKkBzNdI,16887
|
2
2
|
plugwise/common.py,sha256=P4sUYzgVcFsIR2DmQxeVeOiZvFZWpZXgwHA3XRc1Sx0,12538
|
3
|
-
plugwise/constants.py,sha256=
|
4
|
-
plugwise/data.py,sha256=
|
3
|
+
plugwise/constants.py,sha256=O2sEAUjoOgvuM5dsS7jzZOMDcy6h8WI1p-od9WzJvQ4,16722
|
4
|
+
plugwise/data.py,sha256=I4w3ABqmcj_uSnfxTWPYQH8WP6HaywVMx1aQ-feBdU0,10734
|
5
5
|
plugwise/exceptions.py,sha256=Ce-tO9uNsMB-8FP6VAxBvsHNJ-NIM9F0onUZOdZI4Ys,1110
|
6
6
|
plugwise/helper.py,sha256=NFcxVtY9qdM2TtBbGs-_eh7xKO6G_M3Q4W9bXUCpH84,43861
|
7
7
|
plugwise/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
plugwise/smile.py,sha256=TyDXl1NSMFxsZehtopawpYpL6vie3NM3gVcez_bfjvA,18681
|
9
|
-
plugwise/util.py,sha256=
|
9
|
+
plugwise/util.py,sha256=NWqL4AnteOeEddXIuMR6mU5IQlcd4ZyUNjV_5sBbquQ,7922
|
10
10
|
plugwise/legacy/data.py,sha256=DsHR9xgiFDg_Vh_6ZpOskw8ZhNQ3CmwjstI3yiH6MEk,3048
|
11
11
|
plugwise/legacy/helper.py,sha256=6-tYQMEXepE5rec-hn6lt2EeknADI3J8UFuBSLgu8dk,17878
|
12
12
|
plugwise/legacy/smile.py,sha256=7oaPZuvxrYRvoA8qWFvtWSwQRFfQl1XXpPjWXn3_xFs,11314
|
13
|
-
plugwise-1.
|
14
|
-
plugwise-1.
|
15
|
-
plugwise-1.
|
16
|
-
plugwise-1.
|
17
|
-
plugwise-1.
|
13
|
+
plugwise-1.2.0.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
|
14
|
+
plugwise-1.2.0.dist-info/METADATA,sha256=Sl9CYKm4nqrl43rNCEjT5UvjQbhNpyqM8qaZRM099BU,9097
|
15
|
+
plugwise-1.2.0.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
16
|
+
plugwise-1.2.0.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
|
17
|
+
plugwise-1.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|