Home Script relay
Post
Cancel

Script relay

Script relay

Information

This is a script relay which can be used to support a not supported relay. TerrariumPI will execute this script with no parameters when it tries to read the current relay state. And when you change the dimmer in the GUI, the script will get an extra parameter which is a int from 0 - 100. Where 0 is off and 100 is fully on.

A single on/off relay will get the value 100 for on and 0 for off.

When for what reason the readout is not possible, return the value ‘-1’ when requested. This will tell TerrariumPI to keep the last existing value.

And make sure your script is executable. You can use the same Python libraries that are installed. See the requirements.txt for installed libraries.

An example can be found in the contrib folder.

Python scripts

In order to use the Python virtual environment with all its libraries, make sure you have the correct shebang line:

1
#!/usr/bin/env python

Docker

When using docker, you can place them in the scripts volume that you have defined in the docker-compose.yaml file. And then you can use the following address: /TerrariumPI/scripts/[name_of_script].[extension]

Setup

In order to use the Script relay use the following settings:

Mandatory

Hardware
Script relay
Address
/home/user/location/executable/script

Other settings can be found at the relay setup information

This post is licensed under CC BY 4.0 by the author.