happyleavesaoc / python-limitlessled Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
I noticed this with HomeAssistant. When my hub device was unplugged, the entire lights section (I think including some non-milight devices) was failing to initialize with an error that looked like this:
Traceback (most recent call last):
File "/usr/src/app/homeassistant/helpers/entity_component.py", line 153, in _async_setup_platform
entity_platform.schedule_add_entities, discovery_info
File "uvloop/future.pyx", line 230, in __iter__ (uvloop/loop.c:110600)
File "uvloop/future.pyx", line 432, in uvloop.loop.BaseTask._fast_wakeup (uvloop/loop.c:113980)
File "uvloop/future.pyx", line 101, in uvloop.loop.BaseFuture._result_impl (uvloop/loop.c:108900)
File "/usr/local/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/app/homeassistant/components/light/limitlessled.py", line 118, in setup_platform
lights.append(LimitlessLEDGroup.factory(group))
File "/usr/src/app/homeassistant/components/light/limitlessled.py", line 178, in factory
return LimitlessLEDRGBWWGroup(group)
File "/usr/src/app/homeassistant/components/light/limitlessled.py", line 314, in __init__
self.group.on = True
File "/usr/local/lib/python3.5/site-packages/limitlessled/group/__init__.py", line 83, in on
cmd = self.command_set.off()
File "/usr/local/lib/python3.5/site-packages/limitlessled/group/commands/v6.py", line 303, in off
return self._build_command(0x04, 0x02)
File "/usr/local/lib/python3.5/site-packages/limitlessled/group/commands/v6.py", line 111, in _build_command
self._group_number)
File "/usr/local/lib/python3.5/site-packages/limitlessled/group/commands/__init__.py", line 44, in __init__
self._bytes = bytearray(bytes)
TypeError: an integer is required
It looks like this is because it failed to fetch session ID bytes (wb1
and wb2
in the docs/code), so they remain set to None
. The code that builds a command packet tries to build a byte array with the session ID values being set to None
, which causes the above failure.
Seems like it might make sense to skip or queue commands that are being sent before a session has successfully started? If it makes sense to fail, seems like it'd be best to do so with a more helpful error message.
Hi everybody and thank you for the awesome job.
I'm using the library to control 2 RGB bulbs and 2 dual white cct leds via a iBox2 (v6) bridge.
Everything is fine with the RGB bulbs. They turn on and off without any problems.
Instead, I'm unable to control the 2 white leds. Here is the code I'm using.
from limitlessled.bridge import Bridge
from limitlessled.group.rgbw import RGBW
from limitlessled.group.rgbww import RGBWW
from limitlessled.group.white import WHITE
bridge = Bridge('192.168.1.77')
living = bridge.add_group(3,'living',WHITE)
living.on = True
I don't get any error messages. Simply, the lights don't turn on.
I'm able to control them using the Mi-Light Android app, choosing the Multizone temperature/brightness controller.
Am I doing something wrong?
Thank you!
Looking for someone with a V6 bridge who is willing to test and approve V6-bridge related pull requests. I only have a V5 bridge.
Looks like this is currently set to one second:
https://github.com/happyleavesaoc/python-limitlessled/blob/master/limitlessled/bridge.py#L26
This probably doesn't have any measurable negative effects, but thought I'd share some reasons it make make sense for this to be something closer to 5 seconds:
Hey! I have some RGB led strips hooked up to the latest mi-light module thing, and I've found that I'm unable to start a new connection shortly after I closed a previous one, both with this library and my own C# lib. The iOS app for mi-light does not have this issue however, so I'm wondering if there's a way to fix this issue?
It looks like #7 broke support for my version 5 bridge. I noticed this after upgrading Home Assistant the other day, suddenly my Limitlessled hub stopped responding. Working through it, it looks like there isn't any response from the bridge. E.g.
from limitlessled.bridge import Bridge
from limitlessled.group.rgbw import RGBW
b = Bridge("...", port=8899, version=5)
l = b.add_group(4, "lamp", RGBW)
l.on = True
does nothing, whereas if I downgrade to the commit tagged as 1.0.2 it works fine. Am I just doing something wrong? I'm willing to do the legwork to debug this and fix it, but I need a little guidance.
Hi!
The manufacturer of the device claims that the protocol v6 of the Wifi Bridge is bidirectional (https://forum.pimatic.org/topic/2567/milight-version-6). Does anyone know the commands to get the CURRENT on/off state or brightness/color from the device? (for when it wasn't changed through this python interface)
Just wondering if I can get some feedback on a script I am running.
Script runs without error and ngrep verifies that I am definitely sending the commands to the bridge but no commands are working.
Presently, my script is as follows:
from limitlessled.bridge import Bridge
from limitlessled.group.rgbww import RGBWW
bridge = Bridge('192.168.1.61')
bridge.add_group(1, 'living', RGBWW)
living = bridge.add_group(1, 'living', RGBWW)
living.on = True
Recently I installed a RGB CCT ledstrip over the full length of my living room. The dream is to use an Amazon echo dot with a harmony hub so I can start a movie activity by voice and the tv, receiver, firetv are all turned on, as well as the led strip.
I'm trying to control the ledstrip with Home Assistant through the build-in python-limitlessled library. But can't get it to work. After lots of browsing I found out the LS2 controller I'm using talks a different protocol.
I found a Java bridge emulator with which I can log the traffic between the app and the bridge.
Hopefully you guys can use this to update the library with support for the new milight components.
On Zone 1
22 Bytes From App (192.168.2.8) Tue Jan 02 18:39:12 CET 2018
80 00 00 00 11 B9 01 00 12 00 31 00 00 0A 06 01 00 00 00 01 00 43
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:39:12 CET 2018
88 00 00 00 03 00 12 00
Off Zone 1
22 Bytes From App (192.168.2.8) Tue Jan 02 18:39:53 CET 2018
80 00 00 00 11 B9 01 00 15 00 31 00 00 0A 06 02 00 00 00 01 00 44
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:39:53 CET 2018
88 00 00 00 03 00 15 00
On Zone 2
22 Bytes From App (192.168.2.8) Tue Jan 02 18:41:02 CET 2018
80 00 00 00 11 B9 01 00 17 00 31 00 00 0A 06 01 00 00 00 02 00 44
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:41:02 CET 2018
88 00 00 00 03 00 17 00
Off Zone 2
22 Bytes From App (192.168.2.8) Tue Jan 02 18:41:42 CET 2018
80 00 00 00 11 B9 01 00 18 00 31 00 00 0A 06 02 00 00 00 02 00 45
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:41:42 CET 2018
88 00 00 00 03 00 18 00
On Zone All
22 Bytes From App (192.168.2.8) Tue Jan 02 18:42:57 CET 2018
80 00 00 00 11 B9 01 00 1B 00 31 00 00 0A 06 01 00 00 00 00 00 42
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:42:57 CET 2018
88 00 00 00 03 00 1B 00
Off Zone All
22 Bytes From App (192.168.2.8) Tue Jan 02 18:43:10 CET 2018
80 00 00 00 11 B9 01 00 1C 00 31 00 00 0A 06 02 00 00 00 00 00 43
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:43:10 CET 2018
88 00 00 00 03 00 1C 00
Keep alive (every 10s)
7 Bytes From App (192.168.2.8) Tue Jan 02 18:44:18 CET 2018
D0 00 00 00 02 B9 01
12 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:44:18 CET 2018
D8 00 00 00 07 AC CF 23 F5 7A D4 01
Change color Blue Zone 1
22 Bytes From App (192.168.2.8) Tue Jan 02 18:45:41 CET 2018
80 00 00 00 11 B9 01 00 20 00 31 00 00 0A 01 AB AB AB AB 01 00 E9
22 Bytes From App (192.168.2.8) Tue Jan 02 18:45:41 CET 2018
80 00 00 00 11 B9 01 00 21 00 31 00 00 0A 01 AB AB AB AB 01 00 E9
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:45:42 CET 2018
88 00 00 00 03 00 20 00
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:45:42 CET 2018
88 00 00 00 03 00 21 00
Change color Red Zone 1
22 Bytes From App (192.168.2.8) Tue Jan 02 18:46:20 CET 2018
80 00 00 00 11 B9 01 00 22 00 31 00 00 0A 01 FD FD FD FD 01 00 31
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:46:20 CET 2018
88 00 00 00 03 00 22 00
22 Bytes From App (192.168.2.8) Tue Jan 02 18:46:21 CET 2018
80 00 00 00 11 B9 01 00 23 00 31 00 00 0A 01 FD FD FD FD 01 00 31
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:46:21 CET 2018
88 00 00 00 03 00 23 00
Change Saturation Zone 1 full warm
22 Bytes From App (192.168.2.8) Tue Jan 02 18:48:01 CET 2018
80 00 00 00 11 B9 01 00 24 00 31 00 00 0A 03 00 00 00 00 01 00 3F
22 Bytes From App (192.168.2.8) Tue Jan 02 18:48:01 CET 2018
80 00 00 00 11 B9 01 00 25 00 31 00 00 0A 03 00 00 00 00 01 00 3F
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:48:01 CET 2018
88 00 00 00 03 00 24 00
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:48:01 CET 2018
88 00 00 00 03 00 25 00
Change Saturation Zone 1 full bright
22 Bytes From App (192.168.2.8) Tue Jan 02 18:48:34 CET 2018
80 00 00 00 11 B9 01 00 26 00 31 00 00 0A 03 60 00 00 00 01 00 9F
22 Bytes From App (192.168.2.8) Tue Jan 02 18:48:34 CET 2018
80 00 00 00 11 B9 01 00 27 00 31 00 00 0A 03 60 00 00 00 01 00 9F
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:48:34 CET 2018
88 00 00 00 03 00 26 00
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:48:34 CET 2018
88 00 00 00 03 00 27 00
Change Brightness Zone 1 least bright
22 Bytes From App (192.168.2.8) Tue Jan 02 18:49:37 CET 2018
80 00 00 00 11 B9 01 00 28 00 31 00 00 0A 04 01 00 00 00 01 00 41
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:49:37 CET 2018
88 00 00 00 03 00 28 00
22 Bytes From App (192.168.2.8) Tue Jan 02 18:49:37 CET 2018
80 00 00 00 11 B9 01 00 29 00 31 00 00 0A 04 01 00 00 00 01 00 41
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:49:38 CET 2018
88 00 00 00 03 00 29 00
Change Brightness Zone 1 most bright
22 Bytes From App (192.168.2.8) Tue Jan 02 18:50:04 CET 2018
80 00 00 00 11 B9 01 00 2A 00 31 00 00 0A 04 61 00 00 00 01 00 A1
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:50:04 CET 2018
88 00 00 00 03 00 2A 00
22 Bytes From App (192.168.2.8) Tue Jan 02 18:50:04 CET 2018
80 00 00 00 11 B9 01 00 2B 00 31 00 00 0A 04 61 00 00 00 01 00 A1
8 Bytes From Bridge (192.168.2.21) Tue Jan 02 18:50:04 CET 2018
88 00 00 00 03 00 2B 00
Hi,
I note the library doesn't appear to currently support RGB lights. Although limitless stopped selling the plain RGB ones a while ago there are other people currently making things which are compatible with them - like pool lights (http://www.davey.com.au/products/pool-lights/pal-4000-series-led-lights-with-remote-control.html)
The RGB commands are documented under "LimitlessLED RGB CommandSet " on http://www.limitlessled.com/dev/ . The main problem I can see is that there's no concept of a group with the RGB ones, so I'm not sure how to integrate it into the existing paradigm - perhaps only allow creation of group '1' of type RGB?
How do I turn on a bulb which is in Zone 5 on the 8-zone remote?
From SSH, is this done using a command, or do I need to install something to make this work?
Is it possible to add support for the new wifi bridges? I just bought one and would like to use it with this library. The specs have been published here: http://www.limitlessled.com/dev/
Hi,
I cannot control my MiLight version 6 bridge led from my PC with Python Limitlessled. Here is my code to switch the color of the bridge led :
` from limitlessled.bridge import Bridge
from limitlessled.group.rgbw import RGBW
from limitlessled.group.rgbww import RGBWW
from limitlessled.group.white import WHITE
bridge = Bridge('192.168.0.44')
bridge_led = bridge.bridge_led
bridge_led.on = True
from limitlessled import Color
bridge_led.color = Color(255, 0, 0) # red `
Am I missing something ? No error message, but nothing happens.
I have successfully tested the IP address and the port using a java https://github.com/JasperG/Colorland or a windows app http://www.limitlessled.com/download/LimitlessLEDv6.zip. Both app allow me to switch the color of the brige led.
Could you advice some other test I could use to find the cause of my fail ?
Thanks
Could you release a new version of this package on pypi (so I can use easily my patch) ?
Thanks
Would you like to implement the disco-mode and the 8 different party-modes?
There is another not so updated lib that have them implemented here that might be easy to adapt them from ?
https://github.com/McSwindler/python-milight/blob/master/milight/rgbw.py
My guess is that the thread crashes here:
https://github.com/happyleavesaoc/python-limitlessled/blob/master/limitlessled/bridge.py#L230
Because
self._send_raw(command)
Is throwing a socket exception with something like "no route to host".
The effect is that a hub going offline for more than 20 seconds or so causes the client to stop working until _reconnect
is force-called.
Does anyone have time to sniff the link/unlink commands for the legacy rgbw and white lights?
The RGBW group set the target color to None
if there is a transition from RGB_WHITE
(https://github.com/happyleavesaoc/python-limitlessled/blob/master/limitlessled/group/rgbw.py#L117). It then calls hue_of_color(color)
(https://github.com/happyleavesaoc/python-limitlessled/blob/master/limitlessled/group/rgbw.py#L129) which causes a TypeError: 'NoneType' object is not iterable
:
Traceback (most recent call last):
File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
File "/home/hass/.homeassistant/deps/limitlessled/pipeline.py", line 32, in run
self._queue.get().run(self._event)
File "/home/hass/.homeassistant/deps/limitlessled/pipeline.py", line 109, in run
self._execute_stage(i, stage, stop)
File "/home/hass/.homeassistant/deps/limitlessled/pipeline.py", line 167, in _execute_stage
self._group.transition(*stage.args, **stage.kwargs)
File "/home/hass/.homeassistant/deps/limitlessled/group/rgbw.py", line 129, in transition
self._transition(duration, hue_of_color(color), brightness)
File "/home/hass/.homeassistant/deps/limitlessled/util.py", line 15, in hue_of_color
return rgb_to_hsv(*[x / 255 for x in color])[0]
TypeError: 'NoneType' object is not iterable
I have a single color MiLight led controller and i can't get it to work with python-limitlessled. I'm running the following python code:
from limitlessled.bridge import Bridge
from limitlessled.group.rgbw import RGBW
from limitlessled.group.rgbww import RGBWW
from limitlessled.group.white import WHITE
bridge = Bridge('192.168.0.42')
# A group number can support two groups as long as the types differ
bridge.add_group(1, 'hoek', WHITE)
hoek = bridge.add_group(1, 'hoek', WHITE)
hoek.on = True
Does someone has any idea? is the single color led controller supported?
Hey,
thaks for the great Work.
Currently i have a problem if i try to start my programm:
Traceback (most recent call last): File "test.py", line 2, in <module> from limitlessled.bridge import Bridge File "/usr/local/lib/python2.7/dist-packages/limitlessled/bridge.py", line 3, in <module> import queue ImportError: No module named queue
Is there a solution for this?
\Zmash
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.