From 57294fa4613c4b5e8b609cd7af7e0d56fbe70134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Diego=20Rodr=C3=ADguez=20Royo?= Date: Sun, 19 Jan 2025 20:24:48 +0100 Subject: [PATCH] Do not base power switch state on appliance's operation state at Home Connect (#135932) --- .../components/home_connect/switch.py | 18 ------------- tests/components/home_connect/test_switch.py | 27 ------------------- 2 files changed, 45 deletions(-) diff --git a/homeassistant/components/home_connect/switch.py b/homeassistant/components/home_connect/switch.py index e1ea4c2b4ce..1bd02e03eb1 100644 --- a/homeassistant/components/home_connect/switch.py +++ b/homeassistant/components/home_connect/switch.py @@ -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) diff --git a/tests/components/home_connect/test_switch.py b/tests/components/home_connect/test_switch.py index a02cb553ece..9d54feeaa54 100644 --- a/tests/components/home_connect/test_switch.py +++ b/tests/components/home_connect/test_switch.py @@ -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}},