mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 23:37:18 +00:00
Switch harmony to async_on_remove (#34378)
This commit is contained in:
parent
71c8fcee20
commit
b78b705e32
@ -166,7 +166,6 @@ class HarmonyRemote(remote.RemoteDevice):
|
|||||||
self.delay_secs = delay_secs
|
self.delay_secs = delay_secs
|
||||||
self._available = False
|
self._available = False
|
||||||
self._unique_id = unique_id
|
self._unique_id = unique_id
|
||||||
self._undo_dispatch_subscription = None
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def activity_names(self):
|
def activity_names(self):
|
||||||
@ -181,11 +180,6 @@ class HarmonyRemote(remote.RemoteDevice):
|
|||||||
|
|
||||||
return activities
|
return activities
|
||||||
|
|
||||||
async def async_will_remove_from_hass(self):
|
|
||||||
"""Undo subscription."""
|
|
||||||
if self._undo_dispatch_subscription:
|
|
||||||
self._undo_dispatch_subscription()
|
|
||||||
|
|
||||||
async def _async_update_options(self, data):
|
async def _async_update_options(self, data):
|
||||||
"""Change options when the options flow does."""
|
"""Change options when the options flow does."""
|
||||||
if ATTR_DELAY_SECS in data:
|
if ATTR_DELAY_SECS in data:
|
||||||
@ -205,10 +199,12 @@ class HarmonyRemote(remote.RemoteDevice):
|
|||||||
disconnect=self.got_disconnected,
|
disconnect=self.got_disconnected,
|
||||||
)
|
)
|
||||||
|
|
||||||
self._undo_dispatch_subscription = async_dispatcher_connect(
|
self.async_on_remove(
|
||||||
self.hass,
|
async_dispatcher_connect(
|
||||||
f"{HARMONY_OPTIONS_UPDATE}-{self.unique_id}",
|
self.hass,
|
||||||
self._async_update_options,
|
f"{HARMONY_OPTIONS_UPDATE}-{self.unique_id}",
|
||||||
|
self._async_update_options,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Store Harmony HUB config, this will also update our current
|
# Store Harmony HUB config, this will also update our current
|
||||||
|
Loading…
x
Reference in New Issue
Block a user