Rain Detector script
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
esp8266
.gitignore
LICENSE
README.md
Rain Sensor Double.stl
Rain Sensor Lid.stl
rainbot.py

README.md

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.