Skip to content

Commit 9ec3aee

Browse files
authored
Fix Climate state reproduction when target temperature is None (home-assistant#156220)
1 parent 8d50754 commit 9ec3aee

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

homeassistant/components/climate/reproduce_state.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ async def call_service(
5757
await call_service(SERVICE_SET_HVAC_MODE, [], {ATTR_HVAC_MODE: state.state})
5858

5959
if (
60-
(ATTR_TEMPERATURE in state.attributes)
61-
or (ATTR_TARGET_TEMP_HIGH in state.attributes)
62-
or (ATTR_TARGET_TEMP_LOW in state.attributes)
60+
(state.attributes.get(ATTR_TEMPERATURE) is not None)
61+
or (state.attributes.get(ATTR_TARGET_TEMP_HIGH) is not None)
62+
or (state.attributes.get(ATTR_TARGET_TEMP_LOW) is not None)
6363
):
6464
await call_service(
6565
SERVICE_SET_TEMPERATURE,

tests/components/climate/test_reproduce_state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ async def test_attribute(hass: HomeAssistant, service, attribute) -> None:
127127
(SERVICE_SET_SWING_MODE, ATTR_SWING_MODE),
128128
(SERVICE_SET_SWING_HORIZONTAL_MODE, ATTR_SWING_HORIZONTAL_MODE),
129129
(SERVICE_SET_FAN_MODE, ATTR_FAN_MODE),
130+
(SERVICE_SET_TEMPERATURE, ATTR_TEMPERATURE),
130131
],
131132
)
132133
async def test_attribute_with_none(hass: HomeAssistant, service, attribute) -> None:

0 commit comments

Comments
 (0)