Skip to content

Commit de1892b

Browse files
authored
Merge pull request #900 from plugwise/fix-897
Fix for issue #897
2 parents 2bf56b3 + fa46a82 commit de1892b

File tree

10 files changed

+30
-10
lines changed

10 files changed

+30
-10
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.57.6
6+
7+
- Fix issue #897, partly via plugwise [v1.7.8](https://github.com/plugwise/python-plugwise/releases/tag/v1.7.8)
8+
59
## v0.57.5
610

711
- Bump plugwise to [v1.7.7](https://github.com/plugwise/python-plugwise/releases/tag/v1.7.7) and adapt, small improvements

custom_components/plugwise/climate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def hvac_modes(self) -> list[HVACMode]:
219219
):
220220
hvac_modes.append(HVACMode.OFF)
221221

222-
if AVAILABLE_SCHEDULES in self.device:
222+
if self.device.get(AVAILABLE_SCHEDULES):
223223
hvac_modes.append(HVACMode.AUTO)
224224

225225
if self.coordinator.api.cooling_present:

custom_components/plugwise/manifest.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"integration_type": "hub",
88
"iot_class": "local_polling",
99
"loggers": ["plugwise"],
10-
"requirements": ["plugwise==1.7.7"],
11-
"version": "0.57.5",
10+
"requirements": ["plugwise==1.7.8"
11+
],
12+
"version": "0.57.6",
1213
"zeroconf": ["_plugwise._tcp.local."]
1314
}

custom_components/plugwise/select.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _add_entities() -> None:
9797
for device_id in coordinator.new_devices:
9898
device = coordinator.data[device_id]
9999
for description in SELECT_TYPES:
100-
if description.options_key in device:
100+
if device.get(description.options_key):
101101
entities.append(
102102
PlugwiseSelectEntity(coordinator, device_id, description)
103103
)
@@ -132,7 +132,7 @@ def __init__(
132132
self._location = location
133133

134134
@property
135-
def current_option(self) -> str:
135+
def current_option(self) -> str| None:
136136
"""Return the selected entity option to represent the entity state."""
137137
return self.device[self.entity_description.key]
138138

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.57.5"
3+
version = "0.57.6"
44
description = "Plugwise beta custom-component"
55
readme = "README.md"
66
requires-python = ">=3.13"

tests/components/plugwise/fixtures/legacy_anna/data.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
},
3636
"0d266432d64443e283b5d708ae98b455": {
3737
"active_preset": "home",
38+
"available_schedules": [],
3839
"climate_mode": "heat",
3940
"control_state": "heating",
4041
"dev_class": "thermostat",
@@ -44,6 +45,7 @@
4445
"model": "ThermoTouch",
4546
"name": "Anna",
4647
"preset_modes": ["away", "vacation", "asleep", "home", "no_frost"],
48+
"select_schedule": null,
4749
"sensors": {
4850
"illuminance": 150.8,
4951
"setpoint": 20.5,

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
22
"06aecb3d00354375924f50c47af36bd2": {
33
"active_preset": "no_frost",
4+
"available_schedules": [],
45
"climate_mode": "off",
56
"dev_class": "climate",
67
"model": "ThermoZone",
78
"name": "Slaapkamer",
89
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
10+
"select_schedule": null,
911
"sensors": {
1012
"temperature": 24.2
1113
},
@@ -23,12 +25,14 @@
2325
},
2426
"13228dab8ce04617af318a2888b3c548": {
2527
"active_preset": "home",
28+
"available_schedules": [],
2629
"climate_mode": "heat",
2730
"control_state": "idle",
2831
"dev_class": "climate",
2932
"model": "ThermoZone",
3033
"name": "Woonkamer",
3134
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
35+
"select_schedule": null,
3236
"sensors": {
3337
"temperature": 27.4
3438
},
@@ -236,12 +240,14 @@
236240
},
237241
"d27aede973b54be484f6842d1b2802ad": {
238242
"active_preset": "home",
243+
"available_schedules": [],
239244
"climate_mode": "heat",
240245
"control_state": "idle",
241246
"dev_class": "climate",
242247
"model": "ThermoZone",
243248
"name": "Kinderkamer",
244249
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
250+
"select_schedule": null,
245251
"sensors": {
246252
"temperature": 30.0
247253
},
@@ -283,12 +289,14 @@
283289
},
284290
"d58fec52899f4f1c92e4f8fad6d8c48c": {
285291
"active_preset": "home",
292+
"available_schedules": [],
286293
"climate_mode": "heat",
287294
"control_state": "idle",
288295
"dev_class": "climate",
289296
"model": "ThermoZone",
290297
"name": "Logeerkamer",
291298
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
299+
"select_schedule": null,
292300
"sensors": {
293301
"temperature": 30.0
294302
},

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,14 @@
112112
},
113113
"446ac08dd04d4eff8ac57489757b7314": {
114114
"active_preset": "no_frost",
115+
"available_schedules": [],
115116
"climate_mode": "heat",
116117
"control_state": "idle",
117118
"dev_class": "climate",
118119
"model": "ThermoZone",
119120
"name": "Garage",
120121
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
122+
"select_schedule": null,
121123
"sensors": {
122124
"temperature": 15.6
123125
},
@@ -587,7 +589,6 @@
587589
"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."
588590
}
589591
},
590-
"select_regulation_mode": "heating",
591592
"sensors": {
592593
"outdoor_temperature": 7.81
593594
},

tests/components/plugwise/snapshots/test_diagnostics.ambr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@
131131
}),
132132
'446ac08dd04d4eff8ac57489757b7314': dict({
133133
'active_preset': 'no_frost',
134+
'available_schedules': list([
135+
]),
134136
'climate_mode': 'heat',
135137
'control_state': 'idle',
136138
'dev_class': 'climate',
@@ -143,6 +145,7 @@
143145
'vacation',
144146
'no_frost',
145147
]),
148+
'select_schedule': None,
146149
'sensors': dict({
147150
'temperature': 15.6,
148151
}),
@@ -635,7 +638,6 @@
635638
'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.",
636639
}),
637640
}),
638-
'select_regulation_mode': 'heating',
639641
'sensors': dict({
640642
'outdoor_temperature': 7.81,
641643
}),

tests/components/plugwise/test_climate.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,12 +436,14 @@ async def test_anna_climate_entity_climate_changes(
436436
)
437437

438438
data = mock_smile_anna.async_update.return_value
439-
data["3cb70739631c4d17a86b8b12e8a5161b"].pop("available_schedules")
439+
data["3cb70739631c4d17a86b8b12e8a5161b"]["available_schedules"] = []
440+
data["3cb70739631c4d17a86b8b12e8a5161b"]["select_schedule"] = None
441+
data["3cb70739631c4d17a86b8b12e8a5161b"]["climate_mode"] = "heat_cool"
440442
with patch(HA_PLUGWISE_SMILE_ASYNC_UPDATE, return_value=data):
441443
freezer.tick(timedelta(minutes=1))
442444
async_fire_time_changed(hass)
443445
await hass.async_block_till_done()
444446

445447
state = hass.states.get("climate.anna")
446-
assert state.state == HVACMode.HEAT
448+
assert state.state == HVACMode.HEAT_COOL
447449
assert state.attributes["hvac_modes"] == [HVACMode.HEAT_COOL]

0 commit comments

Comments
 (0)