check this for pinlayout : https://kjetiliot.blogspot.no/p/raspberry-pi.html
Install dependencies:
- sudo apt-get install python-pip
- pip install paho-mqtt
Make the script executable
sudo chmod a+x filenameAdd script to crontab
To start the script to automaticly run at at startup run the command : sudo crontab -e and add the following line(edit the path to fit your filename and path) : @reboot sudo python /home/pi/pirsensor.py & You can now reboot and check everything is working.You can test that the pir is publishing correctly by subscribint to the mqtt topic you used in the pir sensor python script mosquitto_sub -v -t 'home/office/presence'