From c4697201660881fb4ffe7d66722d912dd51108cc Mon Sep 17 00:00:00 2001 From: abmantis Date: Thu, 1 May 2025 22:54:04 +0100 Subject: [PATCH] Remove door state from Whirlpool machine state sensor Breaking change: The door state is now reported as a binary sensor instead of being part of the main machine state sensor, which now reports only the cycle states. Users relying on this state in automations or scripts will need to update their configurations to use the new binary sensor. --- homeassistant/components/whirlpool/sensor.py | 5 --- .../components/whirlpool/strings.json | 6 ++-- .../whirlpool/snapshots/test_sensor.ambr | 4 --- tests/components/whirlpool/test_sensor.py | 33 ------------------- 4 files changed, 2 insertions(+), 46 deletions(-) diff --git a/homeassistant/components/whirlpool/sensor.py b/homeassistant/components/whirlpool/sensor.py index 6b052834656..52270c64be8 100644 --- a/homeassistant/components/whirlpool/sensor.py +++ b/homeassistant/components/whirlpool/sensor.py @@ -61,15 +61,11 @@ STATE_CYCLE_SENSING = "cycle_sensing" STATE_CYCLE_SOAKING = "cycle_soaking" STATE_CYCLE_SPINNING = "cycle_spinning" STATE_CYCLE_WASHING = "cycle_washing" -STATE_DOOR_OPEN = "door_open" def washer_dryer_state(washer_dryer: WasherDryer) -> str | None: """Determine correct states for a washer/dryer.""" - if washer_dryer.get_door_open(): - return STATE_DOOR_OPEN - machine_state = washer_dryer.get_machine_state() if machine_state == MachineState.RunningMainCycle: @@ -104,7 +100,6 @@ WASHER_DRYER_STATE_OPTIONS = [ STATE_CYCLE_SOAKING, STATE_CYCLE_SPINNING, STATE_CYCLE_WASHING, - STATE_DOOR_OPEN, ] WASHER_SENSORS: tuple[WhirlpoolSensorEntityDescription, ...] = ( diff --git a/homeassistant/components/whirlpool/strings.json b/homeassistant/components/whirlpool/strings.json index 2a22a2e8e4e..3badc8e5177 100644 --- a/homeassistant/components/whirlpool/strings.json +++ b/homeassistant/components/whirlpool/strings.json @@ -74,8 +74,7 @@ "cycle_sensing": "Cycle sensing", "cycle_soaking": "Cycle soaking", "cycle_spinning": "Cycle spinning", - "cycle_washing": "Cycle washing", - "door_open": "Door open" + "cycle_washing": "Cycle washing" } }, "dryer_state": { @@ -105,8 +104,7 @@ "cycle_sensing": "[%key:component::whirlpool::entity::sensor::washer_state::state::cycle_sensing%]", "cycle_soaking": "[%key:component::whirlpool::entity::sensor::washer_state::state::cycle_soaking%]", "cycle_spinning": "[%key:component::whirlpool::entity::sensor::washer_state::state::cycle_spinning%]", - "cycle_washing": "[%key:component::whirlpool::entity::sensor::washer_state::state::cycle_washing%]", - "door_open": "[%key:component::whirlpool::entity::sensor::washer_state::state::door_open%]" + "cycle_washing": "[%key:component::whirlpool::entity::sensor::washer_state::state::cycle_washing%]" } }, "whirlpool_tank": { diff --git a/tests/components/whirlpool/snapshots/test_sensor.ambr b/tests/components/whirlpool/snapshots/test_sensor.ambr index 6a0465ba8b9..44785311204 100644 --- a/tests/components/whirlpool/snapshots/test_sensor.ambr +++ b/tests/components/whirlpool/snapshots/test_sensor.ambr @@ -80,7 +80,6 @@ 'cycle_soaking', 'cycle_spinning', 'cycle_washing', - 'door_open', ]), }), 'config_entry_id': , @@ -142,7 +141,6 @@ 'cycle_soaking', 'cycle_spinning', 'cycle_washing', - 'door_open', ]), }), 'context': , @@ -297,7 +295,6 @@ 'cycle_soaking', 'cycle_spinning', 'cycle_washing', - 'door_open', ]), }), 'config_entry_id': , @@ -359,7 +356,6 @@ 'cycle_soaking', 'cycle_spinning', 'cycle_washing', - 'door_open', ]), }), 'context': , diff --git a/tests/components/whirlpool/test_sensor.py b/tests/components/whirlpool/test_sensor.py index 9aa88c26123..561b492766a 100644 --- a/tests/components/whirlpool/test_sensor.py +++ b/tests/components/whirlpool/test_sensor.py @@ -256,39 +256,6 @@ async def test_washer_dryer_running_states( assert state.state == expected_state -@pytest.mark.parametrize( - ("entity_id", "mock_fixture"), - [ - ("sensor.washer_state", "mock_washer_api"), - ("sensor.dryer_state", "mock_dryer_api"), - ], -) -async def test_washer_dryer_door_open_state( - hass: HomeAssistant, - entity_id: str, - mock_fixture: str, - request: pytest.FixtureRequest, -) -> None: - """Test Washer/Dryer machine state when door is open.""" - mock_instance = request.getfixturevalue(mock_fixture) - await init_integration(hass) - - state = hass.states.get(entity_id) - assert state.state == "running_maincycle" - - mock_instance.get_door_open.return_value = True - - await trigger_attr_callback(hass, mock_instance) - state = hass.states.get(entity_id) - assert state.state == "door_open" - - mock_instance.get_door_open.return_value = False - - await trigger_attr_callback(hass, mock_instance) - state = hass.states.get(entity_id) - assert state.state == "running_maincycle" - - @pytest.mark.parametrize( ("entity_id", "mock_fixture", "mock_method_name", "values"), [