i’m looking for a solution to control my sony TV by openhab / Alexa
i think a good solution could be to use Sonys APIs / RestAPIs
Sony has a very good Documentation
there are multiple ways, and i have also some rules / scripts to start Apps on TV by using RestAPI
But i’m looking for a solution to press play / pause button and that s not possible by rest API.
One solution could be the Simple IP control protocol.
I’m able to send commands by netcat like
netcat [IP address] 20060
followed by
*SCPOWR0000000000000000
But i’m not able to use it as a 1 line command.
I have to connect first with the netcat command and than i can send the command to the TV.
Now i need to find a solution to build a rule - for example with exec - which sends the command by netcat.
Anyone has done this before or has a idea how i can do this?
Hi Wolfgang, thank you for your answer, but doesnt work.
I have tried yesterday everything with echo but nothing works.
It works now with Sony Binding and IRCC Remote Codes.
But maybe there is also a way to use netcat commands
That means you also tried without the -n switch?
I just had a look to the docs and I saw that LF is required at the end. LF is suppressed by using -n.
In case that does not work you e.g. could use a network sniffer to check the communication on the network or go for the REST API. The REST API also seems to have a command to turn on / off the TV. To use the REST API you either could use the http binding or e.g. curl oder wget in a script.
As you have not written anything about how exactly you used echo/netcat please allow me to ask if you are sure, that the command/script is whitelisted in case you use the exec binding.
Hi Wolfgang,
okay, some more details
1st i’m on a windows system, so echo -n does not work.
But i also tried with echo.*SCIRCC0000000000000084
Also i tried to work with timeout which does not work.
Ping works, but the echo command will be send after nc connection is closed.
The *SCPOWR0000000000000000 command was only a example.
I want to use play / pause function to pause youtube / netflix and every HDMI-CEC connected device by voice command with alexa
For Power on off of Sony TV i’m still using RestAPI and sending commands by curl - that works fine.
But RestAPI does not support play pause function.
Also i can open ands close apps on TV by RestAPI.
in case piping the data by using echo command does not work you could try to store the command in a file ( including the LF character ) and then use the type command to pipe the data into the nc command.
I think another option would be the Powershell.