Treat thermostat unknown state like unavailable in alexa (#74220)

This commit is contained in:
Paulus Schoutsen 2022-06-30 10:00:10 -07:00 committed by GitHub
parent de700e7859
commit 7573dc34aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -1046,6 +1046,8 @@ class AlexaThermostatController(AlexaCapability):
if preset in API_THERMOSTAT_PRESETS:
mode = API_THERMOSTAT_PRESETS[preset]
elif self.entity.state == STATE_UNKNOWN:
return None
else:
mode = API_THERMOSTAT_MODES.get(self.entity.state)
if mode is None:

View File

@ -658,13 +658,16 @@ async def test_report_climate_state(hass):
"Alexa.TemperatureSensor", "temperature", {"value": 34.0, "scale": "CELSIUS"}
)
hass.states.async_set(
"climate.unavailable",
"unavailable",
{"friendly_name": "Climate Unavailable", "supported_features": 91},
)
properties = await reported_properties(hass, "climate.unavailable")
properties.assert_not_has_property("Alexa.ThermostatController", "thermostatMode")
for state in "unavailable", "unknown":
hass.states.async_set(
f"climate.{state}",
state,
{"friendly_name": f"Climate {state}", "supported_features": 91},
)
properties = await reported_properties(hass, f"climate.{state}")
properties.assert_not_has_property(
"Alexa.ThermostatController", "thermostatMode"
)
hass.states.async_set(
"climate.unsupported",