Fix unavailable climate entities in Alexa StateReport (#27128)
* Return None for AlexaThermostatController and AlexaTemperatureSensor properties if climate state is unavailable. Preserves raising an error for UnsupportedProperty, and allows Alexa.EndpointHealth to handle the unavailable state. * Added additional tests for climate state reporting.
This commit is contained in:
1 parent
e011a94ce9
commit
6dfeed6cd1
2 files changed
+112
-2
No files matched your search
@@ -445,7 +445,7 @@ class AlexaTemperatureSensor(AlexaCapibility):
|
||||
unit = self.hass.config.units.temperature_unit
|
||||
temp = self.entity.attributes.get(climate.ATTR_CURRENT_TEMPERATURE)
|
||||
|
||||
if temp in (STATE_UNAVAILABLE, STATE_UNKNOWN):
|
||||
if temp in (STATE_UNAVAILABLE, STATE_UNKNOWN, None):
|
||||
return None
|
||||
|
||||
try:
|
||||
@@ -572,6 +572,9 @@ class AlexaThermostatController(AlexaCapibility):
|
||||
|
||||
def get_property(self, name):
|
||||
"""Read and return a property."""
|
||||
if self.entity.state == STATE_UNAVAILABLE:
|
||||
return None
|
||||
|
||||
if name == "thermostatMode":
|
||||
preset = self.entity.attributes.get(climate.ATTR_PRESET_MODE)
|
||||
|
||||
|
||||
Reference in new issue
Block a user