Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Previous page Next page Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Page 3 of 3
Topic:
Philips HUE controls
This thread has 44 replies. Displaying posts 31 through 45.
Post 31 made on Sunday June 3, 2018 at 05:41
kapsreiter
Long Time Member
Joined:
Posts:
November 2006
48
my script will not work since some months
all accèss details are ok, i could test it directly at the webinterface

pronto is still in wifi

but no reactions

anyone could post if it is still working an a code sample ?

thx
tom
Post 32 made on Thursday June 7, 2018 at 13:55
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Did the IP address of your Pronto change? I seem to recall that the Hue Bridge needs to know the IP address of the device trying to issue commands.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 33 made on Thursday October 25, 2018 at 13:08
kapsreiter
Long Time Member
Joined:
Posts:
November 2006
48
i used this code for months and since 1 year its not working


var socket = new TCPSocket(false);
var result="";


var JSON_on='{"on":true}';

function getInfos(commands)
{
socket.write('PUT /api/AApi3poAYZyOX8KURN2bY9Rne5NpQmvX4Y5Ko38R/groups/1/action HTTP/1.1\r\nContent-Length: '+commands.length+'\r\n\r\n'+commands);

}

socket.onConnect = function()
{
getInfos(JSON_on);
};

socket.onData = function()
{

};

socket.onClose = function()
{
socket = null
}

socket.onIOerror = function() {
System.print("error");
try {
socket.close()
socket = null
} catch(e) {}
}

socket.connect('10.0.0.2', 80, 3000);


the user id is ok, i am able to switch via the hue web interface from my pc

the pronto is in the network, i can test it with a webcam module

any ideas?

thx
tom
Post 34 made on Thursday October 25, 2018 at 19:40
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Tom,

Try this link to see if registration still works and you can test out the APIs.

[Link: developers.meethue.com]
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 35 made on Saturday October 27, 2018 at 07:25
kapsreiter
Long Time Member
Joined:
Posts:
November 2006
48
yes

i can ad a new user and switch my lamps with the web browser commands

but the script for pronto stopped working

ip address usernamekey is ok

pronti is online (webcamscript is working)

:-(

may be someone could post a sample code for on/off
Post 36 made on Saturday October 27, 2018 at 10:06
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Here's something to try. Use Chrome in Developer mode and see what headers are being sent. I suspect you will see at least 2 additional HTTP request headers that your script is not sending.

Your script sending neither the 'Host' nor 'User-Agent' Request Headers. Try adding those in with some valid values (IP is specific to the script you posted)...

'Host: 10.0.0.2\r\n'
'User-Agent: ProntoTSU9600\r\n'
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 37 made on Saturday October 27, 2018 at 11:21
kapsreiter
Long Time Member
Joined:
Posts:
November 2006
48
hi

i created this user now:

its working at the pc but not at the pronto
pronto is online.



{"devicetype":"pronto#tom"}

[
{
"success": {
"username": "lVfthQzyz9ZbNsUyndnZT9WBBOQ852HY3fEcPUVg"
}
}
]


so what should look this code now, this is still not working:



var socket = new TCPSocket(false);
var result="";


var JSON_on='{"on":true}';

function getInfos(commands)
{
socket.write('PUT /api/lVfthQzyz9ZbNsUyndnZT9WBBOQ852HY3fEcPUVg/groups/1/action HTTP/1.1\r\nContent-Length: '+commands.length+'\r\n\r\n'+commands);

}

socket.onConnect = function()
{
getInfos(JSON_on);
};

socket.onData = function()
{

};

socket.onClose = function()
{
socket = null
}

socket.onIOerror = function() {
System.print("error");
try {
socket.close()
socket = null
} catch(e) {}
}

socket.connect('10.0.0.2', 80, 3000);



________________________________________-

where must i ad what now?

i don't know where i see this infos at chrome? and how to paste it in the code :-(

could you check it and paste it for me please

Last edited by kapsreiter on October 27, 2018 14:49.
Post 38 made on Tuesday October 30, 2018 at 22:07
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Change your write line to this.... Notice how I simply injected 2 HTTP Request Headers that I pasted above.

socket.write('PUT /api/lVfthQzyz9ZbNsUyndnZT9WBBOQ852HY3fEcPUVg/groups/1/action HTTP/1.1\r\nHost: 10.0.0.2\r\nUser-Agent: ProntoTSU9600\r\nContent-Length: '+commands.length+'\r\n\r\n'+commands);

And finally, when you do send this command, are you getting any data back? I see you are not logging anything in your onData

Change...
socket.onData = function()
{

};

to...

socket.onData = function()
{
var data = this.read();
// to show in ProntoScript console provided you use System.setDebugMask(9);
System.print(data.substr(80));
};

Finally, this is what I was referring to regarding Google Chrome.
1) [Link: developers.google.com]
2) [Link: developers.google.com]

All you have to do is turn on developer tools from Chrome menu and you can see the HTTP Request Headers that are being sent from your Web Browser when this works.

Last edited by Lyndel McGee on October 30, 2018 22:17.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 39 made on Wednesday October 31, 2018 at 02:55
kapsreiter
Long Time Member
Joined:
Posts:
November 2006
48
thank you

will try it this night

could you be so nice to paste it in my complete code and re post it

i am not a coder, just a user and try my best :-)
Post 40 made on Wednesday October 31, 2018 at 13:27
kapsreiter
Long Time Member
Joined:
Posts:
November 2006
48
GREAT!! i am back in action

looking now for a on/off toggle command ?? ? nay ideas
Post 41 made on Thursday November 1, 2018 at 22:46
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Would you be so kind as to tell us what you did to get "Back In Action"?
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 42 made on Monday November 5, 2018 at 12:32
kapsreiter
Long Time Member
Joined:
Posts:
November 2006
48
i did jus this

Change your write line to this.... Notice how I simply injected 2 HTTP Request Headers that I pasted above.

socket.write('PUT /api/lVfthQzyz9ZbNsUyndnZT9WBBOQ852HY3fEcPUVg/groups/1/action HTTP/1.1\r\nHost: 10.0.0.2\r\nUser-Agent: ProntoTSU9600\r\nContent-Length: '+commands.length+'\r\n\r\n'+commands);

And finally, when you do send this command, are you getting any data back? I see you are not logging anything in your onData

Change...
socket.onData = function()
{

};

to...

socket.onData = function()
{
var data = this.read();
// to show in ProntoScript console provided you use System.setDebugMask(9);
System.print(data.substr(80));
};



thank you Lyndel


any example for a power toggle? so i would just need 1 hard button for the light

tom
Post 43 made on Monday November 5, 2018 at 20:31
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,992
Unfortunately, I don't own any Hue lights. Did you go the the Philips Hue Developer site to see if one is available?

Note that I posted link above.
developer.meethue.com
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 44 made on Wednesday October 21, 2020 at 09:12
GJC33
Long Time Member
Joined:
Posts:
September 2010
13
Hi,

I had issues getting the code in this thread to work (even with the new random user created).
I kept getting '400 Bad Request' errors.

Eventually I got it to work by adding a couple of extra headers:

Host: [Bridge IP Address]
Content-Type: text/html


It seems that the latest bridge firmware may be stricter on what you must send.

---------------------------

For a TOGGLE, you could send a GET to /api/[UserID]/lights/[LightNumber]
It will return the current settings for that light in JSON format
Parse that to see if on is true or false
Then send a PUT command with the opposite.

Last edited by GJC33 on October 21, 2020 10:16.
Post 45 made on Wednesday October 21, 2020 at 21:39
mpg7321
Regular Member
Joined:
Posts:
June 2020
109
Would you be willing to post your entire code hear?

Thanks
Would love to take a look at it for my HUE
Page 3 of 3


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse