TCP binding outgoing item: configuration question

384 views
Skip to first unread message

Tom

unread,
Nov 13, 2013, 3:03:04 AM11/13/13
to ope...@googlegroups.com
Feeling silly again ... :-)

I am trying to send irtrans commands (arbitrary one-line ASCII text) via the TCP binding. This is my  first attempt on setting up an outgoing TCP binding, so probably I misunderstood something. My setup looks like this:

items entry:

String remote1 "IrTrans remote1" { tcp=">[C11:blablaix:21000:'MAP(iremote.map)']"}

iremote.map:

C11=ASC.....

OpenHAB (1.4.0 nightly) connects to port 21000 during startup (and keeps connected ...). When I am sending a C11 comand to remote1, nothing happens at TCP binding level (no log entry, iremote.map is not changing last access time, tcpdump does not see any packets transmitted). What am I doing wrong?

Log excerpt (names and IPs obfuscated):

21:19:28.459 INFO  o.o.b.t.p.internal.TCPBinding[:184]- Updating states with returned values will be set to the default vaulue of true
21:19:28.461 DEBUG o.o.b.t.AbstractSocketChannelBinding[:1315]- Setting up the outbound channel Channel [item=remote1, command=C11, direction=OUT, remote=blablaix/192.168.16.1:21000, buffer=, isBlocking=false, isReconnecting=false, channel=, host=blablaix, port=21000]
21:19:28.462 INFO  o.o.b.t.AbstractSocketChannelBinding[:1318]- Connecting the channel Channel [item=remote1, command=C11, direction=OUT, remote=blablaix/192.168.16.1:21000, buffer=, isBlocking=false, isReconnecting=false, channel=, host=blablaix, port=21000]
21:19:28.462 INFO  o.o.b.t.AbstractSocketChannelBinding[:1525]- The channel for blablaix/192.168.16.1:21000 is now connected

Console:

osgi> openhab send remote1 C11
08:48:33.317 DEBUG o.o.i.t.m.i.MqttBrokerConnection[:414] - Publishing message to topic /openHAB/out/remote1/command
08:48:33.319 INFO  runtime.busevents[:22] - remote1 received command C11
Command has been sent successfully.

Kind regards,
Tom




Karel Goderis

unread,
Nov 13, 2013, 4:44:10 AM11/13/13
to ope...@googlegroups.com
Hi Tom,

Did you already study the ASCI based IrTrans protocol (http://www.irtrans.de/download/Docs/IRTrans%20TCP%20ASCII%20Interface_EN.pdf) ? You are supposed to first initialise the irTrans device by sending "ASCI" without any CR/LF. After that you can send regular "Asnd ..." commands. Now, the TCP binding can be configured in openhab.cfg to prepend or append certain strings to data sent (e.g. LF/CR), but it does so for all the connections it manages. In the case of IrTrans this is a problem, as the first string has to be without CR/LF, all the others are *with* a CR or LF. 

The standard TCP binding is thus not a good choice for irTrans, but that being said, I have a dedicated irTrans binding in the pipeline (more or less finished but needs more testing) that will be able to send "samsung,play" style commands (it supports the irTrans devices with on-board irDB)

Jus to make sure there is nothing else wrong with the binding, could you change your item definition and use the IP address instead of blablaix? just want to be sure that DNS is not the issue here.

Karel

--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
For more options, visit https://groups.google.com/groups/opt_out.

Tom

unread,
Nov 13, 2013, 5:07:46 AM11/13/13
to ope...@googlegroups.com
Hello Karel,


Am Mittwoch, 13. November 2013 10:44:10 UTC+1 schrieb karel....@me.com:

Did you already study the ASCI based IrTrans protocol

Yes, I have actually a working shell script (using netcat) but thought that in the progress of moving to OpenHAB I'd like to not use the old script.

Unfortunately, the TCPbinding does connect to IrTrans but never actually sends anything (verified with tcpdump)  - so I am not even at a stage where I could have misconfigured the string to be sent.

The standard TCP binding is thus not a good choice for irTrans, but that being said, I have a dedicated irTrans binding in the pipeline

Yes, I know :-)
I am looking forward to using it (tell me if you need a tester ...), but thought I experiment with TCP binding in the meantime (might be useful for many other low level devices, too).

Jus to make sure there is nothing else wrong with the binding, could you change your item definition and use the IP address instead of blablaix? just want to be sure that DNS is not the issue here.

I have just tried that ... no success, either :-(

Kind regards,
Tom
 

Karel Goderis

unread,
Nov 13, 2013, 5:30:59 AM11/13/13
to ope...@googlegroups.com
Tom

can you enable the DEBUG setting for the TCP binding in the logback xml file and provide me a bit more context? Also, did you try to send commands through a switch button or alike via the web interface? e.g. I presume you send the command in your tests after that the bindings connects to the irtrans device....?

At first sight your .items definition looks OK. Did you try the same with "nc" at the other end instead of the actual irTrans device? (e.g. then connect to localhost/127.0.0.1 instead, but with the same definition and MAPs)?

Regards
K

Tom

unread,
Nov 13, 2013, 9:48:29 AM11/13/13
to ope...@googlegroups.com

Hi Karel,

the log excerpt posted before was with "start_debug.sh" ... I gave it another try using "normal" log level and setting TCP bindings log level to TRACE. The full log is attached, this time - it is short enough. Also ran a netcat server on port 20999 (session output inserted in the log) and changed item configuration to port 20999 (nothing else): OpenHAB connects and leaves no message (not expected anything else, tcpdump won't miss a packet ...).

Kind regards,
Tom
log.txt

Karel Goderis

unread,
Nov 13, 2013, 1:16:44 PM11/13/13
to ope...@googlegroups.com
Tom

I  should have seen this early on, but I will not blaim you as the wiki for the binding contains an error. For String items, the <command> should not be part of the item definition. Thanks for "pointing" this out, as I need to add an additional check in the code to prevent this situation

String remote1 "IrTrans remote1" { tcp=">[blablaix:21000:'MAP(iremote.map)']"}

should be better

Regards
K

On 13 Nov 2013, at 09:03, Tom <taeo...@gmail.com> wrote:

Tom

unread,
Nov 13, 2013, 2:18:42 PM11/13/13
to ope...@googlegroups.com
Karel,

YESSSSS! This way it works. Thanks a lot for your precious help!

BTW: I am using a "System started" rule to send the initializer (plus some dummy command to avoid cr/lf issues). Of course, this won't work on reconnects ... but well, I am still in exploration phase.

Kind regards,
Tom

Karel Goderis

unread,
Nov 14, 2013, 4:40:34 AM11/14/13
to ope...@googlegroups.com
OK - hope to push binding "as is" shortly - still spending too much time in ETS4 to get my KNX system up and running

K

Reply all
Reply to author
Forward
0 new messages