Hi all,
I’m currently trying to receive a simple tcp packet using the tcp/udp binding but as you might guess I’m experiencing some problems. My PLC sends out a tcp packet containing some text in the data section which I want to ‘pump’ in an OpenHAB string item.
my item is as follows:
String TcpServer “Tcp server receive: [%s]” {tcp=“<[192.168.1.16:*:‘REGEX((.))’]”}
when the PLC creates the connection and sends the data the connection is made as it should, yet the string item doesn’t get any content:
19:27:11.710 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - We will accept data coming from the remote end 192.168.1.16:*
19:27:13.529 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - Received connection request from /192.168.1.16:35900
19:27:13.529 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - 192.168.1.16:* is an allowed masked remote end. The channel will now be configured
19:27:14.045 [INFO ] [marthome.event.ItemStateChangedEvent] - TcpServer changed from NULL to null
To troubleshoot further I created a ‘debug’ rule:
rule “rule name”
when
Item TcpServer received update
then
logInfo(“TCP rule”, “content;” + TcpServer + “\n\n”)
end
Everytime the PLC sends data it get’s triggered which is good, the problem is that the state remains ‘null’:
19:29:52.493 [INFO ] [ipse.smarthome.model.script.TCP rule] - content;TcpServer (Type=StringItem, State=null, Label=Tcp server receive:, Category=null)
Wiresharking the session with the PLC I can find that the push packet looks as follows (data = ‘testing’):
My guess would be an issue with the conversion from bytes to string, yet I don’t really know how to troubleshoot this or even better resolve it.
Can anyone give any advice on how to resolve this?
Very much appreciated!