Page 1 of 1

Philips Hue Color - setting color with LUA but without http?

Posted: Thursday 11 February 2016 11:53
by Toumal
Hey there,

I read through all the hue-related wiki entries and forum posts but everyone is talking about how to write a script that sends http requests to the hue bridge...

I don't care about any of that, and I see that the Hue color is supported in the latest stable of Domoticz just fine. All I want to know is how to control the color via LUA script.

I know how to send brightness changes (commandArray[Light]="Set Level 100") but how do I change the color in the same manner? I see the web interface of domoticz supports this already, so surely this should also be exposed to lua scripting, no?
Any clues would be appreciated!

Re: Philips Hue Color - setting color with LUA but without http?

Posted: Monday 15 February 2016 1:06
by deennoo
Have you try this for dimming ?

/json.htm?type=command&param=switchlight&idx=99&switchcmd=Set%20Level&level=6

Source : https://www.domoticz.com/wiki/Domoticz_ ... tain_level

Nothing is explain for color, on my side i create some scène with specific color, a scène/groupe can be activate via JSON

https://www.domoticz.com/wiki/Domoticz_ ... .2F_Groups

Re: Philips Hue Color - setting color with LUA but without http?

Posted: Monday 15 February 2016 8:15
by Toumal
Dimming works without any tricks, just "Set Level 100" without any need for using the REST API. It's just the colors I was wondering about.

Right now I'm using the REST API of the Hue bridge. It works, but of course it's yet another external configuration dependency in the LUA code...

Re: Philips Hue Color - setting color with LUA but without http?

Posted: Monday 15 February 2016 9:26
by deennoo
ok sorry, don't understand you try to set "saturation/hue"

Re: Philips Hue Color - setting color with LUA but without http?

Posted: Sunday 06 March 2016 13:34
by Clemen
Did you find any solution to this?

Re: Philips Hue Color - setting color with LUA but without http?

Posted: Friday 27 May 2016 13:38
by Toumal
Yeah I use curl to hit the rest api of the Hue controller. Not great but it does the job.

function hueAlarm()
os.execute('/usr/bin/curl -s -H "Accept: application/json" -X PUT --data \'{"alert": "lselect", "bri":255, "hue":0, "sat":255}\' http://'..hueip..'/api/'..hueusername..'/lights/'..huelight..'/state;')
end

function hueDisarm()
os.execute('/usr/bin/curl -s -H "Accept: application/json" -X PUT --data \'{"alert": "none", "bri":100, "hue":14910, "sat":144}\' http://'..hueip..'/api/'..hueusername..'/lights/'..huelight..'/state;')
end

function hueArm()
os.execute('/usr/bin/curl -s -H "Accept: application/json" -X PUT --data \'{"alert": "none", "bri":255, "hue":25500, "sat":255}\' http://'..hueip..'/api/'..hueusername..'/lights/'..huelight..'/state;')
end