tonyG
March 21st, 2016, 08:23 AM
Hi Folks,
After a few days of reading and trying to get my first simple script to work in Girder, I'm embarrassed to say I've failed; hence my request for some help.
I'm looking to trigger some Housebot tasks using Girder.
Housebot External Control using HTTP
Since December 2015, Housebot now offers HTTP control without the requirement of a webserver:
The HTTP Protocol defines one of the communication APIs that the External Control Device expects when it is running in ASCII mode. To control the Device, a separate application (like a web browser) is needed that can connect to an IP address and send and receive data. This allows commands to be sent and status to be queried from web browsers or other applications that can issue HTTP (GET method) commands.
This example command works in a web browser, triggering an event in Housebot (with returned message: Task [Restart] has executed.)
http://127.0.0.1:8001/ET?T=Restart
Where 8001 is the port defined in the external control within Housebot.
<ET?T=Restart> executes a housebot task "Restart"
I'm not using any passwords for this example.
Sending the same command from Girder
I'm assuming this is the correct call to use this, within a script action: network.get( url, callback, timeout, username, password, headers )
I've assumed the help example will work with a few amendments, but I'm not sure how to incorporate the "function" - which in my case will be <ET?T="Restart">
network.get( "http://127.0.0.1:8001", function ( success, status, body )
if not success then
print("Sorry could not connect with server")
return
end
if status ~= 200 then
print("Sorry server returned", status)
return
end
print(body)
end, 3000)
Tried and failed
Could someone point me in the right direction - any help very much appreciated!
After a few days of reading and trying to get my first simple script to work in Girder, I'm embarrassed to say I've failed; hence my request for some help.
I'm looking to trigger some Housebot tasks using Girder.
Housebot External Control using HTTP
Since December 2015, Housebot now offers HTTP control without the requirement of a webserver:
The HTTP Protocol defines one of the communication APIs that the External Control Device expects when it is running in ASCII mode. To control the Device, a separate application (like a web browser) is needed that can connect to an IP address and send and receive data. This allows commands to be sent and status to be queried from web browsers or other applications that can issue HTTP (GET method) commands.
This example command works in a web browser, triggering an event in Housebot (with returned message: Task [Restart] has executed.)
http://127.0.0.1:8001/ET?T=Restart
Where 8001 is the port defined in the external control within Housebot.
<ET?T=Restart> executes a housebot task "Restart"
I'm not using any passwords for this example.
Sending the same command from Girder
I'm assuming this is the correct call to use this, within a script action: network.get( url, callback, timeout, username, password, headers )
I've assumed the help example will work with a few amendments, but I'm not sure how to incorporate the "function" - which in my case will be <ET?T="Restart">
network.get( "http://127.0.0.1:8001", function ( success, status, body )
if not success then
print("Sorry could not connect with server")
return
end
if status ~= 200 then
print("Sorry server returned", status)
return
end
print(body)
end, 3000)
Tried and failed
Could someone point me in the right direction - any help very much appreciated!