Global Cache GC100 control of relays and serial ports

I have seen a few conversations about how to control the relays and send RS-232 serial data via IP using the Global Cache GC100. I tried the built-in support in without success. I found a way that works sufficiently for my immediate needs, and thought others might be interested. It uses a couple of simple command_line platform calls to launch python scripts. This is my first post in this forum, so I will do my best to follow the rules and format properly, but please be patient in correcting any deficiencies I have.

In this example, I am turning on a Panasonic PT-AE2000U projector via a serial string command, and simultaneously lowering a motorized screen via a relay contact closure. The combination of these two events is grouped together as “projector on.” Similarly, I have the equivalent commands to turn off the projector and raise the screen grouped as “projector off.”

First, I put the following in configuration.yaml:

  - platform: command_line
        command_on: "python3"
        command_off: "python3"
        friendly_name: Projector

The two python scripts must be placed in the config folder (where configuration.yaml is).

import socket


def projectorOn():
    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.connect((IPADDR, SERIALPORT))

def screenDown():
    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.connect((IPADDR, CONTROLPORT))


import socket


def projectorOff():
    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.connect((IPADDR, SERIALPORT))

def screenUp():
    s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    s.connect((IPADDR, CONTROLPORT))


The user will obviously need to consult the Global Cache docs and documentation for the protocols for other relays or whatever serial device they are communicating with.

This is control output only, and does not yet provide any status feedback. As I learn more about HA, I’ll work on more functionality.

I hope this is useful.


Did you happen to add status feedback by any chance ? I would be interested in using my iTach Devices with serial :slight_smile:
Thanks a lot!

No, I have not. I have been busy integrating and automating other devices, and I haven’t had an application where I needed the feedback. Sorry.

Hi all,
I am looking for some help in my challenge: 8 relay board - RS232-USB controll - integration - the evice is connected to USB (via USB->RS232 converter) of RPi
Can your idea be used “locally” in an easy way ?

First of all, thank you for building this, I’m in desperate need to get this to work with the GC-100. I set it up and your description shows, but I keep getting a “Command Failed” in the event log when I try to execute it.

Was there anything further you had to do to the .py files other than putting them into the config directory?

There are just the two steps:

  1. .py files in config directory
  2. switches setup in .yaml

You do need to edit the .py files to have your IP address. Also, I highly recommend reserving that IP address in your router, or making it static, because before I did that, my GC-100 seemed to get a new IP address after every disconnection or every day (I don’t remember which).

I don’t know what environment you are running. I am on a Raspberry Pi 3b+ running Hassio, HassOS 3.13, HA core 0.108.9, and Python 3.8.2.

I do remember when I set mine up, having to figure out that my system had python3, not python. Your system may be different, so you may want to try both. If I recall correctly, I believe you should be able to execute the python files from the SSH command line for testing, i.e. python3

I hope that helps, and welcome to the Community!


@Maco65, sorry for the slow reply, I just notice your question. I believe your problem is slightly different in that you are using a USB->RS232 converter, where the GC-100 has no USB interface, but instead, we communicate to the GC-100 from the rpi via a TCP socket.

That said, you could probably plug your interface into a GC-100 and send commands to it the way I have described here. However, you still have the return-path problem, that I have not yet solved. If you do get that solved, please share it!

Thanks for the advice. I realized that it was a silly mistake on my part. When typing out the command, I thought the 'python3 ’ was part of your command file name rather than calling python3 to run the script. After adding that, everything worked as expected.

Glad you got it working.

@blyons thank for replying. yes, you are right that my relay module communicates with HA via USB. Your suggestion is good however as I do not have GC-100 I will not invest into it at this point. Will still look for other solution.
I found the easy way to send command from command line so no Python script is needed. It is working now for several weeks with only issue that once a while the command for some reason does not reach the module and HA “believes” the relay is ON while in reality it is OFF (or vice versa).
So the final challenge is to read the status from relay (it has such option as a response from “status” message sent to it). I got it working on Node-RED so technically and logically it is fine - however last step to move info from Node-RED to HA switch (to update status) is missing.
And in general I feel I need to look into one nice elegant python script to make all of this (turn switch on, off an update the switch status). Ideally woudl be to find similar script to communicate both directions using serial interface (USB) and adjust. Still looking…