From 9ec3aee8aabe93756090a0341934109c09772a12 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Sun, 9 Nov 2025 23:29:46 +0100 Subject: [PATCH] Fix Climate state reproduction when target temperature is `None` (#156220) --- homeassistant/components/climate/reproduce_state.py | 6 +++--- tests/components/climate/test_reproduce_state.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/climate/reproduce_state.py b/homeassistant/components/climate/reproduce_state.py index d38e243cb62..0f965e5a9e9 100644 --- a/homeassistant/components/climate/reproduce_state.py +++ b/homeassistant/components/climate/reproduce_state.py @@ -57,9 +57,9 @@ async def _async_reproduce_states( await call_service(SERVICE_SET_HVAC_MODE, [], {ATTR_HVAC_MODE: state.state}) if ( - (ATTR_TEMPERATURE in state.attributes) - or (ATTR_TARGET_TEMP_HIGH in state.attributes) - or (ATTR_TARGET_TEMP_LOW in state.attributes) + (state.attributes.get(ATTR_TEMPERATURE) is not None) + or (state.attributes.get(ATTR_TARGET_TEMP_HIGH) is not None) + or (state.attributes.get(ATTR_TARGET_TEMP_LOW) is not None) ): await call_service( SERVICE_SET_TEMPERATURE, diff --git a/tests/components/climate/test_reproduce_state.py b/tests/components/climate/test_reproduce_state.py index 3bc91467f14..abd8630056c 100644 --- a/tests/components/climate/test_reproduce_state.py +++ b/tests/components/climate/test_reproduce_state.py @@ -127,6 +127,7 @@ async def test_attribute(hass: HomeAssistant, service, attribute) -> None: (SERVICE_SET_SWING_MODE, ATTR_SWING_MODE), (SERVICE_SET_SWING_HORIZONTAL_MODE, ATTR_SWING_HORIZONTAL_MODE), (SERVICE_SET_FAN_MODE, ATTR_FAN_MODE), + (SERVICE_SET_TEMPERATURE, ATTR_TEMPERATURE), ], ) async def test_attribute_with_none(hass: HomeAssistant, service, attribute) -> None: