Edit: It is working now: the trick was the postamble in tcp.cfg
I have the problem that tcp item seems to be working but on the client side (hyperion) I do not see any reaction, so there must be something wrong with the command thats send out:
String hyperionDevice "Ambilight Device" <television> {tcp=">[*:192.168.108.55:19444:default]"}
Color hyperion_color "Ambilight Color" <television> (gWohnzimmer)
The rule seems to work and the command gets send:
import java.awt.Color
import org.openhab.core.library.types.*
var HSBType hsbValue
var int redValue
var int greenValue
var int blueValue
var String RGBvalues
rule "Set RGB value"
when
Item hyperion_color received command
then
val command = receivedCommand
if (command instanceof HSBType) {
var hsbValue = hyperion_color.state as HSBType
redValue = hsbValue.red.intValue
greenValue = hsbValue.green.intValue
blueValue = hsbValue.blue.intValue
logInfo("hyperion", "Hyperion red: {}", redValue.toString)
logInfo("hyperion", "Hyperion green: {}", greenValue.toString)
logInfo("hyperion", "Hyperion blue: {}", blueValue.toString)
var String json = '{"color":[' + redValue.toString + ',' + greenValue.toString + ',' + blueValue.toString + '],"command":"color","priority":100}'
logInfo("hyperion", "Hyperion JSON: {}", json)
hyperionDevice.sendCommand(json)
}
end
I played with some settings here - that made the binding itself working:
# all parameters can be applied to both the TCP and UDP binding unless
# specified otherwise
# Port to listen for incoming connections
#port=25001
# Cron-like string to reconnect remote ends, e.g for unstable connection or remote ends
#reconnectcron=0 0 0 * * ?
# Interval between reconnection attempts when recovering from a communication error,
# in seconds
#retryinterval=5
# Queue data whilst recovering from a connection problem (TCP only)
# queue=true
# Maximum buffer size whilst reading incoming data
#buffersize=1024
# Share connections within the Item binding configurations
#itemsharedconnections=true
# Share connections between Item binding configurations
#bindingsharedconnections=true
# Share connections between inbound and outbound connections
#directionssharedconnections=false
# Allow masks in ip:port addressing, e.g. 192.168.0.1:* etc
#addressmask=true
# Pre-amble that will be put in front of data being sent
#preamble=
# Post-amble that will be appended to data being sent
#postamble=\r\n
postamble=\n
# Perform all write/read (send/receive) operations in a blocking mode, e.g. the binding
# will wait for a reply from the remote end after data has been sent
#blocking=false
# timeout, in milliseconds, to wait for a reply when initiating a blocking write/read
# operation
#timeout=3000
# Update the status of Items using the response received from the remote end (if the
# remote end sends replies to commands)
#updatewithresponse=true
#updatewithresponse=true
# Timeout - or 'refresh interval', in milliseconds, of the worker thread
#refreshinterval=250
# Timeout, in milliseconds, to wait when "Selecting" IO channels ready for communication
#selecttimeout=1000
# Used character set
#charset=ASCII
Sending on command line works:
echo '{"command" : "color", "priority" : 100, "color" : [255,0,0]}' | nc 192.168.108.55 19444
on tcpdump I on the client side I see the command with very small difference
but I cannot get it working correct
from command line:
'7 f(nEi@@Jll74KL
kh6aTq{"command":"color","priority":100,"color":[255,0,0]}
from the item:
'7'~NEj@@U,l6l7KW'yg
`^{"color":[95,34,97],"command":"color","priority":100}