mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Use climate enums in alexa (#75911)
This commit is contained in:
parent
97b30bec8b
commit
98293f2179
@ -379,7 +379,7 @@ class AlexaPowerController(AlexaCapability):
|
|||||||
raise UnsupportedProperty(name)
|
raise UnsupportedProperty(name)
|
||||||
|
|
||||||
if self.entity.domain == climate.DOMAIN:
|
if self.entity.domain == climate.DOMAIN:
|
||||||
is_on = self.entity.state != climate.HVAC_MODE_OFF
|
is_on = self.entity.state != climate.HVACMode.OFF
|
||||||
elif self.entity.domain == fan.DOMAIN:
|
elif self.entity.domain == fan.DOMAIN:
|
||||||
is_on = self.entity.state == fan.STATE_ON
|
is_on = self.entity.state == fan.STATE_ON
|
||||||
elif self.entity.domain == vacuum.DOMAIN:
|
elif self.entity.domain == vacuum.DOMAIN:
|
||||||
|
@ -68,16 +68,16 @@ API_TEMP_UNITS = {TEMP_FAHRENHEIT: "FAHRENHEIT", TEMP_CELSIUS: "CELSIUS"}
|
|||||||
# back to HA state.
|
# back to HA state.
|
||||||
API_THERMOSTAT_MODES = OrderedDict(
|
API_THERMOSTAT_MODES = OrderedDict(
|
||||||
[
|
[
|
||||||
(climate.HVAC_MODE_HEAT, "HEAT"),
|
(climate.HVACMode.HEAT, "HEAT"),
|
||||||
(climate.HVAC_MODE_COOL, "COOL"),
|
(climate.HVACMode.COOL, "COOL"),
|
||||||
(climate.HVAC_MODE_HEAT_COOL, "AUTO"),
|
(climate.HVACMode.HEAT_COOL, "AUTO"),
|
||||||
(climate.HVAC_MODE_AUTO, "AUTO"),
|
(climate.HVACMode.AUTO, "AUTO"),
|
||||||
(climate.HVAC_MODE_OFF, "OFF"),
|
(climate.HVACMode.OFF, "OFF"),
|
||||||
(climate.HVAC_MODE_FAN_ONLY, "OFF"),
|
(climate.HVACMode.FAN_ONLY, "OFF"),
|
||||||
(climate.HVAC_MODE_DRY, "CUSTOM"),
|
(climate.HVACMode.DRY, "CUSTOM"),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
API_THERMOSTAT_MODES_CUSTOM = {climate.HVAC_MODE_DRY: "DEHUMIDIFY"}
|
API_THERMOSTAT_MODES_CUSTOM = {climate.HVACMode.DRY: "DEHUMIDIFY"}
|
||||||
API_THERMOSTAT_PRESETS = {climate.PRESET_ECO: "ECO"}
|
API_THERMOSTAT_PRESETS = {climate.PRESET_ECO: "ECO"}
|
||||||
|
|
||||||
# AlexaModeController does not like a single mode for the fan preset, we add PRESET_MODE_NA if a fan has only one preset_mode
|
# AlexaModeController does not like a single mode for the fan preset, we add PRESET_MODE_NA if a fan has only one preset_mode
|
||||||
|
@ -460,7 +460,7 @@ class ClimateCapabilities(AlexaEntity):
|
|||||||
def interfaces(self):
|
def interfaces(self):
|
||||||
"""Yield the supported interfaces."""
|
"""Yield the supported interfaces."""
|
||||||
# If we support two modes, one being off, we allow turning on too.
|
# If we support two modes, one being off, we allow turning on too.
|
||||||
if climate.HVAC_MODE_OFF in self.entity.attributes.get(
|
if climate.HVACMode.OFF in self.entity.attributes.get(
|
||||||
climate.ATTR_HVAC_MODES, []
|
climate.ATTR_HVAC_MODES, []
|
||||||
):
|
):
|
||||||
yield AlexaPowerController(self.entity)
|
yield AlexaPowerController(self.entity)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user