Skip to content

Use a Raspberry Pi to watch a PIR sensor and trigger a Sonoff-Tasmota powered plug. Optionally, authenticate a nearby bluetooth device.

License

Notifications You must be signed in to change notification settings

poptix/garage-pir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

This is just something I threw together to save some power in my garage, and monitor motion. 

Who knows, maybe someone will find it useful.

Runs on a linux system with bluetooth (raspberry pi zero w in my case)
Watches a GPIO input, I use a PIR motion sensor, it could just as easily be a magnetic door sensor or something else. 
Once triggered, it looks for a registered bluetooth device within range
If a valid device is found, it turns on the outlet
If a valid device isn't found, it sends an alert to pushover.net (if configured)

For further documentation: Use the source, Luke.

Requirements:

bluez (for hcitool, l2ping)
curl (for pushover)
mosquitto-clients (for mosquitto_sub/mosquitto_pub)

Bluetooth devices must be paired before they will work, make sure your device is visible/discoverable, then:

First, scan for your mobile phone using
$ hcitool scan

This will give you the MAC address of the device. Connect to it 
$ hcitool cc 14:5A:05:5C:A8:B4

and pair (Note: I followed instructions here, but left out the passkey part. Surprisingly it works).
$ hcitool auth 14:5A:05:5C:A8:B4

Now you can use l2ping to see if it is in Bluetooth range.
$ l2ping 14:5A:05:5C:A8:B4


(Thanks http://grefab.blogspot.com/2012/09/am-i-there-raspberry-pi-and-bluetooth.html !) 

About

Use a Raspberry Pi to watch a PIR sensor and trigger a Sonoff-Tasmota powered plug. Optionally, authenticate a nearby bluetooth device.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages