mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Treat thermostat unknown state like unavailable in alexa (#74220)
This commit is contained in:
parent
de700e7859
commit
7573dc34aa
@ -1046,6 +1046,8 @@ class AlexaThermostatController(AlexaCapability):
|
|||||||
|
|
||||||
if preset in API_THERMOSTAT_PRESETS:
|
if preset in API_THERMOSTAT_PRESETS:
|
||||||
mode = API_THERMOSTAT_PRESETS[preset]
|
mode = API_THERMOSTAT_PRESETS[preset]
|
||||||
|
elif self.entity.state == STATE_UNKNOWN:
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
mode = API_THERMOSTAT_MODES.get(self.entity.state)
|
mode = API_THERMOSTAT_MODES.get(self.entity.state)
|
||||||
if mode is None:
|
if mode is None:
|
||||||
|
@ -658,13 +658,16 @@ async def test_report_climate_state(hass):
|
|||||||
"Alexa.TemperatureSensor", "temperature", {"value": 34.0, "scale": "CELSIUS"}
|
"Alexa.TemperatureSensor", "temperature", {"value": 34.0, "scale": "CELSIUS"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for state in "unavailable", "unknown":
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"climate.unavailable",
|
f"climate.{state}",
|
||||||
"unavailable",
|
state,
|
||||||
{"friendly_name": "Climate Unavailable", "supported_features": 91},
|
{"friendly_name": f"Climate {state}", "supported_features": 91},
|
||||||
|
)
|
||||||
|
properties = await reported_properties(hass, f"climate.{state}")
|
||||||
|
properties.assert_not_has_property(
|
||||||
|
"Alexa.ThermostatController", "thermostatMode"
|
||||||
)
|
)
|
||||||
properties = await reported_properties(hass, "climate.unavailable")
|
|
||||||
properties.assert_not_has_property("Alexa.ThermostatController", "thermostatMode")
|
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
"climate.unsupported",
|
"climate.unsupported",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user