So, I want to build an interface in my wall mounted Philips Pronto TSU9800 (universal remote discontinued in 2010) with buttons to send on/off commands to devices in Hubitat, just that. Given the infinite possibilities of the Hubitat system, this would be really neat. I installed MakerAPI and am using a test device.
Now, I came up with a script that should work, building on other posts from the Remote Central forum I adapted to work with a GET command like the below:
var socket = new TCPSocket(false);
socket.onConnect = function()
{
socket.write("GET /apps/api/150/devices/1153/on?access_token=a43ebdcb-bc49-4a37-a419-b30304277ed6 HTTP/1.1\r\n\r\n")
socket.close();
};
socket.onClose = function()
{
};
socket.onIOError = function(e)
{
label = "Error: " + e;
};
socket.connect('192.168.70.100’,80);
The Hubitat's IP is 192.168.70.100 and when using the string 192.168.70.100:80/apps/api/150/devices/1153/on?access_token=a43ebdcb-bc49-4a37-a419-b30304277ed6 in a browser it works just fine, i.e, the device 1153 turns ON. However, the script does not work. Nothing shows up in the logs of the Hubitat, so I assume that the command is not reaching it.
A similar script works in a Vera and am wondering why this does not work. The Vera needs http 1.1. Does Hubitat use another version?
Looking at the script, what possible failures can you spot in the command string and what could I try different?