Bump Plugwise to v1.7.8 preventing rogue KeyError (#149000)

This commit is contained in:
Tom 2025-07-28 17:19:43 +02:00 committed by GitHub
parent d823b574c0
commit 8f795f021c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 19 additions and 8 deletions

View File

@ -165,7 +165,7 @@ class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity):
if "regulation_modes" in self._gateway_data:
hvac_modes.append(HVACMode.OFF)
if "available_schedules" in self.device:
if self.device.get("available_schedules"):
hvac_modes.append(HVACMode.AUTO)
if self.coordinator.api.cooling_present:

View File

@ -8,6 +8,6 @@
"iot_class": "local_polling",
"loggers": ["plugwise"],
"quality_scale": "platinum",
"requirements": ["plugwise==1.7.7"],
"requirements": ["plugwise==1.7.8"],
"zeroconf": ["_plugwise._tcp.local."]
}

View File

@ -70,7 +70,7 @@ async def async_setup_entry(
PlugwiseSelectEntity(coordinator, device_id, description)
for device_id in coordinator.new_devices
for description in SELECT_TYPES
if description.options_key in coordinator.data[device_id]
if coordinator.data[device_id].get(description.options_key)
)
_add_entities()
@ -98,7 +98,7 @@ class PlugwiseSelectEntity(PlugwiseEntity, SelectEntity):
self._location = location
@property
def current_option(self) -> str:
def current_option(self) -> str | None:
"""Return the selected entity option to represent the entity state."""
return self.device[self.entity_description.key]

2
requirements_all.txt generated
View File

@ -1693,7 +1693,7 @@ plexauth==0.0.6
plexwebsocket==0.0.14
# homeassistant.components.plugwise
plugwise==1.7.7
plugwise==1.7.8
# homeassistant.components.plum_lightpad
plumlightpad==0.0.11

View File

@ -1431,7 +1431,7 @@ plexauth==0.0.6
plexwebsocket==0.0.14
# homeassistant.components.plugwise
plugwise==1.7.7
plugwise==1.7.8
# homeassistant.components.plum_lightpad
plumlightpad==0.0.11

View File

@ -1,11 +1,13 @@
{
"06aecb3d00354375924f50c47af36bd2": {
"active_preset": "no_frost",
"available_schedules": [],
"climate_mode": "off",
"dev_class": "climate",
"model": "ThermoZone",
"name": "Slaapkamer",
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
"select_schedule": null,
"sensors": {
"temperature": 24.2
},
@ -23,12 +25,14 @@
},
"13228dab8ce04617af318a2888b3c548": {
"active_preset": "home",
"available_schedules": [],
"climate_mode": "heat",
"control_state": "idle",
"dev_class": "climate",
"model": "ThermoZone",
"name": "Woonkamer",
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
"select_schedule": null,
"sensors": {
"temperature": 27.4
},
@ -236,12 +240,14 @@
},
"d27aede973b54be484f6842d1b2802ad": {
"active_preset": "home",
"available_schedules": [],
"climate_mode": "heat",
"control_state": "idle",
"dev_class": "climate",
"model": "ThermoZone",
"name": "Kinderkamer",
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
"select_schedule": null,
"sensors": {
"temperature": 30.0
},
@ -283,12 +289,14 @@
},
"d58fec52899f4f1c92e4f8fad6d8c48c": {
"active_preset": "home",
"available_schedules": [],
"climate_mode": "heat",
"control_state": "idle",
"dev_class": "climate",
"model": "ThermoZone",
"name": "Logeerkamer",
"preset_modes": ["home", "asleep", "away", "vacation", "no_frost"],
"select_schedule": null,
"sensors": {
"temperature": 30.0
},

View File

@ -433,13 +433,16 @@ async def test_anna_climate_entity_climate_changes(
"c784ee9fdab44e1395b8dee7d7a497d5", HVACMode.OFF
)
# Mock user deleting last schedule from app or browser
data = mock_smile_anna.async_update.return_value
data["3cb70739631c4d17a86b8b12e8a5161b"].pop("available_schedules")
data["3cb70739631c4d17a86b8b12e8a5161b"]["available_schedules"] = []
data["3cb70739631c4d17a86b8b12e8a5161b"]["select_schedule"] = None
data["3cb70739631c4d17a86b8b12e8a5161b"]["climate_mode"] = "heat_cool"
with patch(HA_PLUGWISE_SMILE_ASYNC_UPDATE, return_value=data):
freezer.tick(timedelta(minutes=1))
async_fire_time_changed(hass)
await hass.async_block_till_done()
state = hass.states.get("climate.anna")
assert state.state == HVACMode.HEAT
assert state.state == HVACMode.HEAT_COOL
assert state.attributes[ATTR_HVAC_MODES] == [HVACMode.HEAT_COOL]