From 494a776959141c11eb0a0b3f36f167380cd92ee0 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Sat, 29 Apr 2017 22:24:18 +0200 Subject: [PATCH] LIFX: avoid warnings about already running updates Forcing a refresh will log a warning if the periodic async_update happens to be running already. So let's do the refresh locally and remove the force_refresh. --- homeassistant/components/light/lifx/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/light/lifx/__init__.py b/homeassistant/components/light/lifx/__init__.py index 22e7ee04fcc..01038814f51 100644 --- a/homeassistant/components/light/lifx/__init__.py +++ b/homeassistant/components/light/lifx/__init__.py @@ -263,17 +263,19 @@ class LIFXLight(Light): """Return the list of supported effects.""" return lifx_effects.effect_list() - @callback + @asyncio.coroutine def update_after_transition(self, now): """Request new status after completion of the last transition.""" self.postponed_update = None - self.hass.async_add_job(self.async_update_ha_state(force_refresh=True)) + yield from self.refresh_state() + yield from self.async_update_ha_state() - @callback + @asyncio.coroutine def unblock_updates(self, now): """Allow async_update after the new state has settled on the bulb.""" self.blocker = None - self.hass.async_add_job(self.async_update_ha_state(force_refresh=True)) + yield from self.refresh_state() + yield from self.async_update_ha_state() def update_later(self, when): """Block immediate update requests and schedule one for later."""