Fix deconz tests that have uncaught exceptions (#33462)
This commit is contained in:
parent
977f1a6916
commit
f2f03cf552
3 changed files with 7 additions and 9 deletions
|
@ -86,9 +86,10 @@ class DeconzDevice(DeconzBase, Entity):
|
|||
async def async_will_remove_from_hass(self) -> None:
|
||||
"""Disconnect device object when removed."""
|
||||
self._device.remove_callback(self.async_update_callback)
|
||||
del self.gateway.deconz_ids[self.entity_id]
|
||||
for unsub_dispatcher in self.listeners:
|
||||
unsub_dispatcher()
|
||||
if self.entity_id in self.gateway.deconz_ids:
|
||||
del self.gateway.deconz_ids[self.entity_id]
|
||||
for unsub_dispatcher in self.listeners:
|
||||
unsub_dispatcher()
|
||||
|
||||
async def async_remove_self(self, deconz_ids: list) -> None:
|
||||
"""Schedule removal of this entity.
|
||||
|
|
|
@ -31,7 +31,7 @@ from .errors import AuthenticationRequired, CannotConnect
|
|||
@callback
|
||||
def get_gateway_from_config_entry(hass, config_entry):
|
||||
"""Return gateway with a matching bridge id."""
|
||||
return hass.data[DOMAIN][config_entry.unique_id]
|
||||
return hass.data[DOMAIN].get(config_entry.unique_id)
|
||||
|
||||
|
||||
class DeconzGateway:
|
||||
|
@ -126,6 +126,8 @@ class DeconzGateway:
|
|||
Causes for this is either discovery updating host address or config entry options changing.
|
||||
"""
|
||||
gateway = get_gateway_from_config_entry(hass, entry)
|
||||
if not gateway:
|
||||
return
|
||||
if gateway.api.host != entry.data[CONF_HOST]:
|
||||
gateway.api.close()
|
||||
gateway.api.host = entry.data[CONF_HOST]
|
||||
|
|
|
@ -6,11 +6,6 @@ IGNORE_UNCAUGHT_EXCEPTIONS = [
|
|||
("tests.components.cast.test_media_player", "test_entry_setup_platform_not_ready"),
|
||||
("tests.components.config.test_automation", "test_delete_automation"),
|
||||
("tests.components.config.test_group", "test_update_device_config"),
|
||||
("tests.components.deconz.test_binary_sensor", "test_allow_clip_sensor"),
|
||||
("tests.components.deconz.test_climate", "test_clip_climate_device"),
|
||||
("tests.components.deconz.test_init", "test_unload_entry_multiple_gateways"),
|
||||
("tests.components.deconz.test_light", "test_disable_light_groups"),
|
||||
("tests.components.deconz.test_sensor", "test_allow_clip_sensors"),
|
||||
("tests.components.default_config.test_init", "test_setup"),
|
||||
("tests.components.demo.test_init", "test_setting_up_demo"),
|
||||
("tests.components.discovery.test_init", "test_discover_config_flow"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue