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

Login:
Pass:
 
 

Original thread:
Post 1 made on Sunday September 22, 2013 at 10:05
bibi-12
Long Time Member
Joined:
Posts:
February 2008
16
Hi,

I'm trying to control my philips hue bulbs with Pronto. It uses en http protocol
(see: [Link: developers.meethue.com])

Here is my code for now:
var socket = new TCPSocket(false);
var chaine=""
var JSON_Test = '{"devicetype":"test user","username":"newdeveloper"}';
System.print("call connect");

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




function getInfos()
{
socket.write("POST /api HTTP/1.1 \r\n\r\n"+JSON_Test);


}

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

socket.onData = function()
{

result += socket.read();


};

socket.onClose = function()
{

var resultStartIndex =result.indexOf("\r\n\r\n");
var jsonData = result.substring(resultStartIndex+4);

System.print("resultas: "+jsonData);

}




When I use that, the response is:
[{"error":{"type":5,"address":"/","description":"invalid/missing parameters in body"}}]

I am probably wrong with the JSON object i tried to sent, but i don't know how to solve that.

Can anyone please help me ?


Hosting Services by ipHouse