Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osram Lightify throwing "struct.error: ubyte" when trying to change colors #3089

Closed
tchellomello opened this issue Sep 1, 2016 · 3 comments · Fixed by #4256
Closed

Osram Lightify throwing "struct.error: ubyte" when trying to change colors #3089

tchellomello opened this issue Sep 1, 2016 · 3 comments · Fixed by #4256

Comments

@tchellomello
Copy link
Contributor

tchellomello commented Sep 1, 2016

Home Assistant release (hass --version):
0.27.1

Python release (python3 --version):
3.5.2

Component/platform:
lights/osramlightify

Description of problem:

  1. Lights are recognized as a Python object
  2. I was able to change the color via frontend a few times
  3. After some time, cannot change the color anymore and throws this traceback

Restarting HASS brings the functionality back

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

lights:
   - platform: osramlightify
     host: 192.168.XX.XX

Traceback (if applicable):

Sep  1 01:17:12 tchellopi hass[5910]: #033[31m16-09-01 01:17:12 ERROR (ThreadPool Worker 3) [homeassistant.core] BusHandler:Exception doing job#033[0m
Sep  1 01:17:12 tchellopi hass[5910]: Traceback (most recent call last):
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/core.py", line 852, in job_handler
Sep  1 01:17:12 tchellopi hass[5910]: func(*args)
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/core.py", line 717, in _execute_service
Sep  1 01:17:12 tchellopi hass[5910]: service(call)
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/core.py", line 572, in __call__
Sep  1 01:17:12 tchellopi hass[5910]: self.func(call)
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/components/light/__init__.py", line 236, in handle_light_service
Sep  1 01:17:12 tchellopi hass[5910]: light.turn_on(**params)
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/components/light/osramlightify.py", line 141, in turn_on
Sep  1 01:17:12 tchellopi hass[5910]: self._light.set_rgb(red, green, blue, fade)
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.homeassistant/deps/lightify/__init__.py", line 140, in set_rgb
Sep  1 01:17:12 tchellopi hass[5910]: super(Light, self).set_rgb(r, g, b, time)
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.homeassistant/deps/lightify/__init__.py", line 79, in set_rgb
Sep  1 01:17:12 tchellopi hass[5910]: data = self.__conn.build_colour(self, r, g, b, time)
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.homeassistant/deps/lightify/__init__.py", line 311, in build_colour
Sep  1 01:17:12 tchellopi hass[5910]: struct.pack("<BBBBH", red, green, blue, 0xff, time)
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.homeassistant/deps/lightify/__init__.py", line 152, in build_command
Sep  1 01:17:12 tchellopi hass[5910]: return self.__conn.build_light_command(command, self, data)
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.homeassistant/deps/lightify/__init__.py", line 293, in build_light_command
Sep  1 01:17:12 tchellopi hass[5910]: data
Sep  1 01:17:12 tchellopi hass[5910]: File "/home/hass/.homeassistant/deps/lightify/__init__.py", line 261, in build_basic_command
Sep  1 01:17:12 tchellopi hass[5910]: ) + group_or_light + data
Sep  1 01:17:12 tchellopi hass[5910]: struct.error: ubyte format requires 0 <= number <= 255#033[0m

Another example:

Sep  1 01:20:00 tchellopi hass[5910]: #033[31m16-09-01 01:20:00 ERROR (ThreadPool Worker 1) [homeassistant.core] BusHandler:Exception doing job#033[0m
Sep  1 01:20:00 tchellopi hass[5910]: Traceback (most recent call last):
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/core.py", line 852, in job_handler
Sep  1 01:20:00 tchellopi hass[5910]: func(*args)
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/helpers/event.py", line 179, in pattern_time_change_listener
Sep  1 01:20:00 tchellopi hass[5910]: action(now)
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 180, in _update_entity_states
Sep  1 01:20:00 tchellopi hass[5910]: entity.update_ha_state(True)
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 154, in update_ha_state
Sep  1 01:20:00 tchellopi hass[5910]: self.update()
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/components/light/osramlightify.py", line 166, in update
Sep  1 01:20:00 tchellopi hass[5910]: self.update_lights(no_throttle=True)
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
Sep  1 01:20:00 tchellopi hass[5910]: result = method(*args, **kwargs)
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 296, in wrapper
Sep  1 01:20:00 tchellopi hass[5910]: result = method(*args, **kwargs)
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.virtualenvs/home_assistant/lib/python3.5/site-packages/homeassistant/components/light/osramlightify.py", line 64, in update_lights
Sep  1 01:20:00 tchellopi hass[5910]: bridge.update_all_light_status()
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.homeassistant/deps/lightify/__init__.py", line 430, in update_all_light_status
Sep  1 01:20:00 tchellopi hass[5910]: data = self.build_all_light_status(1)
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.homeassistant/deps/lightify/__init__.py", line 320, in build_all_light_status
Sep  1 01:20:00 tchellopi hass[5910]: struct.pack("<B", flag)
Sep  1 01:20:00 tchellopi hass[5910]: File "/home/hass/.homeassistant/deps/lightify/__init__.py", line 232, in build_global_command
Sep  1 01:20:00 tchellopi hass[5910]: self.next_seq()
Sep  1 01:20:00 tchellopi hass[5910]: struct.error: ubyte format requires 0 <= number <= 255#033[0m

Additional info:
I'm doing some investigation. The issue happens randomly.

@ktpx
Copy link

ktpx commented Sep 1, 2016

Known issue: https://community.home-assistant.io/t/written-some-osram-lightify-support/43/13

There's a quick workaround, but nothing has been pushed upstream.

@tchellomello
Copy link
Contributor Author

Hello @ktpx, I'm following up that thread to check if we can come with a solution for this problem.

Thank you!

@tchellomello
Copy link
Contributor Author

If you are hitting this issue, take a look at https://community.home-assistant.io/t/written-some-osram-lightify-support/43/63

Leaving it open for now since @tfriedel and @MindrustUK will send a PR.

@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants