Mark entities as unavailable when they are removed but are still registered (#45528)

* Mark entities as unavailable when they are removed but are still registered

* Add sync_entity_lifecycle to collection helper

* Remove debug print

* Lint

* Fix tests

* Fix tests

* Update zha

* Update zone

* Fix tests

* Update hyperion

* Update rfxtrx

* Fix tests

* Pass force_remove=True from integrations

Co-authored-by: Erik <erik@montnemery.com>
This commit is contained in:
Paulus Schoutsen 2021-02-08 10:45:46 +01:00 committed by GitHub
parent aa005af266
commit 9e07910ab0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 439 additions and 222 deletions

View file

@ -19,7 +19,11 @@ from homeassistant.components.light import (
SUPPORT_TRANSITION,
)
from homeassistant.components.smartthings.const import DOMAIN, SIGNAL_SMARTTHINGS_UPDATE
from homeassistant.const import ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_SUPPORTED_FEATURES,
STATE_UNAVAILABLE,
)
from homeassistant.helpers.dispatcher import async_dispatcher_send
from .conftest import setup_platform
@ -304,4 +308,4 @@ async def test_unload_config_entry(hass, device_factory):
# Act
await hass.config_entries.async_forward_entry_unload(config_entry, "light")
# Assert
assert not hass.states.get("light.color_dimmer_2")
assert hass.states.get("light.color_dimmer_2").state == STATE_UNAVAILABLE