README.md in Simplified Chinese in Github
README.md in Simplified Chinese faster link in China
Python script to control the MagPi Rain Detector project. See raspberypi.org/magpi issue #74 for more details.
Make sure gpiozero is installed.
sudo apt install python3-gpiozerocd
git clone https://github.com/mrpjevans/rainbot.gitmkdir ~/rainbot
cd rainbot
nano rainbot.pyNow cut and paste (or manually enter) the code.
cd ~/rainbot
python3 rainbot.pyCreate the following file as a superuser:
sudo nano /lib/systemd/system/rainbot.serviceAdd in the following text:
[Unit]
Description=Rainbot
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python3 /home/pi/rainbot/rainbot.py
[Install]
WantedBy=multi-user.target
Ctrl+X to save and quit out of nano. Now issue the following commands:
sudo chmod 644 /lib/systemd/system/rainbot.service
sudo systemctl enable rainbot.service
sudo systemctl daemon-reloadThe script will now start in the background on reboot.