TCP Binding error for outgoing connection

,

Hi there,

I do have an Intercom which can be connected by TCP/UDP to openHAB.

In my case i want to cancel a call from the Intercom by sending an UDP String to the Intercom. Therefore I’ve implemented the following item:

String sIntercomAusgehend 	"Intercom Ausgehend [%s]"   {udp=">[192.168.178.80:8113:'REGEX((.*))']"}

When i send an command by a rule to the Intercom with “sIntercomAusgehend.sendCommand(“BSRCMDC0A8B25000r30001234DF”)” the item status is changing correctly but nothing happens with the Intercom.

2017-01-08 14:38:03.979 [ItemCommandEvent          ] - Item 'sIntercomAusgehend' received command BSRCMDC0A8B25000r30001234DF

What is weird to me is the following entry in the openhab.log File:

2017-01-08 14:25:35.488 [INFO ] [g.tcp.AbstractDatagramChannelBinding] - There is already an active channel sun.nio.ch.DatagramChannelImpl@a42f4d for the remote end /192.168.178.80:8113

What does this mean?

Being logged at INFO level, it’s obviously difficult to determine if this is something you should be concerned with.

I am wondering if the internal copy of your configuration is not in sync with what you’ve edited. openHAB 1.x cleared out the internal config on each restart, so lingering configuration was usually not a problem. At the openhab> prompt, enter

config:list

and look around your configuration to see if any obsolete information is contained there.

Here is some related advice concerning a different binding:

Thanks @watou but I’m running OH2, does it work there the same way?

The possible issue I’ve described is only in OH2. If you’ve changed your .cfg file over time and removed or commented out lines, the old values for those lines are still in the internal copy of the configuration, which can potentially lead to unexpected outcomes like yours.

The thing is in my tcp.cfg file there are no entries at all.

I did only configured the following TCP/UDP items for the Intercom:

String sIntercomEingehend 	"Intercom Eingehend [%s]"   {udp="<[192.168.178.80:*:'REGEX((.*))']"}
String sIntercomAusgehend 	"Intercom Ausgehend [%s]"   {udp=">[192.168.178.80:8113:'REGEX((.*))']"}

The wiki says:

There’s a bug in the binding that requires at least one udp configuration to be defined or the binding will not send UDP messages.

So it seems to apply to your situation.

I’ve added now one entry in the tcp.cfg:

# Port to listen for incoming connections
port=8112

When I use config:list at Karaf I get following output:

Pid:            org.openhab.tcp
BundleLocation: mvn:org.openhab.binding/org.openhab.binding.tcp/1.9.0-SNAPSHOT
Properties:
   addressmask = true
   blocking = false
   buffersize = 1024
   charset = ASCII
   directionssharedconnections = false
   itemsharedconnections = true
   port = 8112
   postamble = 
   queue = true
   refreshinterval = 250
   selecttimeout = 1000
   service.pid = org.openhab.tcp
   updatewithresponse = true
Pid:            org.openhab.udp
BundleLocation: mvn:org.openhab.binding/org.openhab.binding.tcp/1.9.0-SNAPSHOT
Properties:
   addressmask = true
   blocking = false
   buffersize = 1024
   charset = ASCII
   port = 8112
   postamble = 
   queue = true
   refreshinterval = 250
   selecttimeout = 1000
   service.pid = org.openhab.udp
   updatewithresponse = true

It seems to be one for TCP and one for UDP, is this okay or part of the problem?

I’m wondering where all those other config values came from, if your tcp.cfg has only ever had port=8112 in it. Maybe delete the config from the openhab> command line for the pid org.openhab.tcp, restart and try again?

I saw that i had one udp.cfg, which was empty and one tcp.cfg which had all values commented out by “#”.

Now I deleted the udp.cfg and set the port to 8112 in the tcp.cfg.

How can I delete PIDs manually from the Karaf console and restart OH?

Does

config:delete org.openhab.tcp

not work? You could help config to see the choices.