Skip to content

Commit a00d6a5

Browse files
authored
Merge pull request #184 from plugwise/fix_test
Fix missing Circle +
2 parents f619c26 + 7440ad0 commit a00d6a5

File tree

4 files changed

+67
-4
lines changed

4 files changed

+67
-4
lines changed

CHANGELOG.md

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

3+
# v0.17.8: Smile: Bugfix, improve testing
4+
- Fix https://github.com/plugwise/plugwise-beta/issues/277
5+
- Improve incorrect test-case validation
6+
37
# v0.17.7: Smile: Corrections, fixes, clean up
48
- Move compressor_state into binary_sensors
59
- Adam: add missing zigbee_mac to wireless thermostats

plugwise/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Plugwise module."""
22

3-
__version__ = "0.17.7"
3+
__version__ = "0.17.8"
44

55
from plugwise.smile import Smile
66
from plugwise.stick import Stick

plugwise/helper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,9 @@ def _get_module_data(
446446
# Stretches
447447
if found := module.find("./protocols/network_router"):
448448
model_data["zigbee_mac_address"] = found.find("mac_address").text
449+
# Also look for the Circle+/Stealth M+
450+
if found := module.find("./protocols/network_coordinator"):
451+
model_data["zigbee_mac_address"] = found.find("mac_address").text
449452

450453
return model_data
451454

tests/test_smile.py

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ async def device_test(self, smile=pw_smile.Smile, testdata=None):
401401
asserts = 0
402402
for testdevice, measurements in testdata.items():
403403
tests += 1
404-
asserts += 1
405404
assert testdevice in device_list
405+
asserts += 1
406406
# if testdevice not in device_list:
407407
# _LOGGER.info("Device {} to test against {} not found in device_list for {}".format(testdevice,measurements,self.smile_setup))
408408
# else:
@@ -431,10 +431,9 @@ async def device_test(self, smile=pw_smile.Smile, testdata=None):
431431
if key_1 != key_2:
432432
continue
433433

434-
asserts += 1
435434
assert val_1 == val_2
435+
asserts += 1
436436
else:
437-
asserts += 1
438437
# The schedule temperature changes accordung to the set schedule,
439438
# so the value can differ when testing at different times during the day.
440439
if measure_key == "schedule_temperature":
@@ -443,12 +442,15 @@ async def device_test(self, smile=pw_smile.Smile, testdata=None):
443442
)
444443
if measure_assert is not None:
445444
assert isinstance(dev_data[measure_key], float)
445+
asserts += 1
446446
else: # edge-case: schedule_temperature = None
447447
assert (
448448
dev_data[measure_key] == measure_assert
449449
) # pragma: no cover
450+
asserts += 1
450451
else:
451452
assert dev_data[measure_key] == measure_assert
453+
asserts += 1
452454

453455
assert tests == asserts
454456

@@ -2526,6 +2528,23 @@ async def test_connect_stretch_v31(self):
25262528
"vendor": "Plugwise B.V.",
25272529
"zigbee_mac_address": "ABCD012345670101",
25282530
},
2531+
"e1c884e7dede431dadee09506ec4f859": {
2532+
"class": "refrigerator",
2533+
"fw": "2011-06-27T10:47:37+02:00",
2534+
"hw": "6539-0700-7330",
2535+
"location": "0000aaaa0000aaaa0000aaaa0000aa00",
2536+
"mac_address": None,
2537+
"model": "Circle+ type F",
2538+
"name": "Koelkast (92C4A)",
2539+
"vendor": "Plugwise",
2540+
"zigbee_mac_address": "0123456789AB",
2541+
"sensors": {
2542+
"electricity_consumed": 50.5,
2543+
"electricity_consumed_interval": 0.08,
2544+
"electricity_produced": 0.0,
2545+
},
2546+
"switches": {"relay": True, "lock": False},
2547+
},
25292548
"5871317346d045bc9f6b987ef25ee638": {
25302549
"class": "water_heater_vessel",
25312550
"fw": "2011-06-27T10:52:18+02:00",
@@ -2659,6 +2678,24 @@ async def test_connect_stretch_v23(self):
26592678
"vendor": "Plugwise B.V.",
26602679
"zigbee_mac_address": "ABCD012345670101",
26612680
},
2681+
"24b2ed37c8964c73897db6340a39c129": {
2682+
"class": "router",
2683+
"fw": "2011-06-27T10:47:37+02:00",
2684+
"hw": "6539-0700-7325",
2685+
"location": "0000aaaa0000aaaa0000aaaa0000aa00",
2686+
"mac_address": None,
2687+
"model": "Circle+ type F",
2688+
"name": "MK Netwerk 1A4455E",
2689+
"vendor": "Plugwise",
2690+
"zigbee_mac_address": "0123456789AB",
2691+
"sensors": {
2692+
"electricity_consumed": 4.63,
2693+
"electricity_consumed_interval": 0.65,
2694+
"electricity_produced": 0.0,
2695+
"electricity_produced_interval": 0.0,
2696+
},
2697+
"switches": {"relay": True, "lock": True},
2698+
},
26622699
"09c8ce93d7064fa6a233c0e4c2449bfe": {
26632700
"class": "lamp",
26642701
"fw": "2011-06-27T10:52:18+02:00",
@@ -2968,6 +3005,25 @@ async def test_connect_stretch_v27_no_domain(self):
29683005
"""Test erroneous domain_objects file from user."""
29693006
# testdata dictionary with key ctrl_id_dev_id => keys:values
29703007
testdata = {
3008+
# Circle+
3009+
"9b9bfdb3c7ad4ca5817ccaa235f1e094": {
3010+
"class": "zz_misc",
3011+
"fw": "2011-06-27T10:47:37+02:00",
3012+
"hw": "6539-0700-7326",
3013+
"location": "0000aaaa0000aaaa0000aaaa0000aa00",
3014+
"mac_address": None,
3015+
"model": "Circle+ type F",
3016+
"name": "25881A2",
3017+
"vendor": "Plugwise",
3018+
"zigbee_mac_address": "ABCD012345670A04",
3019+
"sensors": {
3020+
"electricity_consumed": 13.3,
3021+
"electricity_consumed_interval": 7.77,
3022+
"electricity_produced": 0.0,
3023+
"electricity_produced_interval": 0.0,
3024+
},
3025+
"switches": {"relay": True, "lock": True},
3026+
},
29713027
# 76BF93
29723028
"8b8d14b242e24cd789743c828b9a2ea9": {
29733029
"sensors": {"electricity_consumed": 1.69},

0 commit comments

Comments
 (0)