Skip to content

Commit

Permalink
fix: restores support for climate.turn_on
Browse files Browse the repository at this point in the history
Fixes #133
  • Loading branch information
= authored and swingerman committed Mar 21, 2024
1 parent 08b25be commit 80ddb3b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion custom_components/dual_smart_thermostat/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cooler_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dual_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_heater_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 80ddb3b

Please sign in to comment.