mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Revert partial changes to deCONZ integration from earlier PR (#41943)
This commit is contained in:
parent
23b3db08f3
commit
85ccff28cd
@ -81,8 +81,7 @@ 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)
|
||||
if self.entity_id in self.gateway.deconz_ids:
|
||||
del self.gateway.deconz_ids[self.entity_id]
|
||||
del self.gateway.deconz_ids[self.entity_id]
|
||||
self.gateway.entities[self.TYPE].remove(self.unique_id)
|
||||
|
||||
@callback
|
||||
|
@ -34,7 +34,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].get(config_entry.unique_id)
|
||||
return hass.data[DOMAIN][config_entry.unique_id]
|
||||
|
||||
|
||||
class DeconzGateway:
|
||||
@ -192,9 +192,6 @@ class DeconzGateway:
|
||||
"""
|
||||
gateway = get_gateway_from_config_entry(hass, entry)
|
||||
|
||||
if not gateway:
|
||||
return
|
||||
|
||||
if gateway.api.host != gateway.host:
|
||||
gateway.api.close()
|
||||
gateway.api.host = gateway.host
|
||||
|
@ -113,9 +113,8 @@ async def test_gateway_setup_fails(hass):
|
||||
with patch(
|
||||
"homeassistant.components.deconz.gateway.get_gateway", side_effect=Exception
|
||||
):
|
||||
config_entry = await setup_deconz_integration(hass)
|
||||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
||||
assert gateway is None
|
||||
await setup_deconz_integration(hass)
|
||||
assert not hass.data[deconz.DOMAIN]
|
||||
|
||||
|
||||
async def test_connection_status_signalling(hass):
|
||||
|
Loading…
x
Reference in New Issue
Block a user