I am trying to get Smartthing to turn my iSpy server on or off but it’s not working (below the code to turn it ON):
/**
* iSpy Auto On
*
* Copyright 2017 coolVariable
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
* for the specific language governing permissions and limitations under the License.
*
*/
definition(
name: "iSpy Auto On",
namespace: "iSpy Auto On",
author: "coolVariable",
description: "Turn on iSpy upon departure of everyone",
category: "",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
preferences {
section("Automatically Turn iSpy ON when EVERYONE LEAVES..."){
input "departurePresence", "capability.presenceSensor", title: "Departure Of?", required: false, multiple: true
}
}
def installed()
{
// log.debug "Installed with settings: ${settings}"
subscribe(departurePresence, "presence.not present", eventHandler)
}
def updated()
{
// log.debug "Updated with settings: ${settings}"
unsubscribe()
subscribe(departurePresence, "presence.not present", eventHandler)
}
def eventHandler(evt) {
// log.trace "$evt.value: $evt, $settings"
// log.debug "Nobody at Home turning ON iSpy"
// Put this in for debug purposes to make sure it was firing and had the correct parameters
def deviceNetworkId = "C0A802CA:1F90" // "192.168.2.202:8080"
// The deviceNetworkId is the hex encoded IP and port of the PC running ispy in the home
def ip = "192.168.2.202:8080"
// This is the ip of the PC running the ispy application in the home
sendHubCommand(new physicalgraph.device.HubAction("""GET /allon""", physicalgraph.device.Protocol.LAN, "${deviceNetworkId}"))
// Snapshot is an ispy command so the syntax is driven by ispy
// log.debug location.hubs*.firmwareVersionString.findAll { it }
}
def locationHandler(evt) {
def description = evt.description
def hub = evt?.hubId
// log.debug "cp desc: " + description
//log.debug description
}