Hey all,
Seems pretty simple, but when I install it, and then tap “Configure SmartApp”, the SmartThings app immediately crashes (Nexus 7 / Android 4.4.2). Any ideas what I may have done wrong:
definition(
name: "Server Command Button",
namespace: "smrtthings",
author: "Scottin Pollock",
description: "Send a server command when app is touched or activated",
category: "My Apps",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
)
preferences {
section("When I touch the app, Send to server...") {
input "server", "string", title: "Server IP", description: "Your HTTP Server IP", required: true
input "command", "string", title: "Parameters", description: "Command to Send", required: true
}
}
def installed()
{
subscribe(app, appTouch)
}
def updated()
{
unsubscribe()
subscribe(app, appTouch)
}
def appTouch(evt) {
log.debug "appTouch: $evt"
sendHttp()
}
def sendHttp() {
def ip = "${settings.server}:8080"
def deviceNetworkId = "100012"
sendHubCommand(new physicalgraph.device.HubAction("""GET /?${settings.command} HTTP/1.1\r\nHOST: $ip\r\n\r\n""", physicalgraph.device.Protocol.LAN, "${deviceNetworkId}"))
}