Skip to content

WIP: Motion detection

Vladimir Dronnikov edited this page Jan 13, 2018 · 2 revisions

For starters

#!/bin/sh

# Copyright 2018 Vladimir Dronnikov
# GPL

snx_isp_ctl --mdset-thre 16384 # YMMV
snx_isp_ctl --mdset-en 1

snx_isp_md 2>&1 | awk '
/^Detected Moving!$/ {
  if (alarm == 0) {
    alarm = 1
    print "+alarm"
    system("wget -qs http://192.168.1.10:1882/set?state/alarm/room/pir=1")
  }
}
/(have no motion status = 0)/ {
  if (alarm != 0) {
    alarm = 0
    print "-alarm"
    system("wget -qs http://192.168.1.10:1882/set?state/alarm/room/pir=0")
  }
}
'