Remove door state from Whirlpool machine state sensor (#144078)

This commit is contained in:
Abílio Costa 2025-07-24 19:07:57 +01:00 committed by GitHub
parent 36a98470cc
commit 5c7913c3bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 2 additions and 50 deletions

View File

@ -86,15 +86,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_state(washer: Washer) -> str | None:
"""Determine correct states for a washer."""
if washer.get_door_open():
return STATE_DOOR_OPEN
machine_state = washer.get_machine_state()
if machine_state == WasherMachineState.RunningMainCycle:
@ -117,9 +113,6 @@ def washer_state(washer: Washer) -> str | None:
def dryer_state(dryer: Dryer) -> str | None:
"""Determine correct states for a dryer."""
if dryer.get_door_open():
return STATE_DOOR_OPEN
machine_state = dryer.get_machine_state()
if machine_state == DryerMachineState.RunningMainCycle:
@ -144,13 +137,11 @@ WASHER_STATE_OPTIONS = [
STATE_CYCLE_SOAKING,
STATE_CYCLE_SPINNING,
STATE_CYCLE_WASHING,
STATE_DOOR_OPEN,
]
DRYER_STATE_OPTIONS = [
*DRYER_MACHINE_STATE.values(),
STATE_CYCLE_SENSING,
STATE_DOOR_OPEN,
]
WASHER_SENSORS: tuple[WhirlpoolSensorEntityDescription, ...] = (

View File

@ -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": {

View File

@ -77,7 +77,6 @@
'system_initialize',
'cancelled',
'cycle_sensing',
'door_open',
]),
}),
'config_entry_id': <ANY>,
@ -136,7 +135,6 @@
'system_initialize',
'cancelled',
'cycle_sensing',
'door_open',
]),
}),
'context': <ANY>,
@ -293,7 +291,6 @@
'cycle_soaking',
'cycle_spinning',
'cycle_washing',
'door_open',
]),
}),
'config_entry_id': <ANY>,
@ -356,7 +353,6 @@
'cycle_soaking',
'cycle_spinning',
'cycle_washing',
'door_open',
]),
}),
'context': <ANY>,

View File

@ -296,39 +296,6 @@ async def test_washer_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"),
[