From 26bc37195e1fcc89fd3f88883c48aadd45b82c40 Mon Sep 17 00:00:00 2001 From: G Johansson Date: Sun, 7 Jul 2024 18:54:40 +0200 Subject: [PATCH] Add defrosting as HVACAction in ClimateEntity (#121448) --- homeassistant/components/climate/const.py | 1 + homeassistant/components/climate/icons.json | 1 + homeassistant/components/climate/strings.json | 9 +++++---- tests/components/mqtt/test_climate.py | 11 ++++++++++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/climate/const.py b/homeassistant/components/climate/const.py index b1bf78063c7..b74169430d4 100644 --- a/homeassistant/components/climate/const.py +++ b/homeassistant/components/climate/const.py @@ -97,6 +97,7 @@ class HVACAction(StrEnum): """HVAC action for climate devices.""" COOLING = "cooling" + DEFROSTING = "defrosting" DRYING = "drying" FAN = "fan" HEATING = "heating" diff --git a/homeassistant/components/climate/icons.json b/homeassistant/components/climate/icons.json index 91a306f1da4..ea6c504ce25 100644 --- a/homeassistant/components/climate/icons.json +++ b/homeassistant/components/climate/icons.json @@ -21,6 +21,7 @@ "default": "mdi:circle-medium", "state": { "cooling": "mdi:snowflake", + "defrosting": "mdi:snowflake-melt", "drying": "mdi:water-percent", "fan": "mdi:fan", "heating": "mdi:fire", diff --git a/homeassistant/components/climate/strings.json b/homeassistant/components/climate/strings.json index 2a7fea9136c..dc212441824 100644 --- a/homeassistant/components/climate/strings.json +++ b/homeassistant/components/climate/strings.json @@ -69,13 +69,14 @@ "hvac_action": { "name": "Current action", "state": { - "off": "[%key:common::state::off%]", - "preheating": "Preheating", - "heating": "Heating", "cooling": "Cooling", + "defrosting": "Defrosting", "drying": "Drying", + "fan": "Fan", + "heating": "Heating", "idle": "[%key:common::state::idle%]", - "fan": "Fan" + "off": "[%key:common::state::off%]", + "preheating": "Preheating" } }, "hvac_modes": { diff --git a/tests/components/mqtt/test_climate.py b/tests/components/mqtt/test_climate.py index 8d2d805a899..f29c16f19ea 100644 --- a/tests/components/mqtt/test_climate.py +++ b/tests/components/mqtt/test_climate.py @@ -1017,7 +1017,16 @@ async def test_handle_action_received( # Cycle through valid modes # Redefine actions according to https://developers.home-assistant.io/docs/core/entity/climate/#hvac-action - actions = ["off", "preheating", "heating", "cooling", "drying", "idle", "fan"] + actions = [ + "off", + "preheating", + "defrosting", + "heating", + "cooling", + "drying", + "idle", + "fan", + ] assert all(elem in actions for elem in HVACAction) for action in actions: async_fire_mqtt_message(hass, "action", action)