Guard against unavailable climate entities (#25978)

This commit is contained in:
Paulus Schoutsen 2019-08-16 07:17:43 -07:00 committed by Pascal Vizeli
parent 715bb286c4
commit ce35f64d59

View file

@ -264,7 +264,9 @@ class ClimateCapabilities(AlexaEntity):
def interfaces(self):
"""Yield the supported interfaces."""
# If we support two modes, one being off, we allow turning on too.
if climate.HVAC_MODE_OFF in self.entity.attributes[climate.ATTR_HVAC_MODES]:
if climate.HVAC_MODE_OFF in self.entity.attributes.get(
climate.ATTR_HVAC_MODES, []
):
yield AlexaPowerController(self.entity)
yield AlexaThermostatController(self.hass, self.entity)