Fix handling with register callbacks on added_to_hass (#7067)
This commit is contained in:
parent
f06cff35ff
commit
e026717239
2 changed files with 5 additions and 3 deletions
|
@ -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…
Add table
Reference in a new issue