mirror of
https://github.com/home-assistant/core.git
synced 2025-12-25 05:26:47 +00:00
Fix climate HVAC device condition (#69908)
This commit is contained in:
@@ -102,15 +102,6 @@ async def test_get_conditions(
|
||||
|
||||
async def test_if_state(hass, calls):
|
||||
"""Test for turn_on and turn_off conditions."""
|
||||
hass.states.async_set(
|
||||
"climate.entity",
|
||||
const.HVAC_MODE_COOL,
|
||||
{
|
||||
const.ATTR_HVAC_MODE: const.HVAC_MODE_COOL,
|
||||
const.ATTR_PRESET_MODE: const.PRESET_AWAY,
|
||||
},
|
||||
)
|
||||
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
automation.DOMAIN,
|
||||
@@ -157,6 +148,20 @@ async def test_if_state(hass, calls):
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
# Should not fire, entity doesn't exist yet
|
||||
hass.bus.async_fire("test_event1")
|
||||
await hass.async_block_till_done()
|
||||
assert len(calls) == 0
|
||||
|
||||
hass.states.async_set(
|
||||
"climate.entity",
|
||||
const.HVAC_MODE_COOL,
|
||||
{
|
||||
const.ATTR_PRESET_MODE: const.PRESET_AWAY,
|
||||
},
|
||||
)
|
||||
|
||||
hass.bus.async_fire("test_event1")
|
||||
await hass.async_block_till_done()
|
||||
assert len(calls) == 1
|
||||
@@ -166,7 +171,6 @@ async def test_if_state(hass, calls):
|
||||
"climate.entity",
|
||||
const.HVAC_MODE_AUTO,
|
||||
{
|
||||
const.ATTR_HVAC_MODE: const.HVAC_MODE_AUTO,
|
||||
const.ATTR_PRESET_MODE: const.PRESET_AWAY,
|
||||
},
|
||||
)
|
||||
@@ -186,7 +190,6 @@ async def test_if_state(hass, calls):
|
||||
"climate.entity",
|
||||
const.HVAC_MODE_AUTO,
|
||||
{
|
||||
const.ATTR_HVAC_MODE: const.HVAC_MODE_AUTO,
|
||||
const.ATTR_PRESET_MODE: const.PRESET_HOME,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user