[Release] Sony Bravia TV Rest Control

I am probably going to poll only things that change like volume input and power. Things like the Mac and serial and stuff only when the save button is hit.
Also going to add a few other settings like speaker output, powersave, to the states.

1 Like

posted an update to the github on the first post. Main changes are listed below.

New Features
added some of the channel/input info as an attribute.
added the ability to see if sound is going through the TV speakers or out through HDMI
added attribute to check is WakeOnLan or PowerSave is enabled

Optimizations
Info like mac addresses, tv serial, and powersave settings will only check every 30 minutes or when save button is clicked on driver.

Updated debug logging to display certain rows as info to make them more distinct.

Bugfixes
Added a parse for the response from the SOAP call that sends button commands, this is just to prevent a groovy error that showed up when you send a button command.

Polling will only check the powerstatus when the TV is off. An error was being thrown when the volume level was getting checked when the TV is off.

I was sending volume change to TV speakers only. Now the command SHOULD update whatever the speaker output is.

1 Like

Surely that any needs to check on the save, as them values never change unless the IP is changed to which he could have changed the TV?

Hi @ajones,
Thank you very much for this driver!!!

I'm living in The Netherlands, so I've got some Dutch apps on my tv which I would like to add to my personal App Menu. I have to add that my programming knowledge is non-existent...

I have downloaded the displaycontrol.html and I have discovered the Knowledge Center. getApplicationList (v1.0) | BRAVIA Professional Displays Knowledge Center

However, I cannot produce a list of Apps on my television... Could you please point me in the right direction?

Thank you in advance.

Hi @ajones,

Super nice driver you've done, thanks! I have a question... is there a way to know if the TV is on/off in rule machine?

Hi Yes, you can query your TV directly and update a few lines of code. Steps to find the app URL on your TV is below.

  1. Turn refresh interval to 30 minutes and enable debug logging.
  2. Enter below two strings into senddebugstring button
    libpath= /sony/appControl
    jsonmsg= {"method": "getApplicationList","id": 60,"params": [],"version": "1.0"}
  3. Open log and filter by your TV device.
  4. There will be an Info log with a response saying "raw data result is" followed by a list of apps.
  5. In the string, there will be a field below for each app you have. You are interested in the URI for the app.
    [title:YouTube, uri:*com.sony.dtv.com.google.android.youtube.tv.com.google.android.apps.youtube.tv.activity.ShellActivity*
  6. Take the URI for the app you want to add it to line 584 of the code in the same format as the lines above it.
  7. Then replace any appname in line 33-45 with the name you added next to the URI. There is a Hubitat limit to the number of dropdowns on this button, so that's why I have a limited app list here.
  8. Remember to change your refresh back to whatever it was before. This step is just so your logs don't get spammed each minute with messages you don't need.

SendDebugString

Yes, it reports a state change just like any zwave outlet you would buy. You just check switch for on/off. I have mine checking every minute.

Yeah thats the thought. I do have powersave status, volume output device and wakeonlan status in here, and that could all be changed through the TV settings with no update, so figured I better check at least every 30 minutes.

Just posted a bugfix. Refresh wasnt updating the inputs or volume since I added a condition to only check if TV is on. i was checking for "On" instead of "on". Next update, ill get this into HPM.

1 Like

Hey Alex,

Thoughts on this warning? My wife was searching Netflix for something to watch at the time

Thanks, Rick

Hey Alex

I am not able to get YouTubeTV added to my list when I add the above 2 lines on 584 and 585

I updated line 40

When I save I get

Yeah, I am not a coder :wink:

edit: i may have gotten it to work :slight_smile:

I think when your updating, your not updating all the code. Like your driver is still called Beta. I changed the name when I posted this to the master for the first post. I would delete everything and reimport. So in your screenshots, your line 584 is different than the GitHub version.
Edit: I reordered the applist to alpha like you asked and I don't see it here. You for sure have an old version.

I wish there was a way to make the appname more dynamic. The Roku driver does it, but I really didn't want to make child devices for every android app that the TV has. I honestly don't have a use case myself for launching apps mainly because Sony doesn't tell me what is the active app.

What I originally wanted was to know if Plex was playing on the TV, I could turn my sound to movie, crank the sub up, dim the lights and close the blinds.

What I did like was the send url button. I'm in the process of getting my IP cameras into blueIris. I will at some point send the streaming webpage to the TV when a gate opens or garage or something. I was doing this before with the rtsp link through tinycam, but it wasn't great.

Agree, was using the import link from the top section of the code and saw strange results so now I grab the URL from github, working better now

Still not seeing what I would expect when I update the app list however I'll keep playing with it

Thanks again

Thank you, this worked perfectly!

Sorry, another (probably dumb) question: how can I control the tv from RM or dashboard? I can find volume and switching on/off. But is it possible to do more?

Or if you (or anyone else) could give me an example of a json command I could use. For example, to start Netflix, I guess with PSK number included in command...???

You dont have to do any json, thats all handled in the driver. So, this is generic advice for almost any device on hubitat, but ill show you my TV reboot rule.
Main Rule

The action you are looking for is under Custom Action

Then you have to choose a capability that Rule Machine has availible (just to find the right device). In this case, the driver has switch , so choose that.


And now all the buttons that show on the driver page can be run by rule machine..

And if you are doing something that takes a parameter (button click or launch app), then you can enter it in the parameter field.

1 Like

Maybe someone can help out with the dashboard. I can pull attributes to display, but not sure how to get the custom commands on there. I have no need for this, but not sure how to help @pietsnot .He might be trying to build a dashboard remote to put on the side of the couch or something. Obviously, I could create virtual switches that toggle the commands through rule machine and then display those, but any direct way?
Edit: NVM, not possible. I figured this was resolved already..

1 Like

Thank you! This is perfect. (I couldn't find it...)

If I expose my TV to Alexa, can i control all functions through Alexa?

I'm not sure, as I don't use Alexa, but I use the hubitat native switch and audiovolume capabilities so those commands should work with other apps or integrations.