Intertechno LAN gateway

Hi,

I know there is an intertechno binding, but it seems to me to be for directly connected 433MHz transmitters.

I have a bunch of these intertechno relay socket things hanging around doing nothing useful, and I have a LAN gateway. I know this is sort of been figured out (via this PHP thing called Connair). But I don’t really understand exactly what or how i would send something if I wanted to do it directly via Openhab. (I was thinking that maybe it could be done with something like CURL, assuming I could figure out the correct code for each switch…). Has anyone else played with this?

best,
matt

Hi Matt
the Intertechno CURL binding did not work for me neither. I have the Intertechno LAN gateway ITGW-433 and PAR-1500 wall sockets.
You can send ON/OFF with an external script. The ITGW-433 accepts commands only via UDP.
There are basic values to be set with which the whole message will be built.
Put the senditgw433.py script into /opt/openhab/customfiles. Python should be installed by default on the Raspberry Pi.

  1. find the ITGW’s IP address and put it into the script senditgw433.py

  2. add the addon org.openhab.binding.exec-1.8.2.jar (or any other version of course) to the addon folder.

  3. create the Switch item for the wall socket:
    Switch IT_PAR1500_A1 "PAR-1500 A1" <button> {exec=">[OFF:/usr/bin/python /opt/openhab/customfiles/senditgw433.py A 1 off] >[ON:/usr/bin/python /opt/openhab/customfiles/senditgw433.py A 1 on]"}

  4. The code is pretty simple. When the OFF (or ON) commands are received, openhab will execute the python script senditgw433.py with 3 arguments.
    Argument 1 is the master address (A), arg. 2 is the slave address (1), and arg. 3 the state to switch to (ON/OFF).

  5. add the item to the sitemap:
    Switch item=IT_PAR1500_A1 mappings=[ON="ON", OFF="OFF"]

  6. put the script into /opt/openhab/customfiles/ of your installation, or wherever you want and modify the path in the item file.

  7. copy-paste the script and name it senditgw433.py (or whatever and …you know)

#!/usr/bin/python

import socket import sys

UDP_IP = "192.168.200.4" UDP_PORT = 49880

#################### Basic values ########################
lo = "4," hi = "12," seqLo = "4,12,4,12," # lo + hi + lo + hi seqFl = "4,12,12,4," # lo + hi + hi + lo h = "4,12,12,4," # = seqFl l = "4,12,4,12," # = seqLo ToggleOn = "4,12,12,4,4,12,12,4," # = h + h ToggleOff = "4,12,12,4,4,12,4,12," # = h + l additional = "4,12,4,12,4,12,12,4," # = l + h headITGW = "0,0,6,11125,89,26,0," tx433version = "1," sPeedITGW = "125,"
tailITGW = tx433version + sPeedITGW + "0"

#################### Master ########################
if sys.argv[1] == "A": Master = l + l + l + l elif sys.argv[1] == "B": Master = h + l + l + l elif sys.argv[1] == "C": Master = l + h + l + l elif sys.argv[1] == "D": Master = h + h + l + l elif sys.argv[1] == "E": Master = l + l + h + l elif sys.argv[1] == "F": Master = h + l + h + l elif sys.argv[1] == "G": Master = l + h + h + l elif sys.argv[1] == "H": Master = h + h + h + l elif sys.argv[1] == "I": Master = l + l + l + h elif sys.argv[1] == "J": Master = h + l + l + h elif sys.argv[1] == "K": Master = l + h + l + h elif sys.argv[1] == "L": Master = h + h + l + h elif sys.argv[1] == "M": Master = l + l + h + h elif sys.argv[1] == "N": Master = h + l + h + h elif sys.argv[1] == "O": Master = l + h + h + h elif sys.argv[1] == "P": Master = h + h + h + h

#################### Slave ########################
if sys.argv[2] == "1": Slave = l + l + l + l elif sys.argv[2] == "2": Slave = h + l + l + l elif sys.argv[2] == "3": Slave = l + h + l + l elif sys.argv[2] == "4": Slave = h + h + l + l elif sys.argv[2] == "5": Slave = l + l + h + l elif sys.argv[2] == "6": Slave = h + l + h + l elif sys.argv[2] == "7": Slave = l + h + h + l elif sys.argv[2] == "8": Slave = h + h + h + l elif sys.argv[2] == "9": Slave = l + l + l + h elif sys.argv[2] == "10": Slave = h + l + l + h elif sys.argv[2] == "11": Slave = l + h + l + h elif sys.argv[2] == "12": Slave = h + h + l + h elif sys.argv[2] == "13": Slave = l + l + h + h elif sys.argv[2] == "14": Slave = h + l + h + h elif sys.argv[2] == "15": Slave = l + h + h + h elif sys.argv[2] == "16": Slave = h + h + h + h

#################### Toggle ########################
if sys.argv[3] == "on": Toggle = ToggleOn elif sys.argv[3] == "off": Toggle = ToggleOff

MESSAGE = headITGW + Master + Slave + additional + Toggle + tailITGW

print "UDP target IP:", UDP_IP print "UDP target port:", UDP_PORT print "message:", MESSAGE

sock = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))

The good thing with OH2 is that you can really split all configs into their own files.
So here what I did; it can surely be optimized.

intertechno.things
every switch needs to be added

exec:command:intertechnoN2 [command="/usr/bin/python /opt/openhab/customfiles/send2itgw433.py N 2 %2$s", interval=0, timeout=5, autorun=true]
exec:command:intertechnoP14 [command="/usr/bin/python /opt/openhab/customfiles/send2itgw433.py P 14 %2$s", interval=0, timeout=5, autorun=true]

intertechno.items

String IntertechnoN2		"Tankraum Licht"		<button>	(InitOO2)	{channel="exec:command:intertechnoN2:input", autoupdate="true"}
String IntertechnoP14		"Sternenkette"			<button>				{channel="exec:command:intertechnoP14:input", autoupdate="true"}

The script itself stayed the same (sorry, I didn’t realize it looked crappy above)
senditgw433.py

    #!/usr/bin/python

    import socket
    import sys

    UDP_IP          = "192.168.10.249"
    UDP_PORT        = 49880

    #################### Basic values ########################
    lo              = "4,"
    hi              = "12,"
    seqLo           = "4,12,4,12,"                   # lo + hi + lo + hi
    seqFl           = "4,12,12,4,"                   # lo + hi + hi + lo
    h               = "4,12,12,4,"                   # = seqFl
    l               = "4,12,4,12,"                   # = seqLo
    ToggleOn        = "4,12,12,4,4,12,12,4,"         # = h + h
    ToggleOff       = "4,12,12,4,4,12,4,12,"         # = h + l
    additional      = "4,12,4,12,4,12,12,4,"         # = l + h
    headITGW        = "0,0,6,11125,89,26,0,"
    tx433version    = "1,"
    sPeedITGW       = "125,"
    #tailITGW       = "1,125,0"                      # = tx433version + ',' + sPeedITGW + "0"
    tailITGW        = tx433version + sPeedITGW + "0"

    #################### Master ########################
    if sys.argv[1] == "A":
            Master = l + l + l + l
    elif sys.argv[1] == "B":
            Master = h + l + l + l
    elif sys.argv[1] == "C":
            Master = l + h + l + l
    elif sys.argv[1] == "D":
            Master = h + h + l + l
    elif sys.argv[1] == "E":
            Master = l + l + h + l
    elif sys.argv[1] == "F":
            Master = h + l + h + l
    elif sys.argv[1] == "G":
            Master = l + h + h + l
    elif sys.argv[1] == "H":
            Master = h + h + h + l
    elif sys.argv[1] == "I":
            Master = l + l + l + h
    elif sys.argv[1] == "J":
            Master = h + l + l + h
    elif sys.argv[1] == "K":
            Master = l + h + l + h
    elif sys.argv[1] == "L":
            Master = h + h + l + h
    elif sys.argv[1] == "M":
            Master = l + l + h + h
    elif sys.argv[1] == "N":
            Master = h + l + h + h
    elif sys.argv[1] == "O":
            Master = l + h + h + h
    elif sys.argv[1] == "P":
            Master = h + h + h + h

    #################### Slave ########################
    if sys.argv[2] == "1":
            Slave = l + l + l + l
    elif sys.argv[2] == "2":
            Slave = h + l + l + l
    elif sys.argv[2] == "3":
            Slave = l + h + l + l
    elif sys.argv[2] == "4":
            Slave = h + h + l + l
    elif sys.argv[2] == "5":
            Slave = l + l + h + l
    elif sys.argv[2] == "6":
            Slave = h + l + h + l
    elif sys.argv[2] == "7":
            Slave = l + h + h + l
    elif sys.argv[2] == "8":
            Slave = h + h + h + l
    elif sys.argv[2] == "9":
            Slave = l + l + l + h
    elif sys.argv[2] == "10":
            Slave = h + l + l + h
    elif sys.argv[2] == "11":
            Slave = l + h + l + h
    elif sys.argv[2] == "12":
            Slave = h + h + l + h
    elif sys.argv[2] == "13":
            Slave = l + l + h + h
    elif sys.argv[2] == "14":
            Slave = h + l + h + h
    elif sys.argv[2] == "15":
            Slave = l + h + h + h
    elif sys.argv[2] == "16":
            Slave = h + h + h + h

    #################### Toggle ########################
    if sys.argv[3] == "on":
            Toggle = ToggleOn
    elif sys.argv[3] == "off":
            Toggle = ToggleOff

    # MESSAGE = headITGW + master + slave + additional + on/off + tailITGW
    MESSAGE = headITGW + Master + Slave + additional + Toggle + tailITGW

    print "UDP target IP:", UDP_IP
    print "UDP target port:", UDP_PORT
    print "message:", MESSAGE

    sock = socket.socket(socket.AF_INET, # Internet
                         socket.SOCK_DGRAM) # UDP
    sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))

In the rules.rules file, the Intertechno switches can be controlled with

sendCommand(IntertechnoN2, "ON")
sendCommand(IntertechnoP14, "OFF")

The binding “Exec Binding” needs to be added to the PaperUI, then those 2 switches will appear in the Inbox.

Hope it helped

1 Like

Hi,
I try to connect my Intertechno LAN gateway to OpenHAB 2.5.10

I have in my things:
Thing exec:command:intertechnoB1 [command="/usr/bin/python /etc/openhab2/services/senditgw433.py B 1 %2$s", interval=0, timeout=5, autorun=true]

Then I added to /etc/openhab2/misc/exec.whitelist:

/usr/bin/python /etc/openhab2/services/senditgw433.py B 1 %2$s

And I installed in PaperUI: Add-ons -> Transformations -> RegEx TRansformation
I also installed in PaperUI: Add-ons -> Bindings -> Exec Binding

Now I have no Error in the log Files.

My item is:
String Wohnzimmer_Deckenlampe "Wohnzimmer Deckenlampe" <light> {channel="exec:command:intertechnoB1:input", autoupdate="true"}

My sitemap is:
Switch item=Wohnzimmer_Deckenlampe mappings=[ON="ON", OFF="OFF"]

Nothing happens when I use the switch.

When I connect via ssh to my raspberrypi and enter this:
/usr/bin/python /etc/openhab2/services/senditgw433.py B 1 on
the blue light at the LAN gateway blinks blue and it works!
When I use the app it works fine.

Can someone help me?

1 Like

Hi Georg,
at Thing level, you have to enable the “autorun” option. And you also should link the “run” channel.

For more stability, I do not use the “autorun”, and I pass also the maser and salve code to python by the input channel.

var eventItem = this.event.itemName;

logger.debug("Event item:  " + eventItem);
logger.debug("newState:  " + state);

var switchCode = [];
switch (eventItem) {
  case "EGBueroLicht":
    switchCode.push("B");
    switchCode.push("16");
    break;
//....
  default:
    logger.error("No event item found: " + eventItem);
    break;
}

// rollershutter can also set to 'STOP'. At intertechno a stop is triggered by repeating the command
if (state == STOP) {
  
  var last_cmd = items.EGKueITGW_Eingabewert.split(",");
  
  logger.debug("last_cmd: " + last_cmd);
  logger.debug("switchCode: " + switchCode)

  if (last_cmd[0] == switchCode[0] // make sure, it's the same IT device code
       && last_cmd[1] == switchCode[1])
  {
    switchCode.push(last_cmd[3]);
  } else { // stopping an other device is not possible
    logger.warn("Not possible to stop!");
  }
} else { // not STOP, rather ON/OFF/UP/DOWN
    switchCode.push(state);
}

events.sendCommand("EGKueITGW_Eingabewert", switchCode.join(",")); // ON /OFF // DOWN / UP
events.sendCommand("EGKueITGW_Ausfuhrung", ON.toString()); // "ON" to run the py script