Skip to content

asmyczek/YASC

Repository files navigation

YASC

Yet Another Sprinkler Controller for under 20 Euro

Controller

The reason for starting this project was to get my kids interested in electronic circuits and to teach them how to solder those, which these days is a life skill :) Now this basic controller irrigates my garden and is fully controlled by Homeassistant. And new extensions are on the way...

After playing with different setups, I opted out for this basic circuit. You will only need:

  • Raspberry Pi Zero W
  • 8 channel relay board, anyone should work
  • 8x:
    • 2N3904 or 2N2222 transistor
    • 10kOhms resistor
    • 2.2kOhms resistor

Most irrigation valves run on 22-28VAC, not DC power. A step down converter with a rectifier would do the job, but since I have a drawer full of micro usb power supplies, I kept the Pi and sprinkler circuits separate.

To adjust your circuit to YASC code, just update ZONES list in pi_controller.py to connected GPIO pins.

Installation

Controller

Required Python 3.6

Get the repo:

git clone https://github.com/asmyczek/YASC.git

In YASC directory create virtual environment and load it if not done automatically:

virtualenv -p python3 venv
source venv/bin/activate

Install requirements.txt:

pip install -r requirements.txt

Ignore GPIO errors if you don't run it on a Pi.

Set environment variables:

export YASC_PATH={path_to_yasc}/YASC
export YASC_ENV=dev
export YASC_LOG_LEVEL=debug

Start the app:

./start_yasc.sh

Go to http://localhost:8080/ or your Pi.

Setup as a linux service

Copy systemd/YASC.service to /lib/systemd/system/. Change path_to_yasc to the location of your YASC installation.

Now enable it on boot and start it:

sudo systemctl enable YASC.service
sudo systemctl start YASC.service

You can check status of the service with:

sudo systemctl status YASC.service

Or logs in yasc_path/yasc.log.

Integrate with Home Assistant

Copy homeassistant/yasc.yaml file into your ~/.homeassistant/packages directory. Adjust mqtt topics and verify that

packages: !include_dir_named packages

is configured in configuration.yaml.