Skip to content

Instantly share code, notes, and snippets.

@shemethy
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shemethy/420ceb11aed5a39f3b71 to your computer and use it in GitHub Desktop.
Save shemethy/420ceb11aed5a39f3b71 to your computer and use it in GitHub Desktop.
Alert if NO motion is detected

This flow will send you an alert if NO motion is detected in a certain time frame.. It could be minutes, hours, days even! This uses the cool new trigger node, so you need to be on v0.8 or later.

Why would you want to do this? Maybe: 1) So you know if your kids haven't come home from school 2) If you need to make sure your employees are checking on equipment or visiting a location regularly 3) To be alerted if your pet lion has escaped .. Etc!

You may have to adapt it to your needs, but in my case I bought a cheap PIR module and hooked it up to a Raspberry Pi with three wires. On the module VCC / OUT / GND are wired to pins 2 / 26 / 14 respectively.

Use the debug node to check the PIR detector is working. After this configure the options such as 'quiet time', trigger duration and email message.

[{"id":"83b52953.7c4ad8","type":"rpi-gpio in","name":"PIR on 26","intype":"tri","pin":"26","x":116.5,"y":140,"z":"404c1cb2.bfb3e4","wires":[["2c82b33b.d37d4c","ffbca82.f004358"]]},{"id":"2c82b33b.d37d4c","type":"debug","name":"check pir","active":true,"console":"false","complete":"false","x":320,"y":80,"z":"404c1cb2.bfb3e4","wires":[]},{"id":"ffbca82.f004358","type":"trigger","op1":"Initial motion detected.","op2":"No motion detected in 2 hours!","op1type":"nul","op2type":"val","duration":"2","extend":"true","units":"hr","name":"","x":323,"y":140,"z":"404c1cb2.bfb3e4","wires":[["31a36d82.ce5c92"]]},{"id":"b784946c.487b68","type":"e-mail","server":"smtp.gmail.com","port":"465","name":"YOU@gmail.com","dname":"email alert","x":744.5,"y":140,"z":"404c1cb2.bfb3e4","wires":[]},{"id":"29781288.d687ee","type":"inject","name":"reset","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":true,"x":131.5,"y":80,"z":"404c1cb2.bfb3e4","wires":[["ffbca82.f004358"]]},{"id":"31a36d82.ce5c92","type":"change","action":"replace","property":"topic","from":"","to":"Presence Alert","reg":false,"name":"","x":532,"y":140,"z":"404c1cb2.bfb3e4","wires":[["b784946c.487b68"]]},{"id":"f5314c6.f0aceb","type":"comment","name":"No Motion Alert","info":"","x":534.5,"y":80,"z":"404c1cb2.bfb3e4","wires":[]},{"id":"e14a22fc.1eb5e","type":"inject","name":"quiet time","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"*/30 20-23,0-7 * * *","once":false,"x":139,"y":200,"z":"404c1cb2.bfb3e4","wires":[["ffbca82.f004358"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment