diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py index 189d1354e26188..bb03e796d9142c 100644 --- a/homeassistant/components/google_assistant/trait.py +++ b/homeassistant/components/google_assistant/trait.py @@ -484,6 +484,11 @@ def supported(domain, features, device_class, _): if domain == water_heater.DOMAIN and features & WaterHeaterEntityFeature.ON_OFF: return True + if domain == climate.DOMAIN and features & ( + ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON + ): + return True + return domain in ( group.DOMAIN, input_boolean.DOMAIN, diff --git a/tests/components/google_assistant/__init__.py b/tests/components/google_assistant/__init__.py index 6fc1c9f580dae2..931f4d25522556 100644 --- a/tests/components/google_assistant/__init__.py +++ b/tests/components/google_assistant/__init__.py @@ -305,6 +305,7 @@ def should_2fa(self, state): "id": "climate.hvac", "name": {"name": "Hvac"}, "traits": [ + "action.devices.traits.OnOff", "action.devices.traits.TemperatureSetting", "action.devices.traits.FanSpeed", ], @@ -326,7 +327,10 @@ def should_2fa(self, state): { "id": "climate.heatpump", "name": {"name": "HeatPump"}, - "traits": ["action.devices.traits.TemperatureSetting"], + "traits": [ + "action.devices.traits.OnOff", + "action.devices.traits.TemperatureSetting", + ], "type": "action.devices.types.THERMOSTAT", "willReportState": False, }, @@ -334,6 +338,7 @@ def should_2fa(self, state): "id": "climate.ecobee", "name": {"name": "Ecobee"}, "traits": [ + "action.devices.traits.OnOff", "action.devices.traits.TemperatureSetting", "action.devices.traits.FanSpeed", ], diff --git a/tests/components/google_assistant/test_google_assistant.py b/tests/components/google_assistant/test_google_assistant.py index 6d3a9b34cce985..4fb6f50a5e69de 100644 --- a/tests/components/google_assistant/test_google_assistant.py +++ b/tests/components/google_assistant/test_google_assistant.py @@ -233,12 +233,14 @@ async def test_query_climate_request( assert len(devices) == 3 assert devices["climate.heatpump"] == { "online": True, + "on": True, "thermostatTemperatureSetpoint": 20.0, "thermostatTemperatureAmbient": 25.0, "thermostatMode": "heat", } assert devices["climate.ecobee"] == { "online": True, + "on": True, "thermostatTemperatureSetpointHigh": 24, "thermostatTemperatureAmbient": 23, "thermostatMode": "heatcool", @@ -247,6 +249,7 @@ async def test_query_climate_request( } assert devices["climate.hvac"] == { "online": True, + "on": True, "thermostatTemperatureSetpoint": 21, "thermostatTemperatureAmbient": 22, "thermostatMode": "cool", @@ -294,12 +297,14 @@ async def test_query_climate_request_f( assert len(devices) == 3 assert devices["climate.heatpump"] == { "online": True, + "on": True, "thermostatTemperatureSetpoint": -6.7, "thermostatTemperatureAmbient": -3.9, "thermostatMode": "heat", } assert devices["climate.ecobee"] == { "online": True, + "on": True, "thermostatTemperatureSetpointHigh": -4.4, "thermostatTemperatureAmbient": -5, "thermostatMode": "heatcool", @@ -308,6 +313,7 @@ async def test_query_climate_request_f( } assert devices["climate.hvac"] == { "online": True, + "on": True, "thermostatTemperatureSetpoint": -6.1, "thermostatTemperatureAmbient": -5.6, "thermostatMode": "cool", diff --git a/tests/components/google_assistant/test_trait.py b/tests/components/google_assistant/test_trait.py index 3f1e28cb667206..58cbc5dce0e159 100644 --- a/tests/components/google_assistant/test_trait.py +++ b/tests/components/google_assistant/test_trait.py @@ -1080,7 +1080,9 @@ async def test_temperature_setting_climate_onoff(hass: HomeAssistant) -> None: "climate.bla", climate.HVACMode.AUTO, { - ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE_RANGE, + ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE_RANGE + | ClimateEntityFeature.TURN_ON + | ClimateEntityFeature.TURN_OFF, climate.ATTR_HVAC_MODES: [ climate.HVACMode.OFF, climate.HVACMode.COOL, @@ -1161,7 +1163,9 @@ async def test_temperature_setting_climate_range(hass: HomeAssistant) -> None: { climate.ATTR_CURRENT_TEMPERATURE: 70, climate.ATTR_CURRENT_HUMIDITY: 25, - ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE_RANGE, + ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE_RANGE + | ClimateEntityFeature.TURN_ON + | ClimateEntityFeature.TURN_OFF, climate.ATTR_HVAC_MODES: [ STATE_OFF, climate.HVACMode.COOL, @@ -1273,7 +1277,9 @@ async def test_temperature_setting_climate_setpoint(hass: HomeAssistant) -> None "climate.bla", climate.HVACMode.COOL, { - ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE, + ATTR_SUPPORTED_FEATURES: ClimateEntityFeature.TARGET_TEMPERATURE + | ClimateEntityFeature.TURN_ON + | ClimateEntityFeature.TURN_OFF, climate.ATTR_HVAC_MODES: [STATE_OFF, climate.HVACMode.COOL], climate.ATTR_MIN_TEMP: 10, climate.ATTR_MAX_TEMP: 30,