Skip to content

Commit 6eb63c9

Browse files
authored
Merge pull request #88 from plugwise/fix_#87
Implement support for the Plugwise Jip
2 parents aa56f93 + b8016a5 commit 6eb63c9

File tree

10 files changed

+6552
-3
lines changed

10 files changed

+6552
-3
lines changed

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.10.0"
3+
__version__ = "0.11.0"
44

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

plugwise/constants.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
"120006": "Sense Legrand",
203203
"070051": "Switch",
204204
"080029": "Switch",
205+
"168-01": "Jip",
205206
"160-01": "Plug",
206207
"106-03": "Tom/Floor",
207208
"158-01": "Lisa",
@@ -362,6 +363,7 @@
362363
SWITCH_GROUP_TYPES = ["switching", "report"]
363364
THERMOSTAT_CLASSES = [
364365
"thermostat",
366+
"zone_thermometer",
365367
"zone_thermostat",
366368
"thermostatic_radiator_valve",
367369
]
@@ -404,6 +406,8 @@
404406
"battery": {ATTR_UNIT_OF_MEASUREMENT: PERCENTAGE},
405407
"temperature_difference": {ATTR_UNIT_OF_MEASUREMENT: DEGREE},
406408
"valve_position": {ATTR_UNIT_OF_MEASUREMENT: PERCENTAGE},
409+
# Jip
410+
"humidity": {ATTR_UNIT_OF_MEASUREMENT: PERCENTAGE},
407411
# Plug
408412
"electricity_consumed": {ATTR_UNIT_OF_MEASUREMENT: POWER_WATT},
409413
"electricity_produced": {ATTR_UNIT_OF_MEASUREMENT: POWER_WATT},
@@ -743,6 +747,15 @@
743747
ATTR_ICON: FLAME_ICON,
744748
ATTR_UNIT_OF_MEASUREMENT: VOLUME_CUBIC_METERS,
745749
}
750+
HUMIDITY = {
751+
ATTR_ID: "humidity",
752+
ATTR_ENABLED: True,
753+
ATTR_NAME: "Relative Humidity",
754+
ATTR_STATE: None,
755+
ATTR_DEVICE_CLASS: "humidity",
756+
ATTR_ICON: None,
757+
ATTR_UNIT_OF_MEASUREMENT: PERCENTAGE,
758+
}
746759
ILLUMINANCE = {
747760
ATTR_ID: "illuminance",
748761
ATTR_ENABLED: True,
@@ -873,6 +886,7 @@
873886
EL_PRODUCED_PEAK_POINT,
874887
GAS_CONSUMED_CUMULATIVE,
875888
GAS_CONSUMED_INTERVAL,
889+
HUMIDITY,
876890
ILLUMINANCE,
877891
INTENDED_BOILER_TEMP,
878892
MOD_LEVEL,

plugwise/helper.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,12 @@ def all_appliances(self):
485485
"types": appl.types,
486486
"vendor": appl.v_name,
487487
}
488+
if (
489+
not self._smile_legacy
490+
and appl.pwclass == "thermostat"
491+
and appl.location is None
492+
):
493+
self.appl_data.pop(appl.id)
488494

489495
# For legacy Anna gateway and heater_central is the same device
490496
if self._smile_legacy and self.smile_type == "thermostat":
@@ -701,6 +707,7 @@ def scan_thermostats(self, debug_text="missing text"):
701707

702708
thermo_matching = {
703709
"thermostat": 3,
710+
"zone_thermometer": 2,
704711
"zone_thermostat": 2,
705712
"thermostatic_radiator_valve": 1,
706713
}

plugwise/util.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,9 @@ def format_measure(measure, unit):
9797
try:
9898
measure = int(measure)
9999
except ValueError:
100-
if unit == PERCENTAGE and float(measure) > 0:
101-
return int(float(measure) * 100)
100+
if unit == PERCENTAGE:
101+
if 0 < float(measure) <= 1:
102+
return int(float(measure) * 100)
102103

103104
if unit == ENERGY_KILO_WATT_HOUR:
104105
measure = float(measure) / 1000

tests/test_smile.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,9 @@ async def device_test(self, smile=pw_smile.Smile, testdata=None):
400400
_LOGGER.info("Asserting testdata:")
401401
MASTER_THERMOSTATS = [
402402
"thermostat",
403+
"zone_thermometer",
403404
"zone_thermostat",
405+
"thermostatic_radiator_valve",
404406
]
405407
bsw_lists = ["binary_sensors", "sensors", "switches"]
406408
smile.get_all_devices()
@@ -1470,6 +1472,32 @@ async def test_connect_adam_multiple_devices_per_zone(self):
14701472
await smile.close_connection()
14711473
await self.disconnect(server, client)
14721474

1475+
@pytest.mark.asyncio
1476+
async def test_adam_plus_jip(self):
1477+
"""Test Adam with Jip."""
1478+
testdata = {
1479+
# Woonkamer - Tom
1480+
"833de10f269c4deab58fb9df69901b4e": {
1481+
"sensors": [
1482+
{"id": "valve_position", "state": 100},
1483+
],
1484+
},
1485+
# Woonkamer - Jip
1486+
"f61f1a2535f54f52ad006a3d18e459ca": {
1487+
"sensors": [
1488+
{"id": "humidity", "state": 56.2},
1489+
],
1490+
},
1491+
}
1492+
1493+
self.smile_setup = "adam_jip"
1494+
server, smile, client = await self.connect_wrapper()
1495+
1496+
await self.device_test(smile, testdata)
1497+
1498+
await smile.close_connection()
1499+
await self.disconnect(server, client)
1500+
14731501
@pytest.mark.asyncio
14741502
async def test_connect_p1v3(self):
14751503
"""Test a P1 firmware 3 with only electricity setup."""

0 commit comments

Comments
 (0)