Sony TV Network Remote Control Plugin

Questions and comments specific to a particular plugin should go here.
philg
Posts: 4
Joined: Wed Apr 15, 2009 1:32 am

Re: Sony TV Network Remote Control Plugin

Post by philg » Sat Jun 29, 2019 9:29 am

OK I have the home cinema 7.2 amp, not a TV but I guess that's not important. I might have a look myself but I do have the ability to offer you a VPN (it wont be particularly quick cross Atlantic though) but I will try to have a dig around myself with those UPNP tools etc and see what I can do. Im pretty sure those errors are going to be something generic/silly - surly everyone is getting them?

I notice there is a homebridge plugin and as I'm slowly moving in that direction - maybe I will see if that works. Ive actually got to the point where there are some annoying things with this new amp, so much so that I may return it as not fit for purpose - we shall see.

Thanks for the reply!
Regards,
Phil

blaher
Experienced User
Posts: 494
Joined: Thu Nov 17, 2011 1:27 am

Re: Sony TV Network Remote Control Plugin

Post by blaher » Wed Jul 03, 2019 6:09 am

I use this one viewtopic.php?f=9&t=6067#p39251

with .5 rc4 and it works well...might be worth a go.

dobbelina
Posts: 10
Joined: Sat Feb 23, 2013 11:36 pm

Re: Sony TV Network Remote Control Plugin

Post by dobbelina » Fri Dec 04, 2020 12:06 am

I have an older 2011 model,(KDL-46EX723 Generation 1 device) that doesn't have any pin code, so the eventghost plugin doesn't work for me.
However there's a workaround.
There is a nifty little utility called DLNALib.exe(229 KB) that is custom made for communicating with your Sony TV.
It can be downloaded from here:https://github.com/KHerron/SonyAPILib/t ... /bin/Debug

Download these 3 files and put in a folder of your choice:(Example C:\Sony)
  • DLNALib.exe
  • SonyAPILib.dll
  • Newtonsoft.Json.dll
Then add C:\Sony to your environment variables on Windows, or drop the three above files in the system32 folder.

First we need to create a device file, that is the utility will pull an xml file from the TV.
Locate the IP adress of your TV and run the command below, (Substitute with your own IP) from the command prompt, (/b switch)

Code: Select all

DLNALib.exe /b http://192.168.0.100:52323/DMR.xml C:\Sony
If you for some reason have another portnumber or url, you can run the utility with it's Device Locator function, (/l switch):

Code: Select all

DLNALib.exe /l
In my case it created a file called KDL-46EX723.xml in the C:\Sony folder that can be renamed to anything, ex, myDevice.xml
Now we can register the device, (your computer) to the TV with the command below, (/r switch)

Code: Select all

DLNALib.exe /r C:\Sony\myDevice.xml /log
Be Prepared to react at the Device or enter a PIN code, If device is Gen3, console will prompt for PIN.
Cookie data will be saved to the C:\ProgramData\Sony folder.
That's it!
The above process only needs to be done once.
Now we can start firing off remote buttons that can be added to eventghosts Windows command action, (/a switch)
(Example Volume down)

Code: Select all

DLNALib.exe /a C:\Sony\myDevice.xml IRCC XSendIRCC AAAAAQAAAAEAAAATAw==
You can find more button codes here: https://github.com/KHerron/SonyAPILib/w ... mmand-List
DLNALib documentation: https://github.com/KHerron/SonyAPILib/w ... ib-example
SonyAPILib Wiki: https://github.com/KHerron/SonyAPILib/wiki

Second option is:

Download and use curl.exe,(only one exe, same install procedure as DLNALib.exe)
No need to register the device if it's generation 1.
Command below:

Code: Select all

curl -d @"C:\Sony\VolumeDown.xml" -c cookies -b cookies http://192.168.0.100:80/IRCC
Here is the command itself (VolumeDown.xml)

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope
    xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
    s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <s:Body>
    <u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1">
      <IRCCCode>AAAAAQAAAAEAAAATAw==</IRCCCode>
    </u:X_SendIRCC>
  </s:Body>
</s:Envelope>
Third option is:

With batch files & curl, (generation 3): https://github.com/mdrichardson/tv-control
Cheers! :mrgreen:

dobbelina
Posts: 10
Joined: Sat Feb 23, 2013 11:36 pm

Re: Sony TV Network Remote Control Plugin

Post by dobbelina » Sat Dec 05, 2020 10:51 am

I managed to get the plugin working for my generation 1 TV from 2011, (Plugin v.0.0.4)
All i did was edit line 123 in __init__.py from:

Code: Select all

conn=urllib2.Request('http://' + globalIp + '/sony/IRCC', globalSOAPStrings.contentStart + commandString + globalSOAPStrings.contentEnd, globalSOAPStrings.headers)
To:

Code: Select all

conn=urllib2.Request('http://' + globalIp + '/IRCC', globalSOAPStrings.contentStart + commandString + globalSOAPStrings.contentEnd, globalSOAPStrings.headers)
And after some network sniffing of DLNALib.exe i also changed line 142
from:

Code: Select all

'X-Auth-psk': globalPreSharedKey,
To:

Code: Select all

'X-CERS-DEVICE-ID': 'TVSideView:94-C6-92-1D-7C-45',
Above is mac number of computer.
Great fun! :)

Post Reply