Skip to content

Commit be8ede1

Browse files
authored
Merge pull request #144 from plugwise/hide_cooling
Show cooling_state only when cooling is present
2 parents d73911b + 488b2aa commit be8ede1

File tree

4 files changed

+20
-46
lines changed

4 files changed

+20
-46
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.16.6 - Smile
4+
- Provide cooling_state and heating_state as `binary_sensors`, show cooling_state only when cooling is present
5+
- Clean up gw_data, e.g. remove `single_master_thermostat` key
6+
37
# v0.16.5 - Smile: small improvements
48
- Move schedule debug-message to the correct position
59
- Code quality fixes

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.16.5"
3+
__version__ = "0.16.6a0"
44

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

plugwise/smile.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ def get_all_devices(self) -> None:
105105
# Collect data for each device via helper function
106106
self._all_device_data()
107107

108+
# Don't show cooling_state when no cooling present
109+
for _, device in self.gw_devices.items():
110+
if (
111+
not self._cooling_present
112+
and "binary_sensors" in device
113+
and "cooling_state" in device["binary_sensors"]
114+
):
115+
device["binary_sensors"].pop("cooling_state")
116+
108117
def _device_data_switching_group(
109118
self, details: dict[str, Any], device_data: dict[str, Any]
110119
) -> dict[str, bool]:
@@ -209,7 +218,7 @@ def _get_device_data(self, dev_id: str) -> dict[str, Any]:
209218

210219
# Adam: indicate active heating/cooling operation-mode
211220
# Actual ongoing heating/cooling is shown via heating_state/cooling_state
212-
if details["class"] == "heater_central":
221+
if details["class"] == "heater_central" and self._cooling_present:
213222
device_data["cooling_active"] = self.cooling_active
214223

215224
# Switching groups data
@@ -482,7 +491,11 @@ async def async_update(self) -> dict[str, Any]:
482491
)
483492

484493
# Anna: update cooling_active to it's final value after all entities have been updated
485-
if not self._smile_legacy and self.smile_name == "Anna":
494+
if (
495+
not self._smile_legacy
496+
and self.smile_name == "Anna"
497+
and self._cooling_present
498+
):
486499
self.gw_devices[self._heater_id]["cooling_active"] = self.cooling_active
487500

488501
return [self.gw_data, self.gw_devices]

tests/test_smile.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ async def test_connect_legacy_anna(self):
610610
"model": "4.21",
611611
"name": "OpenTherm",
612612
"vendor": "Bosch Thermotechniek B.V.",
613-
"cooling_active": False,
614613
"binary_sensors": {"flame_state": True, "heating_state": True},
615614
"sensors": {
616615
"water_temperature": 23.6,
@@ -711,7 +710,6 @@ async def test_connect_legacy_anna_2(self):
711710
"model": "Generic heater",
712711
"name": "OpenTherm",
713712
"vendor": None,
714-
"cooling_active": False,
715713
"binary_sensors": {"flame_state": False, "heating_state": False},
716714
"sensors": {
717715
"water_temperature": 54.0,
@@ -893,7 +891,6 @@ async def test_connect_anna_v4(self):
893891
"model": "2.32",
894892
"name": "OpenTherm",
895893
"vendor": "Bosch Thermotechniek B.V.",
896-
"cooling_active": False,
897894
"binary_sensors": {
898895
"dhw_state": False,
899896
"flame_state": True,
@@ -1105,7 +1102,6 @@ async def test_connect_anna_without_boiler_fw42(self):
11051102
"model": "Unknown",
11061103
"name": "OnOff",
11071104
"vendor": None,
1108-
"cooling_active": False,
11091105
"binary_sensors": {"heating_state": True},
11101106
},
11111107
# Anna
@@ -1384,9 +1380,7 @@ async def test_connect_adam_plus_anna_new(self):
13841380
"model": "Generic heater",
13851381
"name": "OpenTherm",
13861382
"vendor": None,
1387-
"cooling_active": False,
13881383
"binary_sensors": {
1389-
"cooling_state": False,
13901384
"dhw_state": False,
13911385
"flame_state": False,
13921386
"heating_state": True,
@@ -1470,42 +1464,6 @@ async def test_connect_adam_plus_anna_new_copy_dhw_and_heating(self):
14701464
await smile.close_connection()
14711465
await self.disconnect(server, client)
14721466

1473-
@pytest.mark.asyncio
1474-
async def test_connect_adam_plus_anna_new_copy_cooling(self):
1475-
"""Test Adam with Anna and cooling."""
1476-
testdata = {
1477-
# Central
1478-
"2743216f626f43948deec1f7ab3b3d70": {
1479-
"binary_sensors": {"cooling_state": True},
1480-
},
1481-
}
1482-
1483-
self.smile_setup = "adam_plus_anna_new_copy_cooling"
1484-
server, smile, client = await self.connect_wrapper()
1485-
1486-
await self.device_test(smile, testdata)
1487-
1488-
await smile.close_connection()
1489-
await self.disconnect(server, client)
1490-
1491-
@pytest.mark.asyncio
1492-
async def test_connect_adam_plus_anna_new_copy_dhw_and_cooling(self):
1493-
"""Test Adam with Anna and cooling."""
1494-
testdata = {
1495-
# Central
1496-
"2743216f626f43948deec1f7ab3b3d70": {
1497-
"binary_sensors": {"cooling_state": True, "dhw_state": True},
1498-
}
1499-
}
1500-
1501-
self.smile_setup = "adam_plus_anna_new_copy_dhw_and_cooling"
1502-
server, smile, client = await self.connect_wrapper()
1503-
1504-
await self.device_test(smile, testdata)
1505-
1506-
await smile.close_connection()
1507-
await self.disconnect(server, client)
1508-
15091467
@pytest.mark.asyncio
15101468
async def test_connect_adam_zone_per_device(self):
15111469
"""Test a broad setup of Adam with a zone per device setup."""
@@ -1766,7 +1724,6 @@ async def test_connect_adam_multiple_devices_per_zone(self):
17661724
"model": "Unknown",
17671725
"name": "OnOff",
17681726
"vendor": None,
1769-
"cooling_active": False,
17701727
"binary_sensors": {"heating_state": True},
17711728
"sensors": {
17721729
"water_temperature": 70.0,

0 commit comments

Comments
 (0)