Item response through TCP/UDP binding

Hello everyone.

Since there is no binding yet for StormAudio preamps, I have decided to go down the TCP route and managed to achieve sending commands to the receiver settting up items that activate rules.
What I am not able to achieve is visualising the response/log from the receiver in openHab.
An example is sending the command ssp.vol I should be able to see the volume value, but I am not able to.
To send the commands I have done the following:

  1. Connected the Thing StormAudio via the TCP/UDP binding
  2. Created the channels Command and Response
  3. Created items Command and Response, which I then linked to their respective channels
  4. Created a Switch item named Volume
  5. Created a Rule that on the change of the Volume Item to ON it would send to the receiver the command through the Command Item “ssp.vol.up” to increase the volume by 1 dB
  6. Created another Rule that on the change of the Volume Item to ON it would send to the receiver the command through the Command Item “ssp.vol” to receive back the volume value. This is the script I used:

rule “Receive StromAudio Response”
when
Item StromAudio_Response received
then
logInfo(“Received response: {}”, received)
updateSomeItemState(received)
end

The Response item keeps on reading NULL. The Volume up works as well as other commands such as Volume down, Switch on and off.

I am sure I am missing a way to link somehow the response channel to the Stormaudio. Any ideas and suggestions how to do what I am trying to do?

Thank you all in advance for the help.

This script has all sorts of errors. I’m surprised it doesn’t throw errors into the log.

something like this would be proper syntax:

note when posting code please use code fences.

```
code goes here
```
rule “Receive StromAudio Response”
when
    Item StromAudio_Response changed
then
    logInfo(“Received response: {}”, newState)
    
    Volume.sendCommand(INCREASE)
end

I know nothing of the TCP binding but it’s unusual to have two different items, one for commands and another for updates. Usually the same channel and Item handles both.

Thanks for your feedback. I have tried logging the command item, but I only get the command that was sent not the reply back from the receiver.

:man_shrugging: There isn’t nearly enough here to help.

What version of OH and how was it installed?

The Thing configuration (use code fences)?

Items configuration?

Relevant rules?

Relevant logs?

Thanks for persisting on this. I am on OH 4.2.2 and the thing is set-up using the TCP/UDP binding through the UI inerface to which I have attached the channel “StormAudio Command”, which generates the folowing code

UID: tcpudp:client:StormAudio
label: TCP/UDP Client
thingTypeUID: tcpudp:client
configuration:
  protocol: TCP
  delay: 0
  port: 23
  host: 192.168.2.30
  refresh: 30
  timeout: 3000
  bufferSize: 2048
location: Home Theater
channels:
  - id: command
    channelTypeUID: tcpudp:string
    label: StormAudio Command
    description: ""
    configuration: {}

After which I created an Item also called “StromAudio Command”

label: StormAudio Command
type: String
category: ""
groupNames: []
tags: []

This has been attached to the channel and by sending the appropriate commands I am able to operate the receiver. In order to get any status of the receiver, you first need to send a command such as “ssp.power” for the power status to which the receiver will forward a reply. I am not able to capture the reply. Connecting with something like Putty I can see the reply.

In the logs I do not see anything that pertains the answer from the receiver, only the commands, which may be due to how the binding operates. Maybe using the http binding, but then how one is suppose to set it up?

Happy New Year.

Ok, in that case yes, it’s while dependent on how the binding works.

The TCP binding is not one of the official bindings so you’ll have to read the docs from where you got the binding from for details. Typically a binding handles commands and responses in the same Channel, but TCP is about as low level as it gets so it might not support that.

If the end device is HTTP definitely that would be a better approach. I don’t know specifically what you don’t know about setting the Things up for the HTTP binding so I can’t give any specific answers. At a high level you need to know what URLs the device supports and what type of HTTP requests it uses (GET, POST, PUT, etc) and what days to send and receive. From there is just a matter of filling out the form when adding channels to the Thing. The full docs are at HTTP - Bindings | openHAB

Thanks for the help. When I get time I will try.