From 80ddb3b02a41530279a6240d5e378b8ea765f881 Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 21 Mar 2024 12:13:12 +0000 Subject: [PATCH] fix: restores support for climate.turn_on Fixes #133 --- custom_components/dual_smart_thermostat/climate.py | 4 +++- tests/test_cooler_mode.py | 4 ++-- tests/test_dual_mode.py | 2 +- tests/test_heater_mode.py | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/custom_components/dual_smart_thermostat/climate.py b/custom_components/dual_smart_thermostat/climate.py index b314db4..b4b1cc1 100644 --- a/custom_components/dual_smart_thermostat/climate.py +++ b/custom_components/dual_smart_thermostat/climate.py @@ -387,7 +387,9 @@ def __init__( self._unit = unit self._attr_unique_id = unique_id self._attr_preset_mode = PRESET_NONE - self._default_support_flags = ClimateEntityFeature.TURN_OFF + self._default_support_flags = ( + ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON + ) self._enable_turn_on_off_backwards_compatibility = False self._attr_supported_features = self._default_support_flags if len(presets): diff --git a/tests/test_cooler_mode.py b/tests/test_cooler_mode.py index 154e2a8..f1ab4e0 100644 --- a/tests/test_cooler_mode.py +++ b/tests/test_cooler_mode.py @@ -284,11 +284,11 @@ async def test_set_preset_mode_set_temp_keeps_preset_mode( state = hass.states.get(common.ENTITY) assert state.attributes.get("temperature") == temp await common.async_set_temperature(hass, target_temp) - assert state.attributes.get("supported_features") == 145 + assert state.attributes.get("supported_features") == 401 state = hass.states.get(common.ENTITY) assert state.attributes.get("temperature") == target_temp assert state.attributes.get("preset_mode") == preset - assert state.attributes.get("supported_features") == 145 + assert state.attributes.get("supported_features") == 401 await common.async_set_preset_mode(hass, PRESET_NONE) state = hass.states.get(common.ENTITY) if preset == PRESET_NONE: diff --git a/tests/test_dual_mode.py b/tests/test_dual_mode.py index 73007a9..ba86c5e 100644 --- a/tests/test_dual_mode.py +++ b/tests/test_dual_mode.py @@ -343,7 +343,7 @@ async def test_set_preset_mode_set_temp_keeps_preset_mode( assert state.attributes.get("target_temp_low") == test_target_temp_low assert state.attributes.get("target_temp_high") == test_target_temp_high assert state.attributes.get("preset_mode") == preset - assert state.attributes.get("supported_features") == 146 + assert state.attributes.get("supported_features") == 402 await common.async_set_preset_mode(hass, PRESET_NONE) state = hass.states.get(common.ENTITY) if preset == PRESET_NONE: diff --git a/tests/test_heater_mode.py b/tests/test_heater_mode.py index f98a4f3..de0d6d1 100644 --- a/tests/test_heater_mode.py +++ b/tests/test_heater_mode.py @@ -590,11 +590,11 @@ async def test_set_preset_mode_set_temp_keeps_preset_mode( state = hass.states.get(common.ENTITY) assert state.attributes.get("temperature") == temp await common.async_set_temperature(hass, target_temp) - assert state.attributes.get("supported_features") == 145 + assert state.attributes.get("supported_features") == 401 state = hass.states.get(common.ENTITY) assert state.attributes.get("temperature") == target_temp assert state.attributes.get("preset_mode") == preset - assert state.attributes.get("supported_features") == 145 + assert state.attributes.get("supported_features") == 401 await common.async_set_preset_mode(hass, PRESET_NONE) state = hass.states.get(common.ENTITY) @@ -1094,7 +1094,7 @@ async def test_heater_mode_aux_heater( assert hass.states.get(heater_switch).state == STATE_OFF state = hass.states.get(common.ENTITY) - assert state.attributes.get("supported_features") == 193 + assert state.attributes.get("supported_features") == 449 setup_sensor(hass, 18) await hass.async_block_till_done() @@ -1179,7 +1179,7 @@ async def test_heater_mode_aux_heater_keep_primary_heater_on( assert hass.states.get(heater_switch).state == STATE_OFF state = hass.states.get(common.ENTITY) - assert state.attributes.get("supported_features") == 193 + assert state.attributes.get("supported_features") == 449 setup_sensor(hass, 18) await hass.async_block_till_done()