Page 1 of 2
Philips Hue Lights
Posted: Thu May 23, 2013 4:34 pm
by trevorst
With the help of Demopad support I have control for Philips Hue Lights working.
The Device should be setup as a Generic IP Device on Port 80 with a command suffix of \x0D\x0A
To initialize the Hue controller to accept commands from Demopad you need to set a password (at least 10 chars).
To do this use the controllers built in browser tool, follow the directions at the website below.
http://developers.meethue.com/gettingstarted.html
Note: It does not seem to matter what the app name is when you setup the password, I used demopad.
Once you have established the password examples of the command format are:
Light On/Off
PUT /api/yourpassword/lights/1/state HTTP/1.1\x0AContent-Length: 1000\x0A\x0A{"on": true}
Change "lights/1" to "lights/2" etc to control various lights.
Change {"on": true} to {"on": false} to turn off.
To control the properties , Hue, Brightness etc
PUT /api/yourpassword/lights/1/state HTTP/1.1\x0AContent-Length: 1000\x0A\x0A{"on":true, "sat":255,
"bri":50,"hue":29469}
The Api gives details of the properties. Also the built in tool is great for getting the settings for individual colors.
Update
The content-Length is the character count in the string, since they started to add more capability to the API they must have changed the way the hub processes this. As long as the content length was longer than the string it was fine, now it requires the exact length or it waits for more info...
So then content length of this command:
lights/1/state HTTP/1.1\x0AContent-Length: 1000\x0A\x0A{"on": true}
would be 12 derived from the part of the command in curly brackets including the Brackets {"on": true} so the above string should be changed to lights/1/state HTTP/1.1\x0AContent-Length: 12\x0A\x0A{"on": true} to work smoothly.
There are several string function web sites that calculate it for you I have been using this one:
http://string-functions.com/length.aspx
Re: Philips Hue Lights
Posted: Mon Feb 17, 2014 4:54 pm
by frcor
Hi,
thank you very much. This is very helpful however in my case this is very slow. I mean I have to put a delay of 2.5sec between command to the lights.... which is not really good.
My goal is to create a gauge changing the light color as I slide it but with such a slow response time I do not know if it is going to be practical.
Do you experience such a slow response time?
thank you
Re: Philips Hue Lights
Posted: Mon Feb 17, 2014 11:22 pm
by trevorst
Not sure what your issue is I don't have a problem with slowness, other than the normal delay that the Hue lights have (same as there own app).
How are you sending commands?? If you are trying to send commands to multiple lights at the same time you need to group them and send group commands.
If you don't need feedback you can also speed things up a little by not checking the stay connected box in the device settings.
Also if you want to use gauges you need to set the Gauge to Not Send commands while moving or you flood the Hue controller with data. The Hue app seems to have a built in routine to account for this.
Re: Philips Hue Lights
Posted: Tue Feb 18, 2014 7:27 pm
by starwarsmike
Hi
not sure if this will help, but I had a similar problem with my Amp using a gauge. If you have ticked the box in gauge setting that states execute whilst sliding, then untick it.
Hope this maybe helps
Michael
Re: Philips Hue Lights
Posted: Sun Feb 23, 2014 11:27 pm
by trevorst
frcor wrote:Hi,
thank you very much. This is very helpful however in my case this is very slow. I mean I have to put a delay of 2.5sec between command to the lights.... which is not really good.
My goal is to create a gauge changing the light color as I slide it but with such a slow response time I do not know if it is going to be practical.
Do you experience such a slow response time?
thank you
So did the feedback help ???
Re: Philips Hue Lights
Posted: Wed Jun 04, 2014 8:29 pm
by frcor
Hi trevost,
Sorry for my late answer - I have playing but for some reason it is still very slow compare the iphone Philipps app.
I am lacking responsiveness and the only I got it to work is to set 2sec delay between command....
I am not sure what is wrong but it is not really usable for now.
Thank you again for your help.
Re: Philips Hue Lights
Posted: Thu Sep 25, 2014 6:58 pm
by AKWillows
Hi
Has anyone been able to configure two way feedback?
I am just starting my project and, at the moment, have simple "off" and "on" buttons for each of my seven Hue lights following the advice given above. These all work fine.
What I would like to do, is for the app to "GET" the status of each light so that I can then highlight the "on" or "off" button according to it's current state.
I must admit, I don't really have any idea where to start, but this is what I have tried:
1) Set a "Page Load Action" first to connect to the Philips Hue device and then:
>Action Type = Send a Command
>Device = Philips Hue
>Command = GET /api/********/lights/7 (where *****is my user name)
The data that should be returned from the Hue is in this format (I have only shown the first section)
{
"state": {
"on": true,
"bri": 254,
"hue": 44406,
"sat": 207,
"xy": [
0.1961,
0.1736
],
"alert": "none",
"effect": "none",
"colormode": "xy",
2) I have set up Two Way Feedback for the Philips Hue device as follows:
Condition Type = feedback matches specific data
If Data = "on":true then set flags to set "Hue Status on" to "ON" and "Hue Status off" to "OFF"
If data = "on":false then set flags to set "Hue Status on" to "OFF" and "Hue Status off" to "ON"
3) On the app page, I have set my "Highlight" properties for the "ON" button based on the "Hue Status on" flag and selected a highlight image. Similar for the "Off" button.
However, nothing happens and both buttons appear unhighlighted.
I have no idea where I have gone wrong... or even if this is possible... but would be REALLY grateful for some advice!!!
Re: Philips Hue Lights
Posted: Tue Aug 30, 2016 9:01 am
by AKWillows
Hi
Has anyone else recently had problems with controlling Hue lights from Demopad?
Mine was working fine for a couple of years, but about a month ago, the commands just stopped working. I've changed nothing relating to Hue commands in my app nor on my network and the IP address of the hub is still the same.
If I test the command in the DemoDesign software, the lights respond, but they do not respond from within the published app
Re: Philips Hue Lights
Posted: Thu Sep 08, 2016 3:22 pm
by trevorst
Did you solve your problem??
I can still control my Hue just fine from the iPhone & iPad, but have trouble if I use the same project on my android tablet.
My hue hub is a first generation but has the latest firmware loaded.
Re: Philips Hue Lights
Posted: Thu Sep 08, 2016 10:10 pm
by AKWillows
trevorst wrote:Did you solve your problem??
I can still control my Hue just fine from the iPhone & iPad, but have trouble if I use the same project on my android tablet.
My hue hub is a first generation but has the latest firmware loaded.
Hi, Yes i did.... sort of!
I was experiencing a problem if I tried to send two commands to two lights consecutively. I experimented and found that setting Demopad to disconnect after each command solved the problem.
Demopad support suggested that the problem may be to do with the Content-Length in the command being set to 1000 ( I used your command above) and suggested that the Hue hub was waiting for more data before auctioning anything... the disconnect stops it waiting.
So, for now it's all working. I would change the Content-length to something smaller but don't really understand what I should be counting to get it right!
Re: Philips Hue Lights
Posted: Fri Sep 23, 2016 6:20 pm
by trevorst
The content is the character count in the string, since they started to add more capability to the API they must have changed the way the hub processes this. As long as the content length was longer than the string it was fine, now it requires the exact length or it waits for more info...
So then content length of this command:
lights/1/state HTTP/1.1\x0AContent-Length: 1000\x0A\x0A{"on": true}
would be 12 derived from the part of the command in curly brackets including the Brackets {"on": true}
There are several string function web sites that calculate it for you I have been using this one:
http://string-functions.com/length.aspx
All my commands are back to normal now.
I have also added an update to my original post for anyone new trying to setup a Hue
Re: Philips Hue Lights
Posted: Fri Sep 23, 2016 7:18 pm
by AKWillows
Hey thanks for coming back to me again.
I experimented and changed the length to 12 as you have done and it all works fine. 13 for the "false" commands. Just realised that I still have the "Disconnect after each command" option selected though, so will have to check tomorrow with it turned off!!
Re: Philips Hue Lights
Posted: Sat Sep 24, 2016 3:43 pm
by trevorst
I should have mentioned in my previous post that this method works without disconnecting after every command and seems to make the commands execute faster.
By the way did you ever get the feedback working, I noticed your previous post that I must have missed when you posted it.
Re: Philips Hue Lights
Posted: Tue Sep 27, 2016 8:35 pm
by DemoPad
For anyone using similar commands, the keyword [#CONTENTLENGTH] is useful - the app works out the content length of the request for you & inserts it - useful if your command contains variables etc
Re: Philips Hue Lights
Posted: Wed Sep 28, 2016 3:32 pm
by trevorst
That is great...
There has been a lot of functionality added to Demopad since it's inception and to the best of my knowledge there is not a comprehensive guide available. It would be terrific if we had one, but even a list of available keywords and there usage would be great.
I know from my own experience it is very easy to miss items in a release and the only documentation of them is in the release notes for designer. Quite often the description is vague with no usage examples.