mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +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:
|
async def async_will_remove_from_hass(self) -> None:
|
||||||
"""Disconnect device object when removed."""
|
"""Disconnect device object when removed."""
|
||||||
self._device.remove_callback(self.async_update_callback)
|
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)
|
self.gateway.entities[self.TYPE].remove(self.unique_id)
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
@ -34,7 +34,7 @@ from .errors import AuthenticationRequired, CannotConnect
|
|||||||
@callback
|
@callback
|
||||||
def get_gateway_from_config_entry(hass, config_entry):
|
def get_gateway_from_config_entry(hass, config_entry):
|
||||||
"""Return gateway with a matching bridge id."""
|
"""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:
|
class DeconzGateway:
|
||||||
@ -192,9 +192,6 @@ class DeconzGateway:
|
|||||||
"""
|
"""
|
||||||
gateway = get_gateway_from_config_entry(hass, entry)
|
gateway = get_gateway_from_config_entry(hass, entry)
|
||||||
|
|
||||||
if not gateway:
|
|
||||||
return
|
|
||||||
|
|
||||||
if gateway.api.host != gateway.host:
|
if gateway.api.host != gateway.host:
|
||||||
gateway.api.close()
|
gateway.api.close()
|
||||||
gateway.api.host = gateway.host
|
gateway.api.host = gateway.host
|
||||||
|
@ -113,9 +113,8 @@ async def test_gateway_setup_fails(hass):
|
|||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.deconz.gateway.get_gateway", side_effect=Exception
|
"homeassistant.components.deconz.gateway.get_gateway", side_effect=Exception
|
||||||
):
|
):
|
||||||
config_entry = await setup_deconz_integration(hass)
|
await setup_deconz_integration(hass)
|
||||||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
assert not hass.data[deconz.DOMAIN]
|
||||||
assert gateway is None
|
|
||||||
|
|
||||||
|
|
||||||
async def test_connection_status_signalling(hass):
|
async def test_connection_status_signalling(hass):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user