home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.45k stars 30.69k forks source link

Flux Light Adjustment puts LimitlessLED lights in broken state #3541

Closed bobdrummond closed 8 years ago

bobdrummond commented 8 years ago

Home Assistant release (hass --version): 0.28.2

Python release (python3 --version): 3.4.5

Component/platform: Flux Light Adjustment and/or LimitlessLED

Description of problem: Flux Light Adjustment component sets the values of lights every 30 seconds. The first update on a Limitless LED light is successful, but on the second update, which requires no action, an Exception is thrown by the LimitlessLED. After this, that light doesn't respond to commands from the web UI. This happens per light. I just took a walk through my house, confirmed each was responding on and off, and then watched Flux stick it on and dim.

Expected: The LimitlessLED lights do not go unresponsive.

Problem-relevant configuration.yaml entries and steps to reproduce:

switch:
  - platform: flux
    lights:
      - light.office

light:
  - platform: limitlessled
    - bridges:
      - host: 10.0.4.2
        version: 5
        port: 8899
        groups:
          - number: 1
            type: rgbw
            name: Office
  1. Turn on Flux and the light after stop_time.
  2. Observe

Traceback (if applicable):

main_1  | 16-09-26 22:30:30 INFO (ThreadPool Worker 21) [homeassistant.components.switch.flux] Lights updated to x:0.591 y:0.395 brightness:119, 100% of night cycle complete at 2016-09-26 22:30:30.501132-04:00
main_1  | Exception in thread Thread-5:
main_1  | Traceback (most recent call last):
main_1  |   File "/usr/local/lib/python3.4/threading.py", line 911, in _bootstrap_inner
main_1  |     self.run()
main_1  |   File "/usr/local/lib/python3.4/site-packages/limitlessled/pipeline.py", line 32, in run
main_1  |     self._queue.get().run(self._event)
main_1  |   File "/usr/local/lib/python3.4/site-packages/limitlessled/pipeline.py", line 109, in run
main_1  |     self._execute_stage(i, stage, stop)
main_1  |   File "/usr/local/lib/python3.4/site-packages/limitlessled/pipeline.py", line 163, in _execute_stage
main_1  |     self._group.transition(*stage.args, **stage.kwargs)
main_1  |   File "/usr/local/lib/python3.4/site-packages/limitlessled/group/rgbw.py", line 145, in transition
main_1  |     self._transition(duration, color, brightness)
main_1  |   File "/usr/local/lib/python3.4/site-packages/limitlessled/group/__init__.py", line 34, in wrapper
main_1  |     function(self, *args, **kwargs)
main_1  |   File "/usr/local/lib/python3.4/site-packages/limitlessled/group/rgbw.py", line 168, in _transition
main_1  |     wait = self._wait(duration, total)
main_1  |   File "/usr/local/lib/python3.4/site-packages/limitlessled/group/__init__.py", line 116, in _wait
main_1  |     wait = (duration / commands) - \
main_1  | ZeroDivisionError: division by zero

Additional info: I'm guessing from the traceback that the light is getting an empty list of commands. I'd be really happy to fix this with a little guidance. I've taken a look at the code, and I'm not sure whether it's a bug in the way Home Assistant is calling the limitlessled package, or a bug in that package.

bobdrummond commented 8 years ago

Will be fixed by https://github.com/home-assistant/home-assistant/pull/3552