Ok, I swear I’ve read like a gazillion posts related to this topic. Many are really old, many are just unresolved. But all point to the same solutions that I’ve been trying (in various formats) and it’s simply not working for me. Hopefully someone will see the obvious thing I’m overlooking and maybe this well help future folks hitting this problem.
I’m trying to do something really simple - I have a RPI running a Flask web server. I’m trying to create a Device Handler that with the push of a button will perform a GET request to that server. That’s it. Reading the response would be a bonus but I’m not there yet - ST logs are showing everything as legit but no request is hitting the web server. Of course, a simple browser GET to the address on a different machine on the network indeed hits the server so I’m pretty sure it’s not the RPI’s fault.
Here’s how the device handler looks (I simplified to the least amount of code possible):
metadata {
definition (name: “Garage door Controller”, namespace: “orenaim”, author: “Oren”) {
capability “Switch”
command “door”
}
preferences {
}
tiles(scale:2) {
standardTile(“door”, “device.button”, width: 2, height: 2) {
state “default”, label: “Door”, backgroundColor: “#ffffff”, action: “door”, icon:""
}
}
}
def door() {
log.debug “door2”
def result = new physicalgraph.device.HubAction(
method: “GET”,
path: “/”,
headers: [
HOST: “192.168.86.32:5000”
]
)
log.debug result
return result
}
def parse(physicalgraph.device.HubResponse hubResponse) {
log.debug “Parsing”
def msg = parseLanMessage(description)
log.debug msg.body
}
door action is called but the GET request isn’t actually done. I also tried versions where I invoke the HubAction directly but that didn’t do much either. I tried versions where the host is in hex. And I have the device ID to be the MAC address or host ip in hex too. None of these combinations worked.
So at this point, I’m really out of ideas. It would be AMAZING if someone can tell what’s going wrong here. Thanks!