ST Hub HTTP GET to Flask - Help!


#1

Hello all, I’m quite inexperienced with Smart apps / all forms of dev work (I am a mechE…) but I have successfully written a super simple flask ‘server’ I run on a PC connected to an arduino UNO. The Arduino board controls which input my projector is connected to.

The flask and arduino code already work - If I navigate to ipaddress:port/one or ipaddress:port/two in a browser the input to the projector is correctly assigned one or two respectively.

Now the challenge is to get my ST hub to send a GET request to the flask server. I am using a virtual switch to togggle input -the smart app is subscribed to this switch (switch on = input one, switch off = input two). I believe the problem I’m having is with the hub action:

def ip = “192.168.1.21"
def deviceNetworkId = “C0A80115:1388"
sendHubCommand(new physicalgraph.device.HubAction(””“GET /one HTTP/1.1\r\nHOST: $ip\r\n\r\n”"", physicalgraph.device.Protocol.LAN, “${deviceNetworkId}”))

I very much stole this from an example in another thread. Not sure exactly how hub action is supposed to work. The hub is on the same LAN as the flask server.

Any input is appreciated, Thanks in advance!