mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Set nest climate hvac_action to report idle when hvac mode is not off (#62811)
This commit is contained in:
parent
829ff9c423
commit
0bcad5579b
@ -20,6 +20,7 @@ from homeassistant.components.climate.const import (
|
||||
ATTR_TARGET_TEMP_LOW,
|
||||
CURRENT_HVAC_COOL,
|
||||
CURRENT_HVAC_HEAT,
|
||||
CURRENT_HVAC_IDLE,
|
||||
CURRENT_HVAC_OFF,
|
||||
FAN_OFF,
|
||||
FAN_ON,
|
||||
@ -234,6 +235,8 @@ class ThermostatEntity(ClimateEntity):
|
||||
def hvac_action(self) -> str | None:
|
||||
"""Return the current HVAC action (heating, cooling)."""
|
||||
trait = self._device.traits[ThermostatHvacTrait.NAME]
|
||||
if trait.status == "OFF" and self.hvac_mode != HVAC_MODE_OFF:
|
||||
return CURRENT_HVAC_IDLE
|
||||
if trait.status in THERMOSTAT_HVAC_STATUS_MAP:
|
||||
return THERMOSTAT_HVAC_STATUS_MAP[trait.status]
|
||||
return None
|
||||
|
@ -21,6 +21,7 @@ from homeassistant.components.climate.const import (
|
||||
ATTR_TARGET_TEMP_LOW,
|
||||
CURRENT_HVAC_COOL,
|
||||
CURRENT_HVAC_HEAT,
|
||||
CURRENT_HVAC_IDLE,
|
||||
CURRENT_HVAC_OFF,
|
||||
FAN_LOW,
|
||||
FAN_OFF,
|
||||
@ -356,7 +357,7 @@ async def test_thermostat_eco_heat_only(hass):
|
||||
thermostat = hass.states.get("climate.my_thermostat")
|
||||
assert thermostat is not None
|
||||
assert thermostat.state == HVAC_MODE_HEAT
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
||||
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 29.9
|
||||
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
|
||||
HVAC_MODE_HEAT,
|
||||
@ -428,7 +429,7 @@ async def test_thermostat_set_hvac_mode(hass, auth):
|
||||
thermostat = hass.states.get("climate.my_thermostat")
|
||||
assert thermostat is not None
|
||||
assert thermostat.state == HVAC_MODE_HEAT
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
||||
|
||||
# Simulate pubsub message when the thermostat starts heating
|
||||
event = EventMessage(
|
||||
@ -733,7 +734,7 @@ async def test_thermostat_fan_on(hass):
|
||||
thermostat = hass.states.get("climate.my_thermostat")
|
||||
assert thermostat is not None
|
||||
assert thermostat.state == HVAC_MODE_FAN_ONLY
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
||||
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 16.2
|
||||
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
|
||||
HVAC_MODE_HEAT,
|
||||
@ -769,7 +770,7 @@ async def test_thermostat_cool_with_fan(hass):
|
||||
thermostat = hass.states.get("climate.my_thermostat")
|
||||
assert thermostat is not None
|
||||
assert thermostat.state == HVAC_MODE_COOL
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
||||
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
|
||||
HVAC_MODE_HEAT,
|
||||
HVAC_MODE_COOL,
|
||||
@ -898,7 +899,7 @@ async def test_thermostat_invalid_fan_mode(hass):
|
||||
thermostat = hass.states.get("climate.my_thermostat")
|
||||
assert thermostat is not None
|
||||
assert thermostat.state == HVAC_MODE_FAN_ONLY
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
||||
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] == 16.2
|
||||
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
|
||||
HVAC_MODE_HEAT,
|
||||
@ -1075,7 +1076,7 @@ async def test_thermostat_missing_temperature_trait(hass):
|
||||
thermostat = hass.states.get("climate.my_thermostat")
|
||||
assert thermostat is not None
|
||||
assert thermostat.state == HVAC_MODE_HEAT
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
||||
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] is None
|
||||
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
|
||||
HVAC_MODE_HEAT,
|
||||
@ -1143,7 +1144,7 @@ async def test_thermostat_missing_set_point(hass):
|
||||
thermostat = hass.states.get("climate.my_thermostat")
|
||||
assert thermostat is not None
|
||||
assert thermostat.state == HVAC_MODE_HEAT_COOL
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_OFF
|
||||
assert thermostat.attributes[ATTR_HVAC_ACTION] == CURRENT_HVAC_IDLE
|
||||
assert thermostat.attributes[ATTR_CURRENT_TEMPERATURE] is None
|
||||
assert set(thermostat.attributes[ATTR_HVAC_MODES]) == {
|
||||
HVAC_MODE_HEAT,
|
||||
|
Loading…
x
Reference in New Issue
Block a user