1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Use config_entry.on_unload rather than local listener implementation in Axis (#49495)

This commit is contained in:
Robert Svensson
2021-04-20 20:53:05 +02:00
committed by GitHub
parent 63616a9e36
commit 12a9695798
5 changed files with 5 additions and 10 deletions

View File

@@ -58,8 +58,6 @@ class AxisNetworkDevice:
self.fw_version = None
self.product_type = None
self.listeners = []
@property
def host(self):
"""Return the host address of this device."""
@@ -190,7 +188,7 @@ class AxisNetworkDevice:
status = {}
if status.get("data", {}).get("status", {}).get("state") == "active":
self.listeners.append(
self.config_entry.async_on_unload(
await mqtt.async_subscribe(
hass, f"{self.api.vapix.serial_number}/#", self.mqtt_message
)
@@ -279,9 +277,6 @@ class AxisNetworkDevice:
if not unload_ok:
return False
for unsubscribe_listener in self.listeners:
unsubscribe_listener()
return True