Skip to content

Latest commit

 

History

History

PyRelayControl

PyRelayControl

PyQt5 GUI app to configure the wiring and control the relays.

Installation

Installation on Windows

  1. First install Python 3.8.x in C:\Python38 (Windows x86-64 executable installer from python.org)

  2. Download RelayControlInstallation.zip from this GitHub repository

  3. Unflate it in a folder of your choice (for xcape.io Room users, choose the Plugins folder).

  4. Run install.bat with a double-click to create the Python virtual environment (venv).

  5. Set MQTT broker IP address in constants.py

    MQTT_DEFAULT_HOST = 'localhost'  # replace localhost with your broker IP address
  6. Run test.bat to test your new settings app.

Installation on Debian based Linux distros

PyRelayControl is a pure python applet so you can install it on any computer running python with PyQt5.

Example of installation on Ubuntu/Debian based distros

You will have to install following Python packages:

$ sudo apt-get update
$ sudo apt-get install python3-pip
$ pip3 install --user pyqt5
$ sudo apt-get install python3-pyqt5
$ sudo apt-get install qt5-default pyqt5-dev pyqt5-dev-tools

Then:

  1. Download RelayControlInstallation.zip from this GitHub repository

  2. Unflate it in a folder of your choice

  3. From this folder, install requirements

    $ pip3 install -r requirements.txt
  4. Start the settings app, assuming your MQTT broker IP address is 192.168.1.42

    $ python3 main.py -s 192.168.1.42

Installation on Raspberry Pi (Raspbian)

With the new Raspberry Pi 4 with 2 HDMI outputs and 4GB memory, controlling your escape room with a Raspberry Pi starts to make sense.

You will have to install following Python packages:

$ sudo apt-get update
$ sudo apt-get install qt5-default pyqt5-dev pyqt5-dev-tools
$ sudo apt-get install python3-pyqt5 python3-pyqt5-dbg

Then:

  1. Download RelayControlInstallation.zip from this GitHub repository

  2. Unflate it in a folder of your choice

  3. From this folder, install requirements

    $ pip3 install -r requirements.txt
  4. Start the settings app, assuming your MQTT broker IP address is 192.168.1.42

    $ python3 main.py -s 192.168.1.42

Installation on Mac

PyQt5 installation on Mac can be tricky, see PyQt5 installation on Mac at LearnPyQt.

Usage

At fisrt start (prop.ini not created yet), configure the relay prop:

To configure the Relay prop:

  1. Choose Arduino, Raspberry or STM32 board model
  2. Set board option if any (Dragino Yún shield or MCP23017 expander)
  3. Edit prop MQTT topics (inbosd/outbox/wiring)
  4. Set MQTT broker IP address and port

At first start, when choosing board model:

  • prop name is filled with a default name
  • inbox topic is filled with xcape.io recommandations
  • outbox topic is filled as well
  • wiring topic is filled too

When you apply the prop settings, the control panel appears as well as the wiring dialog (because, it' first start).

Wiring configuration

Click on a pin button to configure:

To move a configuration to another pin, select an available pin in the output field.

When all pins are configured (they are saved to a local JSON file), you have to Upload wiring to broker so the prop receives the wiring and setup itself its GPIO and commands.

Build the control panel

This is done in one-click on Rebuild panel from new wiring:

Passing by, you may fill SSH credentials for Relaunch and Reboot button.

All widgets are light switches and they are gouped (for variable with / separtor like maglocks/*):

You can Edit captions and indicators:

The panel widgets editor before customization:

The panel widgets editor after customization:

You can change captions and switch images, move the groups up and down and hide widgets or entire groups.

Eventually, the final control panel:

For Raspberry Pi prop, Relaunch button edition is enabled:

The SSH command is set by default for the PiPyRelayProp, you may have to change the script path:

Author

Faure Systems (Jun 28th, 2020)