Skip to main content

Receive and/or send commands to radio controlled sockets (model GT-FSI-11) from brand "Globaltronics".

Project description


This package provides the Python module 'gtsocket' which can be used to send commands to (switch on and off) 433Mhz controlled
sockets (model GT-FSI-11) from the manufacturer 'Globaltronics' and to receive such commands sent by the corresponding remote.

Supported models (known so far) are:
* Globaltronics: GT-FSI-11 (also sold as EasyHome by ALDI Süd)

If you were able to successfully work with another model, please send me an [e-mail]( and I'll update this document.

I'll try to describe this module as completely as possible in this document. If you prefer a quick overview please read at least the sections **Usage** and **Scripts**.


This package can be installed via PIP:

pip install gtsocket

or cloned from the GitHub page:

git clone

How it works

As far as I analysed the protocol, sending commands (on/off) to the sockets by the remote works as follows:

The remote transmits information by switching on and off sending on 433Mhz.

A **signal** (as used in this document) is a period of time during which sending on 433Mhz is either ON the whole time or OFF the whole time.
Such signals are defined as positive or negative integers in the config.
Positive values mean X microsec ON, negatives mean X microsec OFF, i.e. 300 = 300 microsec ON (receiving a signal on 433Mhz), -2400 = 2400 microsec. OFF (not receiving any signal).

A **signal sequence** (as used in this document) refers to a sequence of signals, for example: [-300, 700] meaning first 300 microsec. OFF, then 700 microsec. ON.

A **data sequence** is a sequence of binary 1s and 0s. An encoding defines how to transmit a data sequence as a signal sequence. For example a 1 might be transmitted as [300, -700] and a 0 as [1000, -200].

Each command as sent from the remote to a socket consists of four parts with the following schema:

init start data end

- the **init** signal sequence: shared by all commands sent in the same encoding
- the **start** data sequence: shared by all commands
- the **data** data sequence: shared by one or more socket-command combinations
- the **end** data sequence: shared by all commands for a specific socket

Each socket-command combination has difference data sequences that work. The remote sends those one after the other. Each command sequence is sent in all available encodings (in my case two) and repeated several times (in my case four times).

In summary, sending command ON to socket A might look like this:

init start data(A-on1) end(A) [sent in encoding 1 four times]
init start data(A-on1) end(A) [sent in encoding 2 four times]
init start data(A-on2) end(A) [sent in encoding 1 four times]
init start data(A-on2) end(A) [sent in encoding 2 four times]
init start data(A-on3) end(A) [sent in encoding 1 four times]
init start data(A-on3) end(A) [sent in encoding 2 four times]
init start data(A-on4) end(A) [sent in encoding 1 four times]
init start data(A-on4) end(A) [sent in encoding 2 four times]

The following configuration section describes how to define the encodings and data sequences for the needed commands.


(Please see script section below - the gtsocket-setup script provides a wizard for creating a config file.)
(Please also see the gtsocket.cfg file for a default config with explaining comments.)

In the [general] section with:

- **receiving_GPIO_pin** and **sending_GPIO_pin** set the Rasperry Pi GPIO BCM pin numbers the 433Mhz receiver and sender are connected to
- **max_signal_difference** define the maximum difference between the measured signal length and the signal length defined in an encoding for the measured signal to be recognized as the defined signal (in percent)
- **sequence_min_length** define the minimum length of a sequence of signals to be considered valid, shorter sequences will not trigger a signal/command
- **sequence_repetitions** define how often a command signal sequence is repeated using a given encoding when sending a command (the manufacturer's
remote repeats four times)

The command signal sequences are sent in different encodings. My remote sends commands in two different encodings and I assume other remotes use the same encodings. So you probably can keep the default config here. The encodings are defined as follows:


The section must be named [encoding:NAME]. The NAME of the encoding can be chosen freely (but you should better omit whitespace characters).
Each command sequence starts with an init sequence consisting of two signals, each binary 1 and each binary 0 is encoded as two signals each.

Sockets switched by the same remote share the same encodings and the same start data sequence. Those are defined in a [group:NAME] section.


With **encodings** define the names of the encodings and with **start_data** the start data sequence used by the group of sockets.

Each individual socket is defined in a [socket:NAME] section.


With **group** define the group of sockets this socket belongs to. With **end_data** define the end data sequence this socket uses. With **on_command_data** and **off_command_data** define the data sequences for commands ON and OFF as a comma-separated list. Some socket-command combinations share the same data sequences. For my sockets the data sequences for A-on and C-off are the same. In such cases you can reuse the data sequences of another socket as follows:



Make sure you complete the configuration part first. The default configuration will most probably not work with your sockets. The `bin/gtsocket-setup` script provides a wizard for creating a config file specific for your setup.
Please have a look at the `bin/gtsocket-test` script which contains working examples for sending and receiving commands.

Sending commands

After importing the module

import gtsocket

initialize GPIOs of Raspberry Pi as configured in config file. This configures sending pin as output pin and
receiving pin as input pin. This has to be done only once at the beginning of the script, **not** every time a command is sent.


Create socket object specifying the name (as defined in the config) of the socket the command should be sent to ('A' in this case) and send command 'on'
to (switch on) this socket.

socket = gtsocket.Socket('A')

Clear GPIOs of Raspberry Pi which have been initialized with initialize_GPIOs(). This sets those pins back to input mode.
This has to be done only once at the end of the script, **not** every time a command is sent.


Receiving commands

Import module:

import gtsocket

Initialize GPIOs of Raspberry Pi as described in *sending commands*:


Create socket object, which commands should be received for:

socket = gtsocket.Socket('A')

Register any function as a command handler for this socket:


The function will receive the socket object and the command received as arguments. It might for example look like this:

def my_command_handler(socket, command):
print("Received command", command, "for socket", socket.get_name())

Start receiving commands for this socket. This will create a new thread which does the receiving. The thread is saved in
`socket.receiving_thread` and returned by `start_receiving()`.


Once you want to stop receiving:


Clear GPIOs of Raspberry Pi as described in *sending commands*.



When installed via pip the commands `gtsocket-setup` and `gtsocket-test` are available (otherwise you'll find them in the `bin/` folder).
`gtsocket-setup` is a helper tool to find out the correct encoding and signal/data sequences for your specific sockets and
create a config file for your setup.
`gtsocket-test` serves as a demo which shows how to use the module and can be used to manually send commands and test if
receiving commands works.

Setup script - gtsocket-setup

Execute script with `gtsocket-setup` and follow the instructions. A config file specific for your setup will be created as `~/.gtsocket/config.ini`.

The setup script consists of three steps: *pins*, *encodings* and *sequences*.
Invoking the script without any option will start with the first step.
With the option **-s / --step** you can directly jump to a certain step.

At the beginning of the script (regardless of the step) you are asked which group of sockets you want to create the config for. A group of sockets are
those sockets controlled by the same remote. You can choose a name freely but you should avoid whitespace characters.

**pins** defines the GPIO pins the sending and receiving devices are connected to.

**encodings** is used to determine the encodings your remote uses to send the data (how long the signals sent via radio are, which are used to
send binary 1s and 0s). (Please see also sections *How it works* and *Configuration*)

You'll be asked to press and hold a button on your remote so that the script can receive transmitted signals and determine the encoding (with your help).
After that you'll get an overview of the received signals which should look similar to this:

P(0)=-200, P(1)=800, P(2)=-500, P(3)=1000, P(4)=200, P(5)=-100, P(6)=300, P(7)=-1200, P(8)=-1300, P(9)=-2400, P(a)=1100, P(b)=2900, P(c)=-7300, P(d)=900, P(e)=-600, P(f)=400, P(10)=-1100, P(11)=-5700, P(12)=100, P(13)=-1500, P(14)=-1400, P(15)=-1000, P(16)=-400, P(17)=700, P(18)=-800, P(19)=3000, P(1a)=600, P(1b)=-2500, P(1c)=-3400, P(1d)=-900, P(1e)=-700
Received signals:

The first line is a legend and shows how (with which indices) the received signals are shown to you below. Received signals are separated by dots and each number corresponds to a received signal. In this example a "0" means we received a low signal of 200µs and a "6" means we received a high signal of 300µs.

Now you have to specify which signals you think belong to the actual command signals and which are noise. This looks more complicated than it is. Just look which indices repeat in the sequence and which do not. In this example the indices "0" and "1" you can find in the beginning but they do not appear later, so they are most probably noise. "3", "8", "10" for example appear pretty often.

Now decide which indices to keep (command signals) and which to dismiss (noise). You do not have to be 100% correct on the first try. Just keep those you are sure are command signals and those you are not sure about. You'll repeat this until you are pretty sure about the command signals. Better keep too many than too few. A couple of wrong signals won't harm that much later. (Reading *How it works* and *Configuration* will help you here.)

Once you have narrowed down the command signals long enough you should see something like this (The dots disappear once we don't need them anymore to distinguish between indices like "1", "0" and "10"):

P(0)=300, P(1)=-2400, P(2)=1000, P(3)=-500, P(4)=-1200, P(5)=2900, P(6)=-7300, P(7)=900, P(8)=-600, P(9)=400, P(a)=-1100
Received signals: 04787878949401232323042304042323042323042304232304230423230404012323230423040423230423230423042323042304232304040123232304710404040404040403000003030400000000000800030003080004280423000000000003040401232323042304042323042323042304232304230423230404567878789a789a9a78789a78789a789a78789a789a7

After choosing a name for the encoding (you can choose freely but I suggest to keep the default) you'll be asked to give the signal sequences for "init", "binary 1" and "binary 0". Those have to be extracted from the received signal sequence above. Once you've understood the underlying system (see sections *How it works* and *Configuration*) those are easy to spot:

In the received signal sequence you should find repeating patterns which start with an "init" sequence consisting of two signals followed by a sequence of binary 1s and 0s each encoding by two signals. The received signal sequence above for example contains the following patterns:

047878789494 (initial rubbish)
01232323042304042323042323042304232304230423230404 (init sequence 01, followed by pairs of 23 and 04)
Later on:
567878789a789a9a78789a78789a789a78789a789a78789a9a (init sequence 56, followed by pairs of 78 and 9a)

Those are your encodings:

- Encoding 1: 01 = Init, 23 = binary 1, 04 = binary 0
- Encoding 2: 56 = Init, 78 = binary 1, 9a = binary 0

Which one you define as binary 1 and which as binary 0 does not matter. But you have to be consistent between the two encodings. You might have noticed that `01232323042304042323042323042304232304230423230404` and `567878789a789a9a78789a78789a789a78789a789a78789a9a` encode the same data just with two different encodings. So if you choose to set `23` as binary 1 you also have to set `78` as binary 1.

**sequences** is used to determine the actual data that is sent for each command (like "switch on socket A").

For that you have to determine the data which is sent for each button (socket command combination) you want to be able to use.
Please follow the instructions of the script. You should get an output similar to the following. (If not, you most probably made a mistake during the "encodings" step. Please try to redo it.):


As you can see each set of data is sent eight times (4 times in encoding 1 and 4 times in encoding 2 (you cannot see the different encodings here)). Now you have to tell the script the "start data", "data sequence" and "end data" for each button (socket command combination). The "start data" should be the same for all buttons, the "end data" should be unique for each socket (not button!) and you should be able to see four different "data sequences". The script helps to distinguish between the three by separating them with dashes. In this example the "start data" is `1110`, the "end data" is `1100` and the "data sequences" are `1100011110010101`, `1001101101011010`, `1101111110100110` and `0111001011010001` (the last one was be repated, too, but was truncated here).

Once you have found all the data sent with the buttons on your remote, you'll find your config file specific for your sockets in `~/.gtsocket/config.ini` and you are ready to go and test with the `gtsocket-test` script.

Testing script - gtsocket-test

Use the following command to send a command to a specific socket (in this example send command 'on' to socket 'A'):

gtsocket-test -m send -s A -c on

To receive and print to stdout commands for a specific socket for a certain amount of time (in this example socket 'B' for 5 sec):

gtsocket-test -m receive -s B -t 5

Known issues

- Receiving signals/commands from the remote for multiple sockets at the same time does not work well.
In that case many signals are not recognized correctly which leads to commands not being detected.

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gtsocket-0.1.tar.gz (21.7 kB view hashes)

Uploaded source

Built Distributions

gtsocket-0.1-py3-none-any.whl (33.6 kB view hashes)

Uploaded py3

gtsocket-0.1-py2-none-any.whl (29.6 kB view hashes)

Uploaded py2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page