Skip to content

Commit 8a8484f

Browse files
authored
Merge pull request #784 from plugwise/pw-v1.6.2
Link to plugwise v1.6.2 and adapt
2 parents 03e007f + 259a737 commit 8a8484f

File tree

9 files changed

+36
-27
lines changed

9 files changed

+36
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Versions from 0.40 and up
44

5+
## v0.55.2
6+
7+
- Link to plugwise [v1.6.2](https://github.com/plugwise/python-plugwise/releases/tag/v1.6.2), implementing Adam `control_state` related improvements.
8+
59
## v0.55.1
610

711
- Bugfix for Issue #776

custom_components/plugwise/climate.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Any, cast
5+
from typing import Any
66

77
from homeassistant.components.climate import (
88
ATTR_HVAC_MODE,
@@ -251,19 +251,16 @@ def hvac_action(self) -> HVACAction: # pw-beta add to Core
251251
self._previous_action_mode(self.coordinator)
252252

253253
# Adam provides the hvac_action for each thermostat
254-
if self._gateway[SMILE_NAME] == "Adam":
255-
if (control_state := self.device.get(CONTROL_STATE)) in (
256-
HVACAction.COOLING, HVACAction.HEATING, HVACAction.PREHEATING
257-
):
258-
return cast(HVACAction, control_state)
254+
if (action := self.device.get(CONTROL_STATE)) is not None:
255+
return HVACAction(action)
256+
259257
# Anna
260-
else:
261-
heater: str = self._gateway["heater_id"]
262-
heater_data = self._devices[heater]
263-
if heater_data[BINARY_SENSORS][HEATING_STATE]:
264-
return HVACAction.HEATING
265-
if heater_data[BINARY_SENSORS].get(COOLING_STATE, False):
266-
return HVACAction.COOLING
258+
heater: str = self._gateway["heater_id"]
259+
heater_data = self._devices[heater]
260+
if heater_data[BINARY_SENSORS][HEATING_STATE]:
261+
return HVACAction.HEATING
262+
if heater_data[BINARY_SENSORS].get(COOLING_STATE, False):
263+
return HVACAction.COOLING
267264

268265
return HVACAction.IDLE
269266

custom_components/plugwise/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"integration_type": "hub",
88
"iot_class": "local_polling",
99
"loggers": ["plugwise"],
10-
"requirements": ["plugwise==1.6.1"],
11-
"version": "0.55.1",
10+
"requirements": ["plugwise==1.6.2"],
11+
"version": "0.55.2",
1212
"zeroconf": ["_plugwise._tcp.local."]
1313
}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "plugwise-beta"
3-
version = "0.55.1"
3+
version = "0.55.2"
44
description = "Plugwise beta custom-component"
55
readme = "README.md"
66
requires-python = ">=3.12"

tests/components/plugwise/fixtures/m_adam_heating/all_data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
"off"
194194
],
195195
"climate_mode": "auto",
196-
"control_state": "off",
196+
"control_state": "idle",
197197
"dev_class": "climate",
198198
"model": "ThermoZone",
199199
"name": "Bathroom",

tests/components/plugwise/fixtures/m_adam_jip/all_data.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"06aecb3d00354375924f50c47af36bd2": {
44
"active_preset": "no_frost",
55
"climate_mode": "off",
6-
"control_state": "off",
6+
"control_state": "idle",
77
"dev_class": "climate",
88
"model": "ThermoZone",
99
"name": "Slaapkamer",
@@ -36,7 +36,7 @@
3636
"13228dab8ce04617af318a2888b3c548": {
3737
"active_preset": "home",
3838
"climate_mode": "heat",
39-
"control_state": "off",
39+
"control_state": "idle",
4040
"dev_class": "climate",
4141
"model": "ThermoZone",
4242
"name": "Woonkamer",
@@ -267,7 +267,7 @@
267267
"d27aede973b54be484f6842d1b2802ad": {
268268
"active_preset": "home",
269269
"climate_mode": "heat",
270-
"control_state": "off",
270+
"control_state": "idle",
271271
"dev_class": "climate",
272272
"model": "ThermoZone",
273273
"name": "Kinderkamer",
@@ -324,7 +324,7 @@
324324
"d58fec52899f4f1c92e4f8fad6d8c48c": {
325325
"active_preset": "home",
326326
"climate_mode": "heat",
327-
"control_state": "off",
327+
"control_state": "idle",
328328
"dev_class": "climate",
329329
"model": "ThermoZone",
330330
"name": "Logeerkamer",

tests/components/plugwise/fixtures/m_adam_multiple_devices_per_zone/all_data.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"off"
3333
],
3434
"climate_mode": "auto",
35+
"control_state": "idle",
3536
"dev_class": "climate",
3637
"model": "ThermoZone",
3738
"name": "Badkamer",
@@ -72,6 +73,7 @@
7273
"off"
7374
],
7475
"climate_mode": "heat",
76+
"control_state": "idle",
7577
"dev_class": "climate",
7678
"model": "ThermoZone",
7779
"name": "Bios",
@@ -128,6 +130,7 @@
128130
"446ac08dd04d4eff8ac57489757b7314": {
129131
"active_preset": "no_frost",
130132
"climate_mode": "heat",
133+
"control_state": "idle",
131134
"dev_class": "climate",
132135
"model": "ThermoZone",
133136
"name": "Garage",
@@ -282,6 +285,7 @@
282285
"off"
283286
],
284287
"climate_mode": "auto",
288+
"control_state": "idle",
285289
"dev_class": "climate",
286290
"model": "ThermoZone",
287291
"name": "Jessie",
@@ -436,6 +440,7 @@
436440
"off"
437441
],
438442
"climate_mode": "auto",
443+
"control_state": "heating",
439444
"dev_class": "climate",
440445
"model": "ThermoZone",
441446
"name": "Woonkamer",
@@ -621,7 +626,7 @@
621626
"cooling_present": false,
622627
"gateway_id": "fe799307f1624099878210aa0b9f1475",
623628
"heater_id": "90986d591dcd426cae3ec3e8111ff730",
624-
"item_count": 364,
629+
"item_count": 369,
625630
"notifications": {
626631
"af82e4ccf9c548528166d38e560662a4": {
627632
"warning": "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device."

tests/components/plugwise/snapshots/test_diagnostics.ambr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
'off',
3535
]),
3636
'climate_mode': 'auto',
37+
'control_state': 'idle',
3738
'dev_class': 'climate',
3839
'model': 'ThermoZone',
3940
'name': 'Badkamer',
@@ -75,6 +76,7 @@
7576
'off',
7677
]),
7778
'climate_mode': 'heat',
79+
'control_state': 'idle',
7880
'dev_class': 'climate',
7981
'model': 'ThermoZone',
8082
'name': 'Bios',
@@ -131,6 +133,7 @@
131133
'446ac08dd04d4eff8ac57489757b7314': dict({
132134
'active_preset': 'no_frost',
133135
'climate_mode': 'heat',
136+
'control_state': 'idle',
134137
'dev_class': 'climate',
135138
'model': 'ThermoZone',
136139
'name': 'Garage',
@@ -286,6 +289,7 @@
286289
'off',
287290
]),
288291
'climate_mode': 'auto',
292+
'control_state': 'idle',
289293
'dev_class': 'climate',
290294
'model': 'ThermoZone',
291295
'name': 'Jessie',
@@ -440,6 +444,7 @@
440444
'off',
441445
]),
442446
'climate_mode': 'auto',
447+
'control_state': 'heating',
443448
'dev_class': 'climate',
444449
'model': 'ThermoZone',
445450
'name': 'Woonkamer',
@@ -625,7 +630,7 @@
625630
'cooling_present': False,
626631
'gateway_id': 'fe799307f1624099878210aa0b9f1475',
627632
'heater_id': '90986d591dcd426cae3ec3e8111ff730',
628-
'item_count': 364,
633+
'item_count': 369,
629634
'notifications': dict({
630635
'af82e4ccf9c548528166d38e560662a4': dict({
631636
'warning': "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device.",

tests/components/plugwise/test_climate.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ async def test_adam_climate_entity_attributes(
3434
state = hass.states.get("climate.woonkamer")
3535
assert state
3636
assert state.state == HVACMode.AUTO
37+
assert state.attributes["hvac_action"] == "heating"
3738
assert state.attributes["hvac_modes"] == [
3839
HVACMode.AUTO,
3940
HVACMode.HEAT,
4041
]
41-
# hvac_action is not asserted as the fixture is not in line with recent firmware functionality
42-
4342
assert "preset_modes" in state.attributes
4443
assert "no_frost" in state.attributes["preset_modes"]
4544
assert "home" in state.attributes["preset_modes"]
@@ -57,12 +56,11 @@ async def test_adam_climate_entity_attributes(
5756
state = hass.states.get("climate.jessie")
5857
assert state
5958
assert state.state == HVACMode.AUTO
59+
assert state.attributes["hvac_action"] == "idle"
6060
assert state.attributes["hvac_modes"] == [
6161
HVACMode.AUTO,
6262
HVACMode.HEAT,
6363
]
64-
# hvac_action is not asserted as the fixture is not in line with recent firmware functionality
65-
6664
assert "preset_modes" in state.attributes
6765
assert "no_frost" in state.attributes["preset_modes"]
6866
assert "home" in state.attributes["preset_modes"]

0 commit comments

Comments
 (0)