iSpy Connect - Turn On/Off Upon Arrival/Departure--help needed

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
}

Guess what I am trying to do - see my code.

Could someone please explain how is this really done step by step. I red instructions from:
https://www.ispyconnect.com/userguide-http.aspx
but can’t figure out what to do. Where should I add code and how?

I’m trying to do same thing as “CoolVariable”. I would like to activate Ispy only when smarthome monitor is set armed (away) or armed (stay). Now Ispy records all the time…even when family is home and there’s movement in every camera all the time.

Thanks Robin!! I was able to install webcore but I have a problem when creating “then” in a piston. I think I’m missing something obvious.
This is what I do:
*************************************************************/
execute
if
Smart Home Monitor status is Disarmed
+ add a new condition
then
+ add a new statement
else
+ add a new statement
end if;
+ add a new statement
end execute

I choose “Then” and “Action”. Should there be some kind of device which allows to send web requests? All I see is this:

Webcore_then

Just found it… thanks! Let’s see what is the next problem :smiley:

1 Like

Alright so now I understand how to install webcore, what it basically does and how to create pistons. Now the biggest issue is to understand what this piston really does:

EDIT: here was a lot of nonsense so here’s what is going on.
EDIT: more nonsense

Now it’s working!! I had a small typo but now everything is working. Thank You David!! I learn something new today and I’m really happy.

1 Like

Can you write a guide?

  1. First you have to install webcore (video is posted in this topic).
  2. Then create new piston. My piston looks like this:

  1. Install Ispy server and set there ip access settings (you lan network to access ispy server, mine is 192.168.86.*) Now any ip address from your local network is able to send ispy server certain web requests.

  2. Now piston should be doing its job.

When st is Disarmed then recording in ispy is off.
In my scenario when st is armed then I need ispy to record on detection cause my other things are using ispy streams even when st is disarmed. Web request command depends on your need. If you just want piston to turn ispy off when disarmed then use http://192.168.86.15:8080/alloff. And when st is armed and you want ispy to record then use http://192.168.86.15:8080/allon.

Hope this helps.