Skip to content

zehnm/pi-power-switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pi-power-switch

Control relay board with REST API on a Raspberry Pi

Under development - current version is a proof of concept only!

Tested with:

Features

  • Control GPIO output pins with simple REST API
  • One output emulates myStrom WiFi Switch API for simple integration into other scripts
  • Runs as system service (see scripts/init.d)

Installation

  1. Install bottle and gpiozero Python libraries:

    pip install bottle
    sudo apt install python-gpiozero
    
  2. Copy this file to /home/pi

    or wherever you prefer, e.g. /usr/local/bin

  3. Connect relay module board:

    • verify if relays are active high or low. Adapt Python script accordingly.
    • set BCM pin numbers in Python script
  4. Install script as system service:

    if this script was not installed in /home/pi: change $DIR and $LOG_DIR in pi-power-api script.

    sudo copy ./scripts/init.d/pi-power-api /etc/init.d/
    sudo chmod 755 /etc/init.d/pi-power-api
    sudo update-rc.d pi-power-api defaults
    
  5. Start daemon

    sudo service pi-power-api start
    

TODO

  • Externalize hard coded values into configuration file
  • Support remote GPIO
  • Simple web-interface

About

Control relay board with REST API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published