mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add TURN_ON/OFF ClimateEntityFeature for smartthings (#108979)
This commit is contained in:
parent
360697836f
commit
cac0d07549
@ -173,6 +173,8 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateEntity):
|
||||
flags = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||
| ClimateEntityFeature.TURN_OFF
|
||||
| ClimateEntityFeature.TURN_ON
|
||||
)
|
||||
if self._device.get_capability(
|
||||
Capability.thermostat_fan_mode, Capability.thermostat
|
||||
@ -353,7 +355,10 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateEntity):
|
||||
|
||||
def _determine_supported_features(self) -> ClimateEntityFeature:
|
||||
features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.FAN_MODE
|
||||
| ClimateEntityFeature.TURN_OFF
|
||||
| ClimateEntityFeature.TURN_ON
|
||||
)
|
||||
if self._device.get_capability(Capability.fan_oscillation_mode):
|
||||
features |= ClimateEntityFeature.SWING_MODE
|
||||
|
@ -213,6 +213,8 @@ async def test_legacy_thermostat_entity_state(
|
||||
== ClimateEntityFeature.FAN_MODE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.TURN_OFF
|
||||
| ClimateEntityFeature.TURN_ON
|
||||
)
|
||||
assert state.attributes[ATTR_HVAC_ACTION] == HVACAction.IDLE
|
||||
assert sorted(state.attributes[ATTR_HVAC_MODES]) == [
|
||||
@ -240,6 +242,8 @@ async def test_basic_thermostat_entity_state(
|
||||
state.attributes[ATTR_SUPPORTED_FEATURES]
|
||||
== ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.TURN_OFF
|
||||
| ClimateEntityFeature.TURN_ON
|
||||
)
|
||||
assert ATTR_HVAC_ACTION not in state.attributes
|
||||
assert sorted(state.attributes[ATTR_HVAC_MODES]) == [
|
||||
@ -261,6 +265,8 @@ async def test_thermostat_entity_state(hass: HomeAssistant, thermostat) -> None:
|
||||
== ClimateEntityFeature.FAN_MODE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.TURN_OFF
|
||||
| ClimateEntityFeature.TURN_ON
|
||||
)
|
||||
assert state.attributes[ATTR_HVAC_ACTION] == HVACAction.IDLE
|
||||
assert sorted(state.attributes[ATTR_HVAC_MODES]) == [
|
||||
@ -288,6 +294,8 @@ async def test_buggy_thermostat_entity_state(
|
||||
state.attributes[ATTR_SUPPORTED_FEATURES]
|
||||
== ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
|
||||
| ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.TURN_OFF
|
||||
| ClimateEntityFeature.TURN_ON
|
||||
)
|
||||
assert state.state is STATE_UNKNOWN
|
||||
assert state.attributes[ATTR_TEMPERATURE] is None
|
||||
|
Loading…
x
Reference in New Issue
Block a user