Do not base power switch state on appliance's operation state at Home Connect (#135932)

This commit is contained in:
J. Diego Rodríguez Royo 2025-01-19 20:24:48 +01:00 committed by GitHub
parent 3a078d5414
commit 57294fa461
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 45 deletions

View File

@ -27,7 +27,6 @@ from .const import (
ATTR_VALUE,
BSH_ACTIVE_PROGRAM,
BSH_CHILD_LOCK_STATE,
BSH_OPERATION_STATE,
BSH_POWER_OFF,
BSH_POWER_ON,
BSH_POWER_STANDBY,
@ -403,23 +402,6 @@ class HomeConnectPowerSwitch(HomeConnectEntity, SwitchEntity):
== self.power_off_state
):
self._attr_is_on = False
elif self.device.appliance.status.get(BSH_OPERATION_STATE, {}).get(
ATTR_VALUE, None
) in [
"BSH.Common.EnumType.OperationState.Ready",
"BSH.Common.EnumType.OperationState.DelayedStart",
"BSH.Common.EnumType.OperationState.Run",
"BSH.Common.EnumType.OperationState.Pause",
"BSH.Common.EnumType.OperationState.ActionRequired",
"BSH.Common.EnumType.OperationState.Aborting",
"BSH.Common.EnumType.OperationState.Finished",
]:
self._attr_is_on = True
elif (
self.device.appliance.status.get(BSH_OPERATION_STATE, {}).get(ATTR_VALUE)
== "BSH.Common.EnumType.OperationState.Inactive"
):
self._attr_is_on = False
else:
self._attr_is_on = None
_LOGGER.debug("Updated, new state: %s", self._attr_is_on)

View File

@ -13,7 +13,6 @@ from homeassistant.components.home_connect.const import (
ATTR_CONSTRAINTS,
BSH_ACTIVE_PROGRAM,
BSH_CHILD_LOCK_STATE,
BSH_OPERATION_STATE,
BSH_POWER_OFF,
BSH_POWER_ON,
BSH_POWER_STANDBY,
@ -376,32 +375,6 @@ async def test_ent_desc_switch_exception_handling(
STATE_OFF,
"Dishwasher",
),
(
"switch.dishwasher_power",
{
BSH_POWER_STATE: {"value": ""},
BSH_OPERATION_STATE: {
"value": "BSH.Common.EnumType.OperationState.Run"
},
},
[BSH_POWER_ON],
SERVICE_TURN_ON,
STATE_ON,
"Dishwasher",
),
(
"switch.dishwasher_power",
{
BSH_POWER_STATE: {"value": ""},
BSH_OPERATION_STATE: {
"value": "BSH.Common.EnumType.OperationState.Inactive"
},
},
[BSH_POWER_ON],
SERVICE_TURN_ON,
STATE_OFF,
"Dishwasher",
),
(
"switch.dishwasher_power",
{BSH_POWER_STATE: {"value": BSH_POWER_ON}},