Skip to content

Commit

Permalink
Fixed listeners unload after integration is removed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaae committed Jan 24, 2022
1 parent 556d550 commit f1268ad
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions custom_components/mikrotik_router/mikrotik_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,24 @@ def __init__(self, hass, config_entry):

self.major_fw_version = 0

self._force_update_callback = None
self._force_fwupdate_check_callback = None
self._async_ping_tracked_hosts_callback = None

self.async_mac_lookup = AsyncMacLookup()
# self.async_mac_lookup.update_vendors()

async def async_init(self):
self._force_update_callback = async_track_time_interval(
self.hass, self.force_update, self.option_scan_interval
self.listeners.append(
async_track_time_interval(
self.hass, self.force_update, self.option_scan_interval
)
)
self._force_fwupdate_check_callback = async_track_time_interval(
self.hass, self.force_fwupdate_check, timedelta(hours=1)
self.listeners.append(
async_track_time_interval(
self.hass, self.force_fwupdate_check, timedelta(hours=1)
)
)
self._async_ping_tracked_hosts_callback = async_track_time_interval(
self.hass, self.async_ping_tracked_hosts, timedelta(seconds=15)
self.listeners.append(
async_track_time_interval(
self.hass, self.async_ping_tracked_hosts, timedelta(seconds=15)
)
)

# ---------------------------
Expand Down

0 comments on commit f1268ad

Please sign in to comment.