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 4 made on Wednesday March 6, 2024 at 13:35
mpg7321
Regular Member
Joined:
Posts:
June 2020
114
I got it working,

socket.onConnect = function()
{
socket.write('GET /api/Y1Vpd5qwJVnjsRIdxFThJR0jxcrnZaEvrQVe0NYM/lights/3 HTTP/1.0\r\n\r\n')
socket.close;
};
socket.onData = function() {
var info = socket.read();
var bright = info.split('"bri":').pop().split(',')[0];
CF.widget("Hue_Level").label = bright;
socket.close;
};
socket.onIOError = function(e) {
socket.close()
};
socket.connect('192.168.1.18', 80, 30);

what is the best way to grab "Parse" the string, return data being,

bla bla bla, "on": true,"bri":125, "alert": "select", bla bla bla.
my code above does work and it grabs only the number value, but what's a better way?

Last edited by mpg7321 on March 7, 2024 02:50.


Hosting Services by ipHouse