I’m having a hard time undertsanding the terminology in ST - it seems strange to me. So I am probably doing something very wrong. I’m trying to turn on a virtual device and have that trigger a GET to a page called ‘moviescene.asp’ on the LAN. Here’s the SmartApp:
definition(
name: "The Big Switch",
namespace: "smartthings",
author: "SmartThings",
description: "Turns on, off and dim a collection of lights based on the state of a specific switch.",
category: "Convenience",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet@2x.png"
)
preferences {
section("When this switch is turned on, off or dimmed") {
input "master", "capability.switch", title: "Which device?"
}
}
def installed()
{
subscribe(master, "switch.on", onHandler)
subscribe(master, "switch.off", offHandler)
subscribe(master, "level", dimHandler)
}
def updated()
{
unsubscribe()
subscribe(master, "switch.on", onHandler)
subscribe(master, "switch.off", offHandler)
subscribe(master, "level", dimHandler)
}
def logHandler(evt) {
log.debug evt.value
}
def onHandler(evt) {
log.debug evt.value
log.debug onSwitches()
onSwitches()?.on()
}
def offHandler(evt) {
log.debug evt.value
log.debug offSwitches()
offSwitches()?.off()
}
def dimHandler(evt) {
log.debug "Dim level: $evt.value"
dimSwitches?.setLevel(evt.value)
}
private onSwitches() {
if(switches && onSwitches) { switches + onSwitches }
else if(switches) { switches }
else { onSwitches }
}
private offSwitches() {
if(switches && offSwitches) { switches + offSwitches }
else if(switches) { switches }
else { offSwitches }
}
// TODO: do the GET
def hubAction = new physicalgraph.device.HubAction(
method: "GET",
path: "/moviescene.asp",
headers: [HOST:"C0A856C8:22B8"]
)
log.debug hubAction
hubAction
log.debug "This is a test"
The SmartApp has no error messages, and the log file shows it is executing the GET, but the receiving server does not receive the request.
Any help anyone can provide would be much appreciated. Thanks.