Sony TV Network Remote Control Plugin

Questions and comments specific to a particular plugin should go here.
3000
Posts: 37
Joined: Fri Aug 07, 2015 3:49 pm

Re: Sony TV Network Remote Control Plugin

Post by 3000 » Fri May 19, 2017 4:17 pm

yes, that's your plugin. I never found the Pre-Shared Key Settings. Using "Wake Up" turns my TV on. Awesome :) Already added it to EventGhost Autostart along with Kodi!

I did encounter an issue: Turning off isn't working. That used to work before, so I guess it's a minor issue. I will try a few things first. Otherwise I'll post the log.

So a huge "Thank you" to you Kevin and Blaher. :)
sign my petition to save a 28-year-old young mother who is fighting Stage 4 cancer: https://www.change.org/p/help-cancer-pa ... on-the-nhs

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sony TV Network Remote Control Plugin

Post by kgschlosser » Fri May 19, 2017 4:43 pm

log file is only useful is there is a traceback error. otherwise i really do not need it. Now the power off is not working? I will check into that. i didn't change any of the sent data. but maybe i accidentally deleted something
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sony TV Network Remote Control Plugin

Post by kgschlosser » Fri May 19, 2017 6:04 pm

ok so this is what I am going to do with this plugin


I am going to use low level networking to control the TV instead of the REST API.

This is going to allow for the usual remote control stuff. Plus all of the following

discrete on and off (actual seperate controls instead of a toggle) for the following
Power
Audio Mute
Picture Mute
Picture in Picture

You will also be able to specify directly. so if your TV is at volume 10 and you want to go to 50. you can set it directly to 50 without having to hold a button
Volume
channel
3 digit channel
TV source input
inputs

You will receive events for the following. as an example. if you walk over to the TV and press the volume up.. eventghost will trigger an event for the new volume
Power
Volume
PIP
Channel Change
Audio Mute
Picture Mute
Input

You will also be able to get the status for
Power
Volume
Audio Mute
Picture Mute
Channel
Triple Channel
TV Source
Inputs
PIP
TV MAC Address
TV IP Address
If you like the work I have been doing then feel free to Image

3000
Posts: 37
Joined: Fri Aug 07, 2015 3:49 pm

Re: Sony TV Network Remote Control Plugin

Post by 3000 » Sat May 20, 2017 4:54 pm

Awesome! Would it be also possible to make an action for changing to a certain "Scene Select"? That’s a menu where you can select certain picture settings depending on the content. Like "General" and "Game Mode" (“Cinema”, “Music”, “Animation”, “Photo”, “Graphics”, etc. …)?
Not to be confused with “Picture Mode”. It’s similar, but in “Picture Mode” not all options are always available. It depends on the selected scene. It is already possible to set a certain “Scene“ depending on the input. Say, I connect a PS4 to HDMI3. I can already set it to "Game Mode". But I only use one HDMI Input for my HTPC. So that's not very useful to me.

It would come in extremely handy. I could assign “Game Mode” whenever I start a game on my HTPC. Or “Cinema” when I play a Blu-Ray. Use “General” for regular TV.

Not sure if it’s possible, there is no button for that on the remote. Then again, not everything that is available in this awesome plugin is on my Sony remote control. So the plugin offers much more than I get on my remote.

Right now to change to a different "Scene" I always have to do these steps:

1. Press "Options"
2. Press “confirm” to “Scene Select” (luckily it's the first item to select)
3. Move up/down a few times depending on the desired “Scene”.
4. Press “confirm” to clear the “Scene Select”-Menu.

I needed to at least ask for it. After all, till yesterday it wasn't possible to turn on the TV either. Yet here we are :)
sign my petition to save a 28-year-old young mother who is fighting Stage 4 cancer: https://www.change.org/p/help-cancer-pa ... on-the-nhs

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sony TV Network Remote Control Plugin

Post by kgschlosser » Sat May 20, 2017 6:29 pm

here is a list of the Remote codes that I have

Code: Select all

Power Off
Volume Up
Volume Down
Mute
Channel Up
Channel Down
Guide
Jump
Input
AppliCast
Social
Internet Widgets
Internet Video
Photo Frame
TV Radio
Media
Netflix
Home
Return
Confirm
Up
Down
Right
Left
Enter
Exit
Forward
Play
Rewind
Prev
Stop
Next
Rec
Pause
Eject
TV Pause
Delete Video
Scene Select
Num 1
Num 2
Num 3
Num 4
Num 5
Num 6
Num 7
Num 8
Num 9
Num 0
Num 11
Num 12
Key Pad
Display
Mode 3D
Football Mode
Wide
Pic Off
Audio
Digital
Analog
Analog2
Analog?
Theater
Red
Green
Yellow
Blue
Teletext
SubTitle
Closed Caption
Options
Sync Menu
Top Menu
PopUp Menu
iManual
One Touch Time Rec
One Touch View
One Touch Rec
One Touch Stop
Favorites
MyEPG
Program Description
Write Chapter
TrackID
acTVila
Rakuraku Start
Flash Plus
Flash Minus
CS
BS
*AD
DUX
DOT
EPG
SEN
PAP
Ten Key
BS/CS
Ddata
and here is a list of the actions that you will be able to do.

Code: Select all

SetPower
GetPower
SetAudioVolume
GetAudioVolume
SetAudioMute
GetAudioMute
SetChannel
GetChannel
SetTripletChannel
GetTripletChannel
SetInputSource
GetInputSource
SetInput
GetInput
SetPictureMute
GetPictureMute
TogglePictureMute
SetPip
GetPip
TogglePip
TogglePipPosition
GetBroadcastAddress
GetMacAddress
and there is a button for the remote for Scene Select
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sony TV Network Remote Control Plugin

Post by kgschlosser » Wed May 24, 2017 5:08 am

OK i wanted to give an update. I ditched trying to use the low level interface as gen 3 Sony TV's do not support this way of communication.

So I am working on using the SideView API to leverage the TV into doing what I want it to. at the moment I only have access to a gen 3 TV via @3000 testing for me. the testing process is a bit slow due to a large time difference. if someone is in the US and is willingto help beta test this that would be a huge help.


But this is what the plugin is going to do. It is going to automatically discover the TV. if there is only 1 TV discovered and a pin code has not been set it will automatically start the registration process. the only thing you will have to do is enter the pin that shows up on the TV into the plugin config. The plugin is also going to automatically obtain the TV's mac address this will be what is used to turn the TV on (or wake it up) via a Wake On LAN packet or a "Magic Packet". so that is all automatic as well. the client ID will be automatically generated by using a combination of the FQDN of the computer that is running EG along with the MAC address of the network adapter on that computer. This adds just a smidge of extra security so unless they have your pin mac address and FQDN they will not be able to successfully obtain a cookie to be able to communicate with the TV. the nickname or user friendly name that will be associated to EG will be the computer FQDN.

features:

all the usual remote control buttons. the list of buttons is obtained from the TV it's self. so there is not going to be any non functional remote buttons due to TV incompatibility. It will only show the butts that TV can use.

direct input of volume so you will be able to specify the volume number and it will jump to that volume.

multiple device volume. this is an interesting thing. because with things like HDMI-CEC you have the ability to set the output of the TV to the AVR as well as be able to control the volume of that device. So you will be able to pick which audio device you want to control the volume bits for and away we go.

min volume/max volume of the volume device being controlled. you cannot set this but you can use this to know what the volume range is

thing you can "get":

mute
power
channel
volume
source
media that is currently playing including the length of the movie and the location it is being played from
list of supported remote control buttons
content list of a device. (if you have a usb thumb drive plugged in and it has a bunch of movies on it this will give you the list of all of the movies on it, also works for dlna)
list of all of the sources available. since the source list is dynamic depending on what is and is not plugged in this could be handy


things you can set
direct input of a channel. just pass the channel and it will do all the work for you.
direct input of the volume
mute (not toggling)
power (not toggling)
source
playing a specific piece of content (movie)

almost all of these things are already hammered out. as i discover more of the API the more I am going to add. as there is no documentation on the API for this.

But i have just got the discovery working and as soon as @3000 runs the latest test i will have the output for that and I am hoping that is really going to open the doors up on this. But this API is not just used on Sony TV's either, it is used on almost any network attached Sony device. so this is not going to be a specific plugin for just TV's. it's going to be a control all network attached Sony devices so that is a really nice thing. that bit of it is going to be a little later on down the road. as the devices have different control url's and I will have to account for that. as well as possibly any little API changes between the various device types. So as more beta testers become available I will be able to add onto this.

The more people willing to test the faster I can get it done. and the broader list of devices i can state it supports as well as the various generations.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sony TV Network Remote Control Plugin

Post by kgschlosser » Wed May 24, 2017 5:09 am

Oh yeah. I am also going to add a generate events option that will poll the device and look for changes. and if there is any it will produce events for the changes.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sony TV Network Remote Control Plugin

Post by kgschlosser » Wed May 24, 2017 5:13 am

I think i will also give the user the option to key the plugin to a specific device and they can multiload it if they have more then one device to control or it can control all the registered devices with the plugin only being loaded once.
If you like the work I have been doing then feel free to Image

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

Re: Sony TV Network Remote Control Plugin

Post by blaher » Fri May 26, 2017 4:43 am

kgschlosser wrote:OK so i did a little modification to the code. this is backwards compatible (well... it should be...).
Unfortunately, it doesn't work:

14:39:08 TvPower
14:39:08 Sony TV Network Remote Plugin: TvPower
14:39:08 Error in Action: "Sony TV Network Remote Plugin: TvPower"
14:39:08 Traceback (most recent call last) (0.5.0-rc2):
14:39:08 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
14:39:08 return self(*args)
14:39:08 File "C:\ProgramData\EventGhost\plugins\SonyNetworkRemote\__init__.py", line 180, in __call__
14:39:08 self.plugin.SendCommand(self.value)
14:39:08 TypeError: object() takes no parameters
14:39:17 WakeUp
14:39:17 Sony TV Network Remote Plugin: WakeUp
14:39:17 Error in Action: "Sony TV Network Remote Plugin: WakeUp"
14:39:17 Traceback (most recent call last) (0.5.0-rc2):
14:39:17 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
14:39:17 return self(*args)
14:39:17 File "C:\ProgramData\EventGhost\plugins\SonyNetworkRemote\__init__.py", line 180, in __call__
14:39:17 self.plugin.SendCommand(self.value)
14:39:17 TypeError: object() takes no parameters
14:39:49 PowerOff
14:39:49 Sony TV Network Remote Plugin: PowerOff
14:39:49 Error in Action: "Sony TV Network Remote Plugin: PowerOff"
14:39:49 Traceback (most recent call last) (0.5.0-rc2):
14:39:49 File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
14:39:49 return self(*args)
14:39:49 File "C:\ProgramData\EventGhost\plugins\SonyNetworkRemote\__init__.py", line 180, in __call__
14:39:49 self.plugin.SendCommand(self.value)
14:39:49 TypeError: object() takes no parameters

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sony TV Network Remote Control Plugin

Post by kgschlosser » Sat May 27, 2017 2:14 pm

I am not going to put any work into that modified version. 3000 and I have been writing a new plugin all together which supports automatic WOL for the power on (no need to enter the mac address) we will hopefully have automatic discovery of the device working as well this is giving me a hard hour so we will see.

I am going to have to leverage upnp AVTransport:1 to get content lists and now playing information. the really cool thing with how this works is that depending on what source you are on is going to make the list of compatible remote commands change. because the actual remote commands are gotten from the TV and are not preset into the plugin. this makes for a very dynamic plugin for future Sony TV's. But the really cool thing is the plugin I am working on is not going to be limited to just TV's. it's going to cover all Sony generation 3 devices. Cameras, AVR's TV's Blu Ray's.
If you like the work I have been doing then feel free to Image

Talguy
Posts: 25
Joined: Wed Mar 12, 2014 3:07 am

Re: Sony TV Network Remote Control Plugin

Post by Talguy » Tue Jun 06, 2017 12:01 pm

I have a 2015 Sony XBRx830c that I can use to help testing. I'm also based on the east coast of the US. I do have one request. I would like a feed back / status signal if the TV is displaying the Android desktop or any Android app. This is needed so that I can auto change my AV receiver from HDMI input to Optical input since my AV receiver doesn't support HDMI ARC. The optical will be needed to get 5.1 sound from the Netflix or Amazon Prime apps.

Thanks and let me know if you need some testing. Also, I'm in the processing of moving over the next two weeks so time will be limited in testing.

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sony TV Network Remote Control Plugin

Post by kgschlosser » Tue Jun 06, 2017 12:40 pm

Well I will give you a status update on this. I have almost all of the back end coded up. I am in the process of adding the GUI bits. I could use another beta tester to really explore the API. There is no documentation on the API so it's a trial and error thing. I do have a mechanism in place to auto discover the TV it works and gets responses from every upnp device on a network except from the TV now I want to know if this is an issue with the TV specifically or the API so another tester would be awesome. I do need to also check things like TV stations. I need someone that can simply screw in an antenna and get some channels. I also know with the Advent of HDMI-CEC it really changes how a TV functions. I need to know if with a cable box hooked up and the CEC set up and being used if the reported channel of the cable box will get spit out from the TV API as well. There is a lot I do not know about. I do know I can leverage upnp for the av data for things like playing movies. Or available content lists when using the DLNA stuff of the TV. This should also cover plugging in a flash drive into the USB and playing a movie as well. Tho I am not 100 % sure. But I do know that the USB does not show up as a source input.

The best way to help with this is you will need to set up an account on Github. If you already have one then great. But I will need the email address that was used to sign up. You can pm that to me. We do not want you to get excessive spamming so don't post it in. The open forum. I will send you an invitation from a chat program from there. And we can swap files back and forth
If you like the work I have been doing then feel free to Image

Talguy
Posts: 25
Joined: Wed Mar 12, 2014 3:07 am

Re: Sony TV Network Remote Control Plugin

Post by Talguy » Tue Jun 06, 2017 4:54 pm

@kgschlosser, sounds good. I'm already using the old 0.2 version of this plugin and can confirm it can turn my TV on and off using the builtin macro commands. I do not have a Github account but I'll try to set one up when we get closer to test time.

User avatar
kgschlosser
Site Admin
Posts: 3105
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sony TV Network Remote Control Plugin

Post by kgschlosser » Tue Jun 06, 2017 9:24 pm

we are at test time. i already have alot of the plugin built. i need to get more insight into the API on this.
If you like the work I have been doing then feel free to Image

Talguy
Posts: 25
Joined: Wed Mar 12, 2014 3:07 am

Re: Sony TV Network Remote Control Plugin

Post by Talguy » Wed Jun 07, 2017 7:22 pm

ok post up a plugin and I'll test it. FYI, I am not running the new 0.5 Beta versions of EventGhost. Still on the last version that Pako posted up.

Post Reply