From 324ddfdaeb14e26a4e42ae22e6877410ab88a77e Mon Sep 17 00:00:00 2001 From: Nolan Gilley Date: Tue, 16 Aug 2016 23:53:00 -0400 Subject: [PATCH] fix flux_update service (#2792) * fix flux_update service * fix tests * give update service unique name * remove unnecessary param * Revert "fix tests" This reverts commit 2fd7760455f5389b0de2e3ce272090c551d87201. * fix flux_update --- homeassistant/components/switch/flux.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/switch/flux.py b/homeassistant/components/switch/flux.py index a66b45bc82e..61a40315620 100644 --- a/homeassistant/components/switch/flux.py +++ b/homeassistant/components/switch/flux.py @@ -101,7 +101,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None): """Update lights.""" flux.flux_update() - hass.services.register(DOMAIN, 'flux_update', update) + hass.services.register(DOMAIN, name + '_update', update) # pylint: disable=too-many-instance-attributes @@ -151,8 +151,10 @@ class FluxSwitch(SwitchDevice): self.update_ha_state() # pylint: disable=too-many-locals - def flux_update(self, now=dt_now()): + def flux_update(self, now=None): """Update all the lights using flux.""" + if now is None: + now = dt_now() sunset = next_setting(self.hass, SUN).replace(day=now.day, month=now.month, year=now.year)