TCP Binding

Hi All,

As a ( very ) newcomer, I have trouble getting tcp binding working. I have a GPIO ( Pi )installed and working but I would like to output command to an ip gateway connected directly to my Luxom domotic system.

I need to be able to output true ASCII sequences like :" *S,0,2,01; " in order to switch a specific light ON or " *C,0,2,01; " to have it switched OFF.

Can someone give me a idea about the lines I need to properly insert into the OpeHAB demo files to start having tcp binding working ?

Many thanks in advance.



Per the wiki page:

The TCPBinding provides basic support for TCP based ASCII protocols. It sends and receives data as ASCII strings. Data sent out is padded with a CR/LF.

So the ASCII part should be handled for you. Given that, per the wiki page, you have a number of settings to make in openhab.cfg. See the “Configuration Parameters” section for details.

Then you need to create a .map file placed in the transform folder with the contents:

ON= *S,0,2,01; 
OFF = *C,0,2,01; 

NOTE: Because you have leading and closing spaces you may need to surround the above in quotes or you may need to use an alternative approach using Rules to send the string with the spaces.

Finally, per the example on the wiki page:

tcp=">[ON:'MAP(')], >[OFF:'MAP(']"

Replace the IP address with the destination and “” with the name of the map file you created above.


Many thanks for your help.

I have performed numerous tests but I still have a lot of problem. I am trying to understand the basic logic in order to go step by step.

TCP connection is ok and I have seen that when I send a command “*T,0,2,01;” to turn a light ON when it is OFF like a Toggle ( there is in fact no trailing blanks and every command start with an " * " and ends uip with a " ; " ), I see no reaction on the light but the message is well passed on the bus as I get an answer from my LUXOM system as " @1T,0,2,01;@1S,0,2,01 ". @1 seems to be taken as an answer from the system but what heart me at the moment is that the LUXOM system doesn’t react at all trun the light ON.

I still have to play with my system before getting a clear picture of what happen but the main error, since the start of the system, is something like :

tractSocketChannelBinding] - The channel for / is now connected
2016-01-13 05:36:09.078 [ERROR] [t.i.s.MapTransformationService] - opening file ‘’], >[OFF:‘MAP(’ throws exception configurations\transform\’], >[OFF:'MAP( (The filename, directory name, or volume label syntax is incorrect)

The channel is connected.


I will let you after some more testing.



This is a recently uncovered bug in 1.8. See this thread.

@steve1, is there a “hot fix” binding JAR you could provide until 1.8.1 is available?

1 Like

I’ve sent you a message to discuss how to make this happen.

I put a hot fix jar on Dropbox is someone wants to try it.

Seems working fine! :wink:

Thanks Steve!

I was using a work around:

Group All
Group Light (All)
`/* dummy */` `String cmdKNXER "knxer_cmd" (All) {tcp=">[]"}`
/* Lights */
Switch Light_win "Light_win" (Light)

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*

rule "Initialize knxer"
        System started

rule "Light 1 Control"
        Item Light_win received command
            case ON:
                sendCommand( cmdKNXER, "<knx>CMD=WR;GA=4/0/10;VAL=01;DLEN=0</knx>" )
            case OFF:
                sendCommand( cmdKNXER, "<knx>CMD=WR;GA=4/0/10;VAL=00;DLEN=0</knx>" )            

NOTE: I have a personalized connection to KNX, whick I call KNXer. I use raspberrypi2 or beagle bone black with KNX stack written by me, together with a socket connection and a tcp protocol defined by me; that being the reason why I’m playing with TCP binding.

Thanks for trying it! Just to be sure, did you test tcp/udp binding configs with multiple subconfigs (for example, both an input and output config) separated by commas?

Hi! You’re welcome.

this works:

Group All
Group Light     (All)

/* dummy */
String cmdKNXER            "knxer_cmd"        (All)    {tcp=">[]"}

/* Lights */
Switch Light_win         "Light_win"         (Light)
Switch Light_map         "Light_map"         (Light)    {tcp=">[ON:], >[OFF:]"}


I didn’t test the “input mode” because in my topology openHab is the “client” of my “server” application KNXer.
Also I couldn’t figure out how to, with .map, take feedbacks. In my case the On and Off state comes via different frame. The hypotetical code of the .map would be:


In fact I use the rules together with java script for the parsing, wich solves all of my problems, because the fields inside of my frame can be in different positions.

@jcbastosportela, thanks again!

1 Like

Hi Luc,
I also have a luxom domotica system and want to connect it with Openhab. Does a binding exist for Luxom? Did your project succeed?

Kind regards

Hi Filip,

My system is now working perfectly with Domoticz. It could also be working with OpenHAB but I have not yet had time enough to make the transfer ( time to write all configuration files ).

I have tried with some bindings but without true success. What I am now using is a MQTT server between Domoticz and Luxom. As such, I have also added 1-wire temperature sensors and switches. I also have HUE lights and Arduino based water flow sensors and everything is working smoothly. OpenVPN let me do everything remote.

As soon as time will permit, I am planning to go back to OpenHAB in order to have more flexibilities.

Picture below shows part of the system but pictures could be improved … Time !



Thank you for answering Luc.
I read that de TCP-binding is obsolete and not te be used in openhab; They also refer to MQTT as a workaround.

Next question:
How did you managed to get a MQTT signal out/in Luxom? Did you install some new hardware like a TCP/IP - MQTT gateway?

Hope you get me on track!
kind regards

Not correct. It is not that it’s obsolete and not to be used s much as it’s going to become obsolete. It won’t be supported by OH 3. However, there is not yet a replacement that will work on OH 3 so there might be a temporarily loss of support for TCP when OH 3 first comes out in a year. It won’t be a complete loss of support as there will be a way to run a stripped down OH 1/2 instance that supports OH 1 bindings and communicate with the OH 3 instance.

MQTT isn’t a work around, it’s an alternative. MQTT itself works over TCP. But it works at a much higher level which means it’s much easier to work with.

There isn’t enough detail above but I suspect Luc has a Luxom to MQTT gateway of some sort. I doubt Luxom uses MQTT natively.

Hi Filip,

Yes, you must have an MQTT server between the LUXOM gateway and Domoticz/OpenHAB see ( see IDX 7 ).

I had trouble with the IPHONE gateway as it is doing a reset every 12 h - a few minutes. That means you must keep your socket open by checking often ( I did it every minute ).

I am using Python script to manage the link between the two systems ( in / out ).



Hi Luc, Hi Filip,

I managed to control Luxom using the Telnet platform in Home Assistant. I would prefer Openhab in the long run as it provides a lot more integrations.

It is quite straightforward to set up as long as you don’t need feedback on the status (if I try, my IP interface “hangs” within minutes. Switching it fully off/on is then the only solution).

Could you share some more information how you have done the MQTT set up? Is one physical device (e.g. raspberry pi) enough for running for MQTT and Openhab/Domotics/Home Assistant?