Skip to content

gabrielmdc/gcr-server

Repository files navigation

Gpio Control Relay

Gpio Control Relay service

This program allows you to turn on/off a relay connected to a Raspberry Pi by a gpio port. To configure and communicate with the service and use the relays, it is necessary a client program. Here is a list of clients.

Requirements

  • Raspberry Pi or compatible
  • A Gnu/Linux system installed (LibreELEC OS recommended, if you want to install this in a different OS, please check the Gpio path in the notes)
    • Python 3.x
    • Systemd

Installation

Just download the ZIP, and run /install.sh as superuser:

su
bash install.sh
# or
sudo bash install.sh

This will create a daemon in the system that is listening for new connections on the port 10000.

Uninstall

cd /usr/lib/gcr-server
sudo bash uninstall.sh

Service commands

To start the service manually

sudo systemctl start gcr-server.service

To stop the service

sudo systemctl stop gcr-server.service

To restart the service

sudo systemctl restart gcr-server.service

Configuration

It is necessary a client to add relays and configure their gpio ports.

Other configurations

Clients

GCR Android client (this is not a release version) More clients are incoming ;)

Notes

Socket port

Used by the socket for the communication with the app.
By default: 10000 You can change it from SOCKET_PORT in /service.py

GPIO path

It depends on the system, it has the LibreELEC path by default.
By default: /sys/class/gpio You can change it from GPIO_DIRECTORY_NAME in /lib/repository/gpio.py

Connect the relays

This is an example about how to connect a relay to a Raspberry Pi.

Relay connection schema

In this example the relay is connected on port Gpio 7. Now, from the client application, it is necessary to configure (only once, the first time), a relay connected on port 7.