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:
Connected the Thing StormAudio via the TCP/UDP binding
Created the channels Command and Response
Created items Command and Response, which I then linked to their respective channels
Created a Switch item named Volume
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
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?
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 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
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?
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