The flow uses external python script which generates MQTT messages to the People Presence Detector.
The People Presence Detector flow runs the script as daemon. The script sends the status only on its change (when any user departs or arrives the premises).
The MQTT JSON parses presence input to decisions per output:
- Lights;
- Temperature control;
- Alarm;
- Locks;
For advanced use: put status of this and other nodes in flow/global context to take more sophisticated decisions.
The goal of this flow is: Make reliable and cheap user presence detection with no adding hardware. Major assumption is: Every capable person in premises (your home. your office) has mobile phone and connected automatically to the WiFi.
Prerequisites:
- In
/home/pi
folder createpeople.csv
file in format:
user_name,full_or_part_MAC
Example:
joe,AA:BB:FF
bar,12:23:34:45:56
-
Install
node-red-node-daemon
in Node-Red. -
Install
sudo pip install paho-mqtt netaddr
on your Linux. -
Ensure the MQTT broker is up and running on the Linux where the ptracker is intented to run.
mosquitto_sub -t "#" &
mosquitto_pub -t "my/test/" -m "test message"
- Install
sudo apt-get install nmap
on your Linux.