PDA

View Full Version : Communication between Tasker and Girder 6



Chaudhari
December 14th, 2015, 04:32 AM
Hi Ron,

I want to control stuff in my home using voice commands on my android phone using Tasker app (with AutoVoice pluign) on my Android phone and Girder 6 on my computer/Rpi.
How can I send and receive data betweeen Tasker and G6? I am thinking of using webserver capabilities of G6 and the HTTP post/Get options in Tasker to do this. Can you please let me know how I can trigger an event in G6 using HTTP Post/Get?

Thanks,
Chaudhari

Ron
December 14th, 2015, 07:22 AM
Sure use http://<YOURHOST>/gir/triggerEvent.lhtml?es=<EVENTSTRING>&ed=<EVENTDEVICE>

Chaudhari
December 19th, 2015, 07:46 AM
Hi Ron,

I am able to trigger events in G6 suging the HTTP POST in Tasker but how do I get a response back from G6 into Tasker with HTTP GET. I am able to send a message (exampleWebSocket.ws:SendText("Message")) using websocket in G6 (screenshot attached) however, I am not able to pull that message using HTTP GET. When I try the HTTP GET in Tasker, I get the full html code but not the message sent. Please excuse my ignorance of html. ...This is what I get (see below in quote) when I do HTTP GET request in Tasker with the server port as: Server:Port: http://192.168.10.45/websocket/tasker.lhtml. What I need to do to get "Kitchen Light_3=ON' message?



<html>

<head>
<script src="gir/triggerEvent.lhtml"></script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script>

function log ( text ) {
var li = $("<LI>").text( text );
$("#log").append ( li );
}

/* Javascript part of this: */
var secure = "wss://<% print(getHost() .. ":" .. getPort()) %>/tasker";
var plain = "ws://<% print(getHost() .. ":" .. getPort()) %>/tasker";
url = plain;

// "tasker" is the protocol spoken over this websocket. Note that the accept function must return the
// protocol exactly as it's passed here or the browser will close the connection.
var ws = new WebSocket(url, "tasker");
ws.onopen = function (event) {
log("Socket Open");
};
ws.onclose = function (event) {
log("Socket Closed");
};

</script>
</head>
<body>
<ul id="log">
</ul>
</body>
</html>


Thanks,
Chaudhari