From 110627e16e303fd027d6c18661f958fc188d683a Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Tue, 10 Jun 2025 14:52:24 +0200 Subject: [PATCH] Return expected state in SmartThings water heater (#146449) --- .../components/smartthings/strings.json | 9 ----- .../components/smartthings/water_heater.py | 9 +++-- .../snapshots/test_water_heater.ambr | 36 +++++++++---------- .../smartthings/test_water_heater.py | 27 +++++++------- 4 files changed, 39 insertions(+), 42 deletions(-) diff --git a/homeassistant/components/smartthings/strings.json b/homeassistant/components/smartthings/strings.json index 7b5edde2d10..8e972ac8aea 100644 --- a/homeassistant/components/smartthings/strings.json +++ b/homeassistant/components/smartthings/strings.json @@ -619,15 +619,6 @@ "keep_fresh_mode": { "name": "Keep fresh mode" } - }, - "water_heater": { - "water_heater": { - "state": { - "standard": "Standard", - "force": "Forced", - "power": "Power" - } - } } }, "issues": { diff --git a/homeassistant/components/smartthings/water_heater.py b/homeassistant/components/smartthings/water_heater.py index addbfed2ec4..4b1aaaa5549 100644 --- a/homeassistant/components/smartthings/water_heater.py +++ b/homeassistant/components/smartthings/water_heater.py @@ -10,6 +10,9 @@ from homeassistant.components.water_heater import ( DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, STATE_ECO, + STATE_HEAT_PUMP, + STATE_HIGH_DEMAND, + STATE_PERFORMANCE, WaterHeaterEntity, WaterHeaterEntityFeature, ) @@ -24,9 +27,9 @@ from .entity import SmartThingsEntity OPERATION_MAP_TO_HA: dict[str, str] = { "eco": STATE_ECO, - "std": "standard", - "force": "force", - "power": "power", + "std": STATE_HEAT_PUMP, + "force": STATE_HIGH_DEMAND, + "power": STATE_PERFORMANCE, } HA_TO_OPERATION_MAP = {v: k for k, v in OPERATION_MAP_TO_HA.items()} diff --git a/tests/components/smartthings/snapshots/test_water_heater.ambr b/tests/components/smartthings/snapshots/test_water_heater.ambr index 3e5afed3b86..d52400b9de2 100644 --- a/tests/components/smartthings/snapshots/test_water_heater.ambr +++ b/tests/components/smartthings/snapshots/test_water_heater.ambr @@ -10,9 +10,9 @@ 'operation_list': list([ 'off', 'eco', - 'standard', - 'power', - 'force', + 'heat_pump', + 'performance', + 'high_demand', ]), }), 'config_entry_id': , @@ -55,9 +55,9 @@ 'operation_list': list([ 'off', 'eco', - 'standard', - 'power', - 'force', + 'heat_pump', + 'performance', + 'high_demand', ]), 'operation_mode': 'off', 'supported_features': , @@ -84,8 +84,8 @@ 'operation_list': list([ 'off', 'eco', - 'standard', - 'force', + 'heat_pump', + 'high_demand', ]), }), 'config_entry_id': , @@ -128,8 +128,8 @@ 'operation_list': list([ 'off', 'eco', - 'standard', - 'force', + 'heat_pump', + 'high_demand', ]), 'operation_mode': 'off', 'supported_features': , @@ -156,9 +156,9 @@ 'operation_list': list([ 'off', 'eco', - 'standard', - 'power', - 'force', + 'heat_pump', + 'performance', + 'high_demand', ]), }), 'config_entry_id': , @@ -201,11 +201,11 @@ 'operation_list': list([ 'off', 'eco', - 'standard', - 'power', - 'force', + 'heat_pump', + 'performance', + 'high_demand', ]), - 'operation_mode': 'standard', + 'operation_mode': 'heat_pump', 'supported_features': , 'target_temp_high': 57, 'target_temp_low': 40, @@ -216,6 +216,6 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': 'standard', + 'state': 'heat_pump', }) # --- diff --git a/tests/components/smartthings/test_water_heater.py b/tests/components/smartthings/test_water_heater.py index a12280e5c92..30c85539d3a 100644 --- a/tests/components/smartthings/test_water_heater.py +++ b/tests/components/smartthings/test_water_heater.py @@ -20,6 +20,9 @@ from homeassistant.components.water_heater import ( SERVICE_SET_OPERATION_MODE, SERVICE_SET_TEMPERATURE, STATE_ECO, + STATE_HEAT_PUMP, + STATE_HIGH_DEMAND, + STATE_PERFORMANCE, WaterHeaterEntityFeature, ) from homeassistant.const import ( @@ -66,9 +69,9 @@ async def test_all_entities( ("operation_mode", "argument"), [ (STATE_ECO, "eco"), - ("standard", "std"), - ("force", "force"), - ("power", "power"), + (STATE_HEAT_PUMP, "std"), + (STATE_HIGH_DEMAND, "force"), + (STATE_PERFORMANCE, "power"), ], ) async def test_set_operation_mode( @@ -299,9 +302,9 @@ async def test_operation_list_update( ] == [ STATE_OFF, STATE_ECO, - "standard", - "power", - "force", + STATE_HEAT_PUMP, + STATE_PERFORMANCE, + STATE_HIGH_DEMAND, ] await trigger_update( @@ -318,8 +321,8 @@ async def test_operation_list_update( ] == [ STATE_OFF, STATE_ECO, - "force", - "power", + STATE_HIGH_DEMAND, + STATE_PERFORMANCE, ] @@ -332,7 +335,7 @@ async def test_current_operation_update( """Test state update.""" await setup_integration(hass, mock_config_entry) - assert hass.states.get("water_heater.warmepumpe").state == "standard" + assert hass.states.get("water_heater.warmepumpe").state == STATE_HEAT_PUMP await trigger_update( hass, @@ -356,7 +359,7 @@ async def test_switch_update( await setup_integration(hass, mock_config_entry) state = hass.states.get("water_heater.warmepumpe") - assert state.state == "standard" + assert state.state == STATE_HEAT_PUMP assert ( state.attributes[ATTR_SUPPORTED_FEATURES] == WaterHeaterEntityFeature.ON_OFF @@ -516,7 +519,7 @@ async def test_availability( """Test availability.""" await setup_integration(hass, mock_config_entry) - assert hass.states.get("water_heater.warmepumpe").state == "standard" + assert hass.states.get("water_heater.warmepumpe").state == STATE_HEAT_PUMP await trigger_health_update( hass, devices, "3810e5ad-5351-d9f9-12ff-000001200000", HealthStatus.OFFLINE @@ -528,7 +531,7 @@ async def test_availability( hass, devices, "3810e5ad-5351-d9f9-12ff-000001200000", HealthStatus.ONLINE ) - assert hass.states.get("water_heater.warmepumpe").state == "standard" + assert hass.states.get("water_heater.warmepumpe").state == STATE_HEAT_PUMP @pytest.mark.parametrize("device_fixture", ["da_sac_ehs_000002_sub"])