mirror of
https://github.com/elisspace/core.git
synced 2026-10-02 07:19:59 +00:00
Prevent scene from restoring unavailable states (#67836)
This commit is contained in:
committed by
Paulus Schoutsen
parent
4e6fc3615b
commit
b09ab2dafb
@@ -9,6 +9,7 @@ from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ENTITY_MATCH_ALL,
|
||||
SERVICE_TURN_ON,
|
||||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
)
|
||||
from homeassistant.core import State
|
||||
@@ -177,6 +178,34 @@ async def test_restore_state(hass, entities, enable_custom_integrations):
|
||||
assert hass.states.get("scene.test").state == "2021-01-01T23:59:59+00:00"
|
||||
|
||||
|
||||
async def test_restore_state_does_not_restore_unavailable(
|
||||
hass, entities, enable_custom_integrations
|
||||
):
|
||||
"""Test we restore state integration but ignore unavailable."""
|
||||
mock_restore_cache(hass, (State("scene.test", STATE_UNAVAILABLE),))
|
||||
|
||||
light_1, light_2 = await setup_lights(hass, entities)
|
||||
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
scene.DOMAIN,
|
||||
{
|
||||
"scene": [
|
||||
{
|
||||
"name": "test",
|
||||
"entities": {
|
||||
light_1.entity_id: "on",
|
||||
light_2.entity_id: "on",
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("scene.test").state == STATE_UNKNOWN
|
||||
|
||||
|
||||
async def activate(hass, entity_id=ENTITY_MATCH_ALL):
|
||||
"""Activate a scene."""
|
||||
data = {}
|
||||
|
||||
Reference in New Issue
Block a user