mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix handling with register callbacks on added_to_hass (#7067)
This commit is contained in:
parent
f06cff35ff
commit
e026717239
@ -77,8 +77,10 @@ class LutronCasetaDevice(Entity):
|
||||
@asyncio.coroutine
|
||||
def async_added_to_hass(self):
|
||||
"""Register callbacks."""
|
||||
self._smartbridge.add_subscriber(self._device_id,
|
||||
self._update_callback)
|
||||
self.hass.async_add_job(
|
||||
self._smartbridge.add_subscriber, self._device_id,
|
||||
self._update_callback
|
||||
)
|
||||
|
||||
def _update_callback(self):
|
||||
self.schedule_update_ha_state()
|
||||
|
@ -292,7 +292,7 @@ class SonosDevice(MediaPlayerDevice):
|
||||
@asyncio.coroutine
|
||||
def async_added_to_hass(self):
|
||||
"""Subscribe sonos events."""
|
||||
self.hass.loop.run_in_executor(None, self._subscribe_to_player_events)
|
||||
self.hass.async_add_job(self._subscribe_to_player_events)
|
||||
|
||||
@property
|
||||
def should_poll(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user