From be05a749c57a7174839e75376a345bd184e97e0b Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 16 Jun 2023 04:16:12 +0200 Subject: [PATCH] Add preheating HVAC action to climate (#94677) * Add preheating HVAC action to climate * Fix MQTT tests --- homeassistant/components/climate/const.py | 1 + homeassistant/components/climate/strings.json | 1 + tests/components/mqtt/test_climate.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/climate/const.py b/homeassistant/components/climate/const.py index 9ee561b9c1b..41d4646aeae 100644 --- a/homeassistant/components/climate/const.py +++ b/homeassistant/components/climate/const.py @@ -96,6 +96,7 @@ class HVACAction(StrEnum): HEATING = "heating" IDLE = "idle" OFF = "off" + PREHEATING = "preheating" # These CURRENT_HVAC_* constants are deprecated as of Home Assistant 2022.5. diff --git a/homeassistant/components/climate/strings.json b/homeassistant/components/climate/strings.json index 00696b0738c..73ac4d6fbc4 100644 --- a/homeassistant/components/climate/strings.json +++ b/homeassistant/components/climate/strings.json @@ -54,6 +54,7 @@ "name": "Current action", "state": { "off": "Off", + "preheating": "Preheating", "heating": "Heating", "cooling": "Cooling", "drying": "Drying", diff --git a/tests/components/mqtt/test_climate.py b/tests/components/mqtt/test_climate.py index ce27a479308..de55bf71bed 100644 --- a/tests/components/mqtt/test_climate.py +++ b/tests/components/mqtt/test_climate.py @@ -966,7 +966,7 @@ async def test_handle_action_received( hvac_action = state.attributes.get(ATTR_HVAC_ACTION) assert hvac_action is None # Redefine actions according to https://developers.home-assistant.io/docs/core/entity/climate/#hvac-action - actions = ["off", "heating", "cooling", "drying", "idle", "fan"] + actions = ["off", "preheating", "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)