TCP help!

Hey Guys,

i have been going though forum trying to figure out where i have gone wrong.

i am running up to date openhabian on raspberrypi3

instilled TCP/UDP binding (binding-tcp1 1.12.0) via paper ui (how ever does not show up in configuration/bindings)

have followed this this page but still can not get it working.

tcp.items

Switch Matrix “Matrix” {tcp=“>[ON:XXX.XXX.XXX.5:8000:‘PON’], >[OFF:XXX.XXX.XXX.5:8000:‘POFF’]”}

not sure what else i need to do to get this working. i can see it in the rest api but is not linked to anything so unusable.

im not sure how to change the logs to DEBUG in openhabian. log in to openhab via putty type in log:tail and i get this

-bash: log:tail: command not found

Have you created a tcp.cfg file and placed it in the SERVICES folder?

TCP is 1.X binding and not completely configurable via PaperUI.

Squid

wow that was a quick replay!!

yes i have that file in that folder but every line of text is commented out

I don;t know if this has anything to do with it, but you have smart quotes on the PON and POFF, it may just be from posting here in the forum. Try copying and pasting the line below…

By the way…are you trying to send PON and POFF strings? If so, this is not the correct way to do this.

Squid

Switch Matrix “Matrix” { tcp=">[ON:192.168.0.5:8000:'PON'],>[OFF:192.168.0.5:8000:'POFF']"}

Read the tcp binding docs about configuration and filling in the cfg file

yes that was a copy past problem

Yes this is the string that i am trying to send to the matrix to turn it on and off. i will make the map file and try again

yes i have read and reread at lest 25 times. but this time something clicked and i noticed there was 1 box that didnt have “NO” or “only on receive”
uncommitted the reconnectcron and bang a lot more in the logs for tcp. but still no way of sending on or off commands. will try map file

Yes, you will need to use a map file and make sure you install the MAP transformation service as well.

Here’s how I do it…

ITEM

Switch Ceiling_Fan "Ceiling Fan" [ "Switchable" ] {tcp=">[ON:xx.x.x.6:3040:'MAP(cfan.map)'],>[OFF:x.x.x.6:3040:'MAP(cfan.map)']"}

MAP

ON=VSW!1 96 1 6\r
OFF=VSW!1 96 2 6\r

The “/r” are to issue a carraige return after the values.

Squid

this is the log now after reboot. if that helps

2018-07-18 02:45:43.491 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘tcp.items’
2018-07-18 02:46:03.424 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The maximum buffer will be set to the default value of 1024
2018-07-18 02:46:03.426 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The interval to retry connection setups will be set to the default value of 5
2018-07-18 02:46:03.429 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The setting to queue write operation until a channel gets connected will be set to the default value of true
2018-07-18 02:46:03.431 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The port to listen for incoming connections will be set to the default value of 0
2018-07-18 02:46:03.433 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The setting to share channels within an Item will be set to the default value of true
2018-07-18 02:46:03.434 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The setting to share channels between the items with the same direction will be set to the default value of true
2018-07-18 02:46:03.436 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The setting to share channels between directions will be set to the default value of true
2018-07-18 02:46:03.438 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The setting to use address masks for incoming connections will be set to the default value of true
2018-07-18 02:46:03.440 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The refresh interval of the worker thread will be set to the default value of 250
2018-07-18 02:46:03.443 [INFO ] [ing.tcp.protocol.internal.TCPBinding] - The maximum time out for blocking write operations will be set to the default value of 3000
2018-07-18 02:46:03.444 [INFO ] [ing.tcp.protocol.internal.TCPBinding] - The blocking nature of read/write operations will be set to the default value of false
2018-07-18 02:46:03.446 [INFO ] [ing.tcp.protocol.internal.TCPBinding] - The preamble for all write operations will be set to the default value of “”
2018-07-18 02:46:03.448 [INFO ] [ing.tcp.protocol.internal.TCPBinding] - The postamble for all write operations will be set to the default value of “”
2018-07-18 02:46:03.451 [INFO ] [ing.tcp.protocol.internal.TCPBinding] - Updating states with returned values will be set to the default value of true
2018-07-18 02:46:03.453 [INFO ] [ing.tcp.protocol.internal.TCPBinding] - The characterset will be set to the default value of ASCII
2018-07-18 02:46:03.467 [INFO ] [b.core.service.AbstractActiveService] - TCP Refresh Service has been started
2018-07-18 02:46:03.474 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - Connecting the channel Channel [item=Matrix, command=ON, direction=OUT, remote=/192.168.0.5:8000, buffer=, isBlocking=false, sReconnecting=false, channel=, host=192.168.0.5, port=8000]
2018-07-18 02:46:03.730 [INFO ] [ing.tcp.AbstractSocketChannelBinding] - The channel for /192.168.0.5:8000 is now connected

still not showing up in paper or rest :frowning:

tcp.items

Switch Matrix “Matrix” [Matrix] { tcp=“>[ON:192.168.0.5:8000:‘MAP(blustream.map)’],>[OFF:192.168.0.5:8000:‘MAP(blustream.map)’]”}

blustream.map

ON=PON\r
OFF=POFF\r

oh and i also added the map transformation service as well. didnt realize i needed that

If you add to a simple sitemap does it work?

added a sitemap

blustream.sitemap

sitemap blustream label=“matrix” {
Switch item=Matrix icon=“Power”
}

makes for a log with lots of warnings though.

2018-07-18 03:16:21.242 [ome.event.ItemCommandEvent] - Item ‘Matrix’ received command ON
2018-07-18 03:16:21.357 [vent.ItemStateChangedEvent] - Matrix changed from OFF to ON
==> /var/log/openhab2/openhab.log <==
2018-07-18 03:16:21.841 [WARN ] [rm.AbstractFileTransformationService] - Could not transform ‘PON
[SUCCESS]Set system power ON, please wait a moment…’ with the file ‘blustream.map’ : Target value not found in map for ‘PON
[SUCCESS]Set system power ON, please wait a moment…’
2018-07-18 03:16:21.847 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input PON
[SUCCESS]Set system power ON, please wait a moment… to match command ON on item Matrix
2018-07-18 03:16:21.851 [WARN ] [rm.AbstractFileTransformationService] - Could not transform ‘PON
[SUCCESS]Set system power ON, please wait a moment…’ with the file ‘blustream.map’ : Target value not found in map for ‘PON
[SUCCESS]Set system power ON, please wait a moment…’
2018-07-18 03:16:21.853 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input PON
[SUCCESS]Set system power ON, please wait a moment… to match command OFF on item Matrix
2018-07-18 03:16:30.880 [WARN ] [rm.AbstractFileTransformationService] - Could not transform ’ Done
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for ’ Done
Matrix-8x8> ’
2018-07-18 03:16:30.885 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input Done
Matrix-8x8> to match command ON on item Matrix
2018-07-18 03:16:30.893 [WARN ] [rm.AbstractFileTransformationService] - Could not transform ’ Done
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for ’ Done
Matrix-8x8> ’
2018-07-18 03:16:30.897 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input Done
Matrix-8x8> to match command OFF on item Matrix
==> /var/log/openhab2/events.log <==
2018-07-18 03:18:04.991 [ome.event.ItemCommandEvent] - Item ‘Matrix’ received command OFF
2018-07-18 03:18:05.027 [vent.ItemStateChangedEvent] - Matrix changed from ON to OFF
==> /var/log/openhab2/openhab.log <==
2018-07-18 03:18:05.380 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'POFF
’ with the file ‘blustream.map’ : Target value not found in map for 'POFF

2018-07-18 03:18:05.384 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input POFF
to match command ON on item Matrix
2018-07-18 03:18:05.390 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'POFF
’ with the file ‘blustream.map’ : Target value not found in map for 'POFF

2018-07-18 03:18:05.395 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input POFF
to match command OFF on item Matrix
2018-07-18 03:18:07.157 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '[SUCCESS]Set system power OFF.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for '[SUCCESS]Set system power OFF.
Matrix-8x8> ’
2018-07-18 03:18:07.165 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input [SUCCESS]Set system power OFF.
Matrix-8x8> to match command ON on item Matrix
2018-07-18 03:18:07.173 [WARN ] [rm.AbstractFileTransformationService] - Could not transform '[SUCCESS]Set system power OFF.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for '[SUCCESS]Set system power OFF.
Matrix-8x8> ’
2018-07-18 03:18:07.181 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input [SUCCESS]Set system power OFF.
Matrix-8x8> to match command OFF on item Matrix

it shows and works in basicUI but nothing usable in rest

i think i need to make a things file??

will look at it in a few hrs.

thanks for the much needed help @KidSquid

No, no things file needed as it is a 1.x binding.

@hmerk how do i make it accessible from rest api without linking it to a thing with paper ui?

You defined an Item with the label “Matrix” which is accessable through REST API.

From what i have done so far with rest api i thought everything needed a LinkedItems. Didnt even click to me to just try its name. Doooo

Thank you

thanks for the help guys. need more help though.

hope you can help with the below.

getting a lot of

cannot parse input

and

could not transform

in the logs.

i no its from the reply from the matrix

OUT01FR01\r
\r
[SUCCESS]Set output 01 connect from input 01.\r
\r
Matrix-8x8> ’

i tried doing a rules file but i dont understand how it works and the logs don’t show the rule doing anything.

.item

Switch MatrixPower “power” { tcp=“>[ON:192.168.0.5:8000:‘MAP(blustream.map)’],>[OFF:192.168.0.5:8000:‘MAP(blustream.map)’]”, autoupdate=“false”}
String MatrixOut01 “out01” { tcp=“>[11:192.168.0.5:8000:‘MAP(blustream.map)’],>[12:192.168.0.5:8000:‘MAP(blustream.map)’],>[13:192.168.0.5:8000:‘MAP(blustream.map)’],>[14:192.168.0.5:8000:‘MAP(blustream.map)’],>[15:192.168.0.5:8000:‘MAP(blustream.map)’],>[16:192.168.0.5:8000:‘MAP(blustream.map)’],>[17:192.168.0.5:8000:‘MAP(blustream.map)’],>[18:192.168.0.5:8000:‘MAP(blustream.map)’]”, autoupdate=“false”}
String MatrixReply “matrix reply [%s]” { tcp=“>[192.168.0.5:8000:default]”, autoupdate=“false”}

.map

ON=PON\r
OFF=POFF\r
11=OUT01FR01\r
12=OUT01FR02\r
13=OUT01FR03\r
14=OUT01FR04\r
15=OUT01FR05\r
16=OUT01FR06\r
17=OUT01FR07\r
18=OUT01FR08\r

.sitemap

sitemap blustream label=“matrix” {
Switch item=MatrixPower label=“Power”
Switch item=MatrixOut01 label=“out01” mappings=[11=“media”, 12=“B”, 13=“C”, 14=“D”, 15=“E”, 16=“F”, 17=“G”, 18=“H”]
}

.rule

rule “query matrix”
when
Item MatrixRely received update
then
switch MatrixReply.state.toString {
case “OUT01FR01\r\r[SUCCESS]Set output 01 connect from input 01.\r\rMatrix-8x8> '”: MatrixOut01.postUpdate(11)
case “OUT01FR02\r\r[SUCCESS]Set output 01 connect from input 02.\r\rMatrix-8x8> '”: MatrixOut01.postUpdate(12)
}
end

==> /var/log/openhab2/events.log <==
2018-07-21 17:32:44.950 [ome.event.ItemCommandEvent] - Item ‘MatrixOut01’ received command 11
2018-07-21 17:32:44.969 [vent.ItemStateChangedEvent] - MatrixOut01 changed from to 11
==> /var/log/openhab2/openhab.log <==
2018-07-21 17:32:45.430 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’
2018-07-21 17:32:45.434 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> to match command OFF on item MatrixPower
2018-07-21 17:32:45.439 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’
2018-07-21 17:32:45.443 [WARN ] [ing.tcp.protocol.internal.TCPBinding] - Cannot parse input OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> to match command ON on item MatrixPower
2018-07-21 17:32:45.448 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’
2018-07-21 17:32:45.457 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’
2018-07-21 17:32:45.466 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’
==> /var/log/openhab2/events.log <==
2018-07-21 17:32:45.474 [vent.ItemStateChangedEvent] - MatrixOut01 changed from 11 to
2018-07-21 17:32:45.488 [vent.ItemStateChangedEvent] - MatrixOut01 changed from to OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8>
==> /var/log/openhab2/openhab.log <==
2018-07-21 17:32:45.487 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’
==> /var/log/openhab2/events.log <==
2018-07-21 17:32:45.504 [vent.ItemStateChangedEvent] - MatrixOut01 changed from OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> to
2018-07-21 17:32:45.510 [vent.ItemStateChangedEvent] - MatrixOut01 changed from to OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8>
2018-07-21 17:32:45.521 [vent.ItemStateChangedEvent] - MatrixOut01 changed from OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> to
==> /var/log/openhab2/openhab.log <==
2018-07-21 17:32:45.519 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’
2018-07-21 17:32:45.542 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’
2018-07-21 17:32:45.557 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’
2018-07-21 17:32:45.564 [WARN ] [rm.AbstractFileTransformationService] - Could not transform 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’ with the file ‘blustream.map’ : Target value not found in map for 'OUT01FR01
[SUCCESS]Set output 01 connect from input 01.
Matrix-8x8> ’