hass-core/tests/components/tado/test_climate.py
chiefdragon 9672db0354
Add new preset to Tado to enable geofencing mode (#92877)
* Add new preset to Tado to enable geofencing mode
Add new 'auto' preset mode to enable Tado to be set to auto geofencing
mode.  The existing ‘home’ and ‘away’ presets switched Tado into manual
geofencing mode and there was no way to restore it to auto mode.
Note 1: Since preset modes (home, away and auto) apply to the Tado home
holistically, irrespective of the Tado climate entity used to select
the preset, three new sensors have been added to display the state of
the Tado home
Note 2: Auto mode is only supported if the Auto Assist skill is enabled
in the owner's Tado home. Various checks have been added to ensure the
Tado supports auto geofencing and if it is not supported, the preset is
not listed in the preset modes available

* Update codeowners in manifest.json

* Update main codeowners file for Tado component
2023-05-23 19:08:00 +02:00

90 lines
3 KiB
Python

"""The sensor tests for the tado platform."""
from homeassistant.core import HomeAssistant
from .util import async_init_integration
async def test_air_con(hass: HomeAssistant) -> None:
"""Test creation of aircon climate."""
await async_init_integration(hass)
state = hass.states.get("climate.air_conditioning")
assert state.state == "cool"
expected_attributes = {
"current_humidity": 60.9,
"current_temperature": 24.8,
"fan_mode": "auto",
"fan_modes": ["auto", "high", "medium", "low"],
"friendly_name": "Air Conditioning",
"hvac_action": "cooling",
"hvac_modes": ["off", "auto", "heat", "cool", "heat_cool", "dry", "fan_only"],
"max_temp": 31.0,
"min_temp": 16.0,
"preset_mode": "auto",
"preset_modes": ["away", "home", "auto"],
"supported_features": 25,
"target_temp_step": 1,
"temperature": 17.8,
}
# Only test for a subset of attributes in case
# HA changes the implementation and a new one appears
assert all(item in state.attributes.items() for item in expected_attributes.items())
async def test_heater(hass: HomeAssistant) -> None:
"""Test creation of heater climate."""
await async_init_integration(hass)
state = hass.states.get("climate.baseboard_heater")
assert state.state == "heat"
expected_attributes = {
"current_humidity": 45.2,
"current_temperature": 20.6,
"friendly_name": "Baseboard Heater",
"hvac_action": "idle",
"hvac_modes": ["off", "auto", "heat"],
"max_temp": 31.0,
"min_temp": 16.0,
"preset_mode": "auto",
"preset_modes": ["away", "home", "auto"],
"supported_features": 17,
"target_temp_step": 1,
"temperature": 20.5,
}
# Only test for a subset of attributes in case
# HA changes the implementation and a new one appears
assert all(item in state.attributes.items() for item in expected_attributes.items())
async def test_smartac_with_swing(hass: HomeAssistant) -> None:
"""Test creation of smart ac with swing climate."""
await async_init_integration(hass)
state = hass.states.get("climate.air_conditioning_with_swing")
assert state.state == "auto"
expected_attributes = {
"current_humidity": 42.3,
"current_temperature": 20.9,
"fan_mode": "auto",
"fan_modes": ["auto", "high", "medium", "low"],
"friendly_name": "Air Conditioning with swing",
"hvac_action": "heating",
"hvac_modes": ["off", "auto", "heat", "cool", "heat_cool", "dry", "fan_only"],
"max_temp": 30.0,
"min_temp": 16.0,
"preset_mode": "auto",
"preset_modes": ["away", "home", "auto"],
"swing_modes": ["on", "off"],
"supported_features": 57,
"target_temp_step": 1.0,
"temperature": 20.0,
}
# Only test for a subset of attributes in case
# HA changes the implementation and a new one appears
assert all(item in state.attributes.items() for item in expected_attributes.items())