Skip to content

Commit 8addbd4

Browse files
authored
Merge pull request #489 from plugwise/line-upfixtures
Implement fixture-changes from pw-beta, fix depreciation-warnings
2 parents 11c0781 + ff3b660 commit 8addbd4

File tree

5 files changed

+18
-60
lines changed

5 files changed

+18
-60
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Ongoing
4+
5+
- Update test-fixtures for Plugwise-beta/Core Plugwise.
6+
- Fix deprecation-warnings.
7+
38
## v0.36.1
49

510
- New Feature: For Adam, implement limited access to the gateway-modes.

fixtures/m_adam_heating/all_data.json

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
11
{
22
"devices": {
3-
"01234567890abcdefghijklmnopqrstu": {
4-
"available": false,
5-
"dev_class": "thermo_sensor",
6-
"firmware": "2020-11-04T01:00:00+01:00",
7-
"hardware": "1",
8-
"location": "f871b8c4d63549319221e294e4f88074",
9-
"model": "Tom/Floor",
10-
"name": "Tom Badkamer",
11-
"sensors": {
12-
"battery": 99,
13-
"temperature": 18.6,
14-
"temperature_difference": 2.3,
15-
"valve_position": 0.0
16-
},
17-
"temperature_offset": {
18-
"lower_bound": -2.0,
19-
"resolution": 0.1,
20-
"setpoint": 0.1,
21-
"upper_bound": 2.0
22-
},
23-
"vendor": "Plugwise",
24-
"zigbee_mac_address": "ABCD012345670A01"
25-
},
263
"056ee145a816487eaa69243c3280f8bf": {
274
"available": true,
285
"binary_sensors": {
@@ -139,7 +116,7 @@
139116
"Weekschema",
140117
"off"
141118
],
142-
"control_state": "preheating",
119+
"control_state": "off",
143120
"dev_class": "zone_thermostat",
144121
"firmware": "2016-10-10T02:00:00+02:00",
145122
"hardware": "255",

plugwise/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,12 @@ async def _smile_detect_legacy(
406406
"""Helper-function for _smile_detect()."""
407407
return_model = model
408408
# Stretch: find the MAC of the zigbee master_controller (= Stick)
409-
if network := result.find("./module/protocols/master_controller"):
409+
if (network := result.find("./module/protocols/master_controller")) is not None:
410410
self.smile_zigbee_mac_address = network.find("mac_address").text
411411
# Find the active MAC in case there is an orphaned Stick
412412
if zb_networks := result.findall("./network"):
413413
for zb_network in zb_networks:
414-
if zb_network.find("./nodes/network_router"):
414+
if zb_network.find("./nodes/network_router") is not None:
415415
network = zb_network.find("./master_controller")
416416
self.smile_zigbee_mac_address = network.find("mac_address").text
417417

plugwise/helper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,14 @@ def _get_module_data(
349349
model_data["hardware_version"] = module.find("hardware_version").text
350350
model_data["firmware_version"] = module.find("firmware_version").text
351351
# Adam
352-
if zb_node := module.find("./protocols/zig_bee_node"):
352+
if (zb_node := module.find("./protocols/zig_bee_node")) is not None:
353353
model_data["zigbee_mac_address"] = zb_node.find("mac_address").text
354354
model_data["reachable"] = zb_node.find("reachable").text == "true"
355355
# Stretches
356-
if router := module.find("./protocols/network_router"):
356+
if (router := module.find("./protocols/network_router")) is not None:
357357
model_data["zigbee_mac_address"] = router.find("mac_address").text
358358
# Also look for the Circle+/Stealth M+
359-
if coord := module.find("./protocols/network_coordinator"):
359+
if (coord := module.find("./protocols/network_coordinator")) is not None:
360360
model_data["zigbee_mac_address"] = coord.find("mac_address").text
361361

362362
return model_data
@@ -420,7 +420,7 @@ def _appliance_info_finder(self, appliance: etree, appl: Munch) -> Munch:
420420

421421
# Adam: look for the ZigBee MAC address of the Smile
422422
if self.smile(ADAM) and (
423-
found := self._modules.find(".//protocols/zig_bee_coordinator")
423+
(found := self._modules.find(".//protocols/zig_bee_coordinator")) is not None
424424
):
425425
appl.zigbee_mac = found.find("mac_address").text
426426

@@ -1490,7 +1490,7 @@ def _schedules(self, location: str) -> tuple[list[str], str]:
14901490
name = self._domain_objects.find(f'./rule[@id="{rule_id}"]/name').text
14911491
locator = f'./rule[@id="{rule_id}"]/directives'
14921492
# Show an empty schedule as no schedule found
1493-
if not self._domain_objects.find(locator):
1493+
if self._domain_objects.find(locator) is None:
14941494
continue # pragma: no cover
14951495

14961496
available.append(name)

scripts/manual_fixtures.py

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ def json_writer(
188188
m_adam_heating["devices"]["ad4838d7d35c4d6ea796ee12ae5aedf8"][
189189
"control_state"
190190
] = "preheating"
191+
191192
m_adam_heating["devices"]["ad4838d7d35c4d6ea796ee12ae5aedf8"]["mode"] = "heat"
192193

193194
# Back at ad48
@@ -208,6 +209,10 @@ def json_writer(
208209
"setpoint"
209210
] = 15.0
210211

212+
m_adam_heating["devices"]["e2f4322d57924fa090fbbc48b3a140dc"][
213+
"control_state"
214+
] = "off"
215+
211216
m_adam_heating["devices"]["e2f4322d57924fa090fbbc48b3a140dc"]["sensors"][
212217
"setpoint"
213218
] = 15.0
@@ -246,35 +251,6 @@ def json_writer(
246251
"resolution": 0.01,
247252
}
248253

249-
# Add a non-existing device for testing device-removal
250-
m_adam_heating["devices"].update(
251-
{
252-
"01234567890abcdefghijklmnopqrstu": {
253-
"available": False,
254-
"dev_class": "thermo_sensor",
255-
"firmware": "2020-11-04T01:00:00+01:00",
256-
"hardware": "1",
257-
"location": "f871b8c4d63549319221e294e4f88074",
258-
"model": "Tom/Floor",
259-
"name": "Tom Badkamer",
260-
"sensors": {
261-
"battery": 99,
262-
"temperature": 18.6,
263-
"temperature_difference": 2.3,
264-
"valve_position": 0.0,
265-
},
266-
"temperature_offset": {
267-
"lower_bound": -2.0,
268-
"resolution": 0.1,
269-
"setpoint": 0.1,
270-
"upper_bound": 2.0,
271-
},
272-
"vendor": "Plugwise",
273-
"zigbee_mac_address": "ABCD012345670A01",
274-
}
275-
}
276-
)
277-
278254
json_writer("m_adam_heating", m_adam_heating, m_adam_cooling_device_list, base_n)
279255

280256
### ANNA

0 commit comments

Comments
 (0)