Hi Everyone.
So, firstly a bit of background.
I am playing with improving the current SONY TV control.
Currently there is only one working control and that is the current VD, but there is a PLUGIN that doesn't work for the newer Android tv's
So after a lot of head scratching and googling i have figured that the Sony TV has a REST API that can be connected to with a HTTP request.
The Sony actually has three ways to control it IRCC (IR codes over IP), Serial and REST API. the current VD uses IRCC and cant go directly to say HDMI3 or an app you have installed.
This is where the REST API is far better. I have figured out the syntax for the HTTP call to get it work with the help of a program called POSTMAN and i can do all sorts of control.
End background.....
But here is where i am falling short, the trick with the HTTP string is in the header (it must be in the header AFAIK) it needs to have, at least:
Header
KEY = x-auth-psk
Value = 0000
KEY = host
Value = 192.168.1.12 (IP of the originating unit)
in the body you send (no quotes)
"{"method":"setPowerStatus","version":"1.0","id":1,"params":[{"status":true}]}"
That will turn the TV on.
So playing with a few other Virtual Drivers for other integration I somewhat understand the GET command.
(this is from the "control by web" web relay driver)
GET /state.xml?relay1State=1&noReply=1 HTTP/1.1 0x0D0x0A0x0D0x0A
So i understand the GET part of the statement, but then i run into the HTTP/1.1 part.
I cant find anything that explains the HTTP/1.1 and what it needs what options it has and how I need to use it.
For instance, why does it need a HEX string that says (no quotes) 'Carriage return 'newline' 'carriage return 'new line'
So can anyone point me at the correct learning section or help me out with a command that can integrate
x-auth-psk as the key and 000 as the value into the header of a HTTP request?
That command will just turn the TV on, but you can string them together.
Why? Imagine this: while sitting on you couch watching TV, your CCTV/IPC NVR closes one of its alarm contacts on say motion detection.
I would like to know that there is motion on my security cameras while i am at home......
So a scene could be run in combination with the Virtual Driver to:
Test if the TV power is on.
Test if the PLEX or NETFLICK app is running
Record current state
Pause current state ( ie pause video or movie)
Change the input to HDMI3 (to view the cameras directly from the NVR output.)
wait till alarm is cleared (lets say motion)
return to Plex or netflicks
All of that would very VERY hard to do with IR codes.
Fodder.