Security / Intruder detection rule

Hey there

Just wanted to run this past you folks, more for a sanity check. I have a number of Axis IP cameras at home and there is a way (via the VAPIX API) to trigger their motion detection feature(s) on or off via a http URL.

What I was thinking was, some kind of rule that would trigger the motion detection to ON when neither mine nor my wife’s cell phone is NOT on the local WiFi network, so, in theory, when we’re both out of the house, the detection would turn ON but if either of us are home (with respective phones connected to WiFi obviously) then the detection rule would be OFF.

Do I have that logic correct? I’d imagine this is possible? Would appreciate anyones experience with this.


Sure. Break the task down into smaller chunks.

For example, you are likely going to want a virtual Item “Occupied” to indicate whether or not anyone is home. There are a lot of threads about doing that.

The alerting part is then easy. Got a motion detect? Are we “occupied”? Then ignore it, else send an alert.

The main logic is straightforward, just as Rick mentioned. The devil is in the detail. Relying on cell phone connected to WIFI won’t work all the time, especially if the phone is idle. I would rely on other things that are more stable such as indoor motion sensor, security system state, power level usage, and so on.

Also camera motion sensor detection will give you a lot of false positive. I know some one with Axis camera. The camera is very high quality but he has to turn off motion detection due to the # of false positives. Best to combine with another PIR sensor. I am still waiting for a camera that is equipped with real motion sensor.

I am actually currently working in just this area. My usage also combines with the door state so that no alert is sent if the user just walks out of the house.

Yeah, I’ve found that the actual motion detection logic in Axis cameras to be very tricky to fine tune, which is why I’ve changed the detection to be Audio based, so, if audio is above a certain threshold, I get notified. Works a lot better for my use case and tends not to give as many false positives, in my experience

@Gerry_Maguire I use cell phone as detection and once you get it tweaked right it work perfect. Here is an example of my Things, Items and rule.


Thing network:pingdevice:SiPhone [ hostname="", uses_ios_wakeup=1, uses_arp_pings=1, retry=30, timeout=15000, refreshInterval=60000 ]

Here you may need to tweak the retry, timeout, refreshInterval to make it reliable.


Group:Switch:AND(OFF,ON) gPresent <present>
Switch Present "Phone is home" <present>
Switch Present_Timer { expire="20m, command=OFF" }
Switch MyDevice <network> (gPresent) { channel="network:pingdevice:SiPhone:online" }

The Expire binding (20min) is used to prevent unwanted alarm if I leave the wifi area for a short time e.g. walk over to neighbors or to mail box.


rule "start gPresent on system start"
    System started
    Present.sendCommand(OFF) // assume no one is home

rule "gPresent updated, at least one change of state"
    Item gPresent received update
    // someone came home
    if(gPresent.state == ON && Present.state != ON) { 
        Present_Timer.postUpdate(OFF) // cancel the timer if necessary

    // no one is home and timer is not yet ticking (otherwise endless loop)
    else if(gPresent.state == OFF && Present.state != OFF && Present_Timer.state != ON) {
        Present_Timer.sendCommand(ON) // start the timer

rule "Present_Timer expired"
	Item Present_Timer received command OFF

This is an iPhone but should work with Android as well. Give it a try if you like, hope it works as good for you as it has for me.