1
Python Scripting / Re: milight (limitlessled) control python module error
« on: March 04, 2015, 02:35:08 PM »
That sounds good, Off to work now so will have a play when I get home then. thanks for the help
Mark
Mark
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
I probably didn't read the original post carefully enough. Sorry about that!
import ledcontroller
led = ledcontroller.LedController("ip.ad.re.ss")
led.on(1) # the command
This works in eventghost fine however when i try using it in voxcommando I get an errorpython ready
Line: 168 >>
TypeError: expected str, got bytes
being a noob to python I could not fix this (nor can I now!) so I bypassed python in vox and passed payloads to eventghost to run the python. After a few days of learning python I came up with this bit of codeimport eg
import ledcontroller
led = ledcontroller.LedController("192.168.0.115")
red, royal_blue, green, yellow, white = "red", "royal_blue", "green", "yellow", "white"
a, b, c, d, e, f, g, h, i, j = "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"
main_light, side_light, back_light, living_room_lights, dinning_room_light = 1, 4, 2, 0, 3
on = "on"
off = "off"
v = "set_brightness"
w = "set_color"
y = eg.event.payload[1]
x = eg.event.payload[2]
z = "led."
group = [main_light, side_light, back_light, living_room_lights, dinning_room_light]
power = [on, off]
colour = [red, royal_blue, green, yellow, white]
dim = [a, b, c, d, e, f, g, h, i, j,]
if x in group:
x = x
if y in power:
mycommand = z + y +"(" + (x) + ")"
exec mycommand
if y in colour:
mycommand = z + w + "(" + '"' + y + '"' + ", " + x + ")"
print mycommand
exec mycommand
if y in dim:
mycommand = z + v + "(" + y + ", " + x + ")"
exec mycommand
print x
print y