From 5315fb14a3b22022975f131f3acad444748992e1 Mon Sep 17 00:00:00 2001 From: Nate Clark Date: Wed, 16 May 2018 14:45:35 -0400 Subject: [PATCH] make device_discovered synchronous --- homeassistant/components/konnected.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/konnected.py b/homeassistant/components/konnected.py index 8c5578f10e4700..b8bbd29aaed3d2 100644 --- a/homeassistant/components/konnected.py +++ b/homeassistant/components/konnected.py @@ -87,19 +87,19 @@ async def async_setup(hass, config): if DOMAIN not in hass.data: hass.data[DOMAIN] = {CONF_ACCESS_TOKEN: access_token} - async def async_device_discovered(service, info): + def device_discovered(service, info): """Call when a Konnected device has been discovered.""" _LOGGER.debug("Discovered a new Konnected device: %s", info) host = info.get(CONF_HOST) port = info.get(CONF_PORT) device = KonnectedDevice(hass, host, port, cfg) - await device.async_setup() + device.setup() discovery.async_listen( hass, SERVICE_KONNECTED, - async_device_discovered) + device_discovered) hass.http.register_view(KonnectedView(access_token)) @@ -121,17 +121,17 @@ def __init__(self, hass, host, port, config): self.status = self.client.get_status() _LOGGER.info('Initialized Konnected device %s', self.device_id) - async def async_setup(self): + def setup(self): """Set up a newly discovered Konnected device.""" user_config = self.config() if user_config: _LOGGER.debug('Configuring Konnected device %s', self.device_id) self.save_data() - await self.async_sync_device_config() - await discovery.async_load_platform( + self.sync_device_config() + discovery.load_platform( self.hass, 'binary_sensor', DOMAIN, {'device_id': self.device_id}) - await discovery.async_load_platform( + discovery.load_platform( self.hass, 'switch', DOMAIN, {'device_id': self.device_id}) @@ -235,7 +235,7 @@ def actuator_configuration(self): for p, data in self.stored_configuration[CONF_SWITCHES].items()] - async def async_sync_device_config(self): + def sync_device_config(self): """Sync the new pin configuration to the Konnected device.""" desired_sensor_configuration = self.sensor_configuration() current_sensor_configuration = [