Skip to content

Repository files navigation

README.md in Simplified Chinese in Github

README.md in Simplified Chinese faster link in China

rainbot

Python script to control the MagPi Rain Detector project. See raspberypi.org/magpi issue #74 for more details.

Pre-requisites

Make sure gpiozero is installed.

sudo apt install python3-gpiozero

Installation

From git

cd
git clone https://github.com/mrpjevans/rainbot.git

Manually

mkdir ~/rainbot
cd rainbot
nano rainbot.py

Now cut and paste (or manually enter) the code.

Running

cd ~/rainbot
python3 rainbot.py

Run At Startup

Create the following file as a superuser:

sudo nano /lib/systemd/system/rainbot.service

Add 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-reload

The script will now start in the background on reboot.

About

Rain Detector script

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages