mirror of
https://github.com/home-assistant/core.git
synced 2025-12-25 05:26:47 +00:00
Update nest climate set_temperature to allow hvac_mode (#66909)
This commit is contained in:
@@ -677,6 +677,65 @@ async def test_thermostat_set_heat(
|
||||
}
|
||||
|
||||
|
||||
async def test_thermostat_set_temperature_hvac_mode(
|
||||
hass: HomeAssistant,
|
||||
setup_platform: PlatformSetup,
|
||||
auth: FakeAuth,
|
||||
create_device: CreateDevice,
|
||||
) -> None:
|
||||
"""Test setting HVAC mode while setting temperature."""
|
||||
create_device.create(
|
||||
{
|
||||
"sdm.devices.traits.ThermostatHvac": {"status": "OFF"},
|
||||
"sdm.devices.traits.ThermostatMode": {
|
||||
"availableModes": ["HEAT", "COOL", "HEATCOOL", "OFF"],
|
||||
"mode": "OFF",
|
||||
},
|
||||
"sdm.devices.traits.ThermostatTemperatureSetpoint": {
|
||||
"coolCelsius": 25.0,
|
||||
},
|
||||
},
|
||||
)
|
||||
await setup_platform()
|
||||
|
||||
assert len(hass.states.async_all()) == 1
|
||||
thermostat = hass.states.get("climate.my_thermostat")
|
||||
assert thermostat is not None
|
||||
assert thermostat.state == HVAC_MODE_OFF
|
||||
|
||||
await common.async_set_temperature(hass, temperature=24.0, hvac_mode=HVAC_MODE_COOL)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert auth.method == "post"
|
||||
assert auth.url == DEVICE_COMMAND
|
||||
assert auth.json == {
|
||||
"command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetCool",
|
||||
"params": {"coolCelsius": 24.0},
|
||||
}
|
||||
|
||||
await common.async_set_temperature(hass, temperature=26.0, hvac_mode=HVAC_MODE_HEAT)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert auth.method == "post"
|
||||
assert auth.url == DEVICE_COMMAND
|
||||
assert auth.json == {
|
||||
"command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat",
|
||||
"params": {"heatCelsius": 26.0},
|
||||
}
|
||||
|
||||
await common.async_set_temperature(
|
||||
hass, target_temp_low=20.0, target_temp_high=24.0, hvac_mode=HVAC_MODE_HEAT_COOL
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert auth.method == "post"
|
||||
assert auth.url == DEVICE_COMMAND
|
||||
assert auth.json == {
|
||||
"command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange",
|
||||
"params": {"heatCelsius": 20.0, "coolCelsius": 24.0},
|
||||
}
|
||||
|
||||
|
||||
async def test_thermostat_set_heat_cool(
|
||||
hass: HomeAssistant,
|
||||
setup_platform: PlatformSetup,
|
||||
|
||||
Reference in New Issue
Block a user