From 3b56dd15c25e5834af6cd703cb4c1a59cc771086 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Wed, 3 Oct 2018 15:19:37 +0200 Subject: [PATCH] Fix sonos async use * Entry setup wasn't using the async api. Fix this by using correct async api.s * Also use new async executor scheduler in async_added_to_hass. --- homeassistant/components/media_player/sonos.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/media_player/sonos.py b/homeassistant/components/media_player/sonos.py index b0c471aa602f0..0892c018926da 100644 --- a/homeassistant/components/media_player/sonos.py +++ b/homeassistant/components/media_player/sonos.py @@ -133,9 +133,9 @@ def add_entities(devices, update_before_add=False): """Sync version of async add devices.""" hass.add_job(async_add_entities, devices, update_before_add) - hass.add_job(_setup_platform, hass, - hass.data[SONOS_DOMAIN].get('media_player', {}), - add_entities, None) + hass.async_add_executor_job( + _setup_platform, hass, hass.data[SONOS_DOMAIN].get('media_player', {}), + add_entities, None) def _setup_platform(hass, config, add_entities, discovery_info): @@ -366,7 +366,7 @@ def __init__(self, player): async def async_added_to_hass(self): """Subscribe sonos events.""" self.hass.data[DATA_SONOS].devices.append(self) - self.hass.async_add_job(self._subscribe_to_player_events) + self.hass.async_add_executor_job(self._subscribe_to_player_events) @property def unique_id(self):