[Release] Sony Bravia TV Rest Control

My "remote control" dashboard for my Sony TV (buttons run various rules)...

I also set up a simple rule that when the TV turns on and my mode is Evening or Night then dim the lights. When the TV turns off then revert the lights back to wherever they should be on the circadian cycle.

1 Like

In case you still want this you need to change line 243 to this
def devicemute = (response.data.result[0][0]?.mute == true) ? "muted" : "unmuted"

Oh perfect, thank you so much. I didn't have time to go digging through the code so this is very helpful. Much appreciated!

Can someone please link me to the latest version of this code on GitHub? I'm seeing that several updates have been made and I want to make sure I use the latest. Thank you!

Just to piggy back off this question does shortening the refresh rate create a lot more chatter that would bog down HE? Right now I am keeping the default refresh rate at 10 minutes but I'm wondering what the implications of maximizing to 1 minute or even more frequent (if possible).

I would like to trigger an automation upon immediately switching HDMI inputs so ideally the refresh rate would be like 5-10 seconds.

Yes, for sure, the more often it polls the TV for status, the more traffic on the network and hub. I'm using 1 minute because I want lights to follow the on/off status. Haven't seen any degradation in other areas due to that so it seems fine. I think 1 minute is the most frequent setting so if you want it more often than that you will need to edit the driver and then take care it doesn't swamp your network &/or hub. I suspect at 5 seconds you could run into trouble! Maybe a good justification for a dedicated hub if that happens and the network can take it :grinning:

Hello @ajones or anyone for that matter.

I am using this driver on a Sony XBR-55X900E and it looks like it does what I want it to do. I just needed a driver that can see the State of the TV so I can make rules. I have something funky going on in the log where it is repeating the same messages, and then now two errors (this is the first time the errors came up). I dont know if it is related, but I also cannot see the State Variables. Its not a big deal to me, but not sure if related. Please see screenshots:
tv state var

Thank you!

I have a Sony smart tv but I did not install this driver.

Somebody could give me a couple of examples of what kind of rules you defined to use it ? I have no idea what I could do with it.

You can ask Google to turn on the tv, turn on/off the Xbox when the tv is on, set lights to a certain level/colour when tv is on, turn on audio to desired level, you could simulate someone being home etc.

I have a new bravia A8H, set this driver up, set a key. Do I need to select any particular settings on the tv otherwise? There are options for "simple TV control" or "control 4" in addition to the rendering menu to allow control. The driver is connected because refreshing displays the correct volume, but none of the commands change anything. Additionally, the Sony Lite driver does control tv fine with the same ip and port setting. What am I missing?

EDIT: I got it going. For future readers with the A8H, after pulling your hair out trying every combination of settings and reading every post here, go back to the PSK settings and disregard them, set it to "none" and it'll all work perfectly. I went as far as unlocking pro settings mode so I could select the setting for only PSK instead of the default available option "normal+psk" and it still wouldn't work. Eventually I selected "none" and all is well. If you're in my LAN already, I've got bigger problems than you changing the channel so "none" should be fine!

2 Likes

Okay one odd observation. Prior to setting security to none, every action gave my log a forbidden error and did nothing. Now, everything works, and literally nothing shows in the logs whatsoever.

Note that you can do this if you add your TV to Google Home (irrespective of using the HE Rest integration).

I have a very specific use case. My wife and I have our own remotes since she always loses them. I gave her the OEM Sony, DirecTV and Google TV remotes and I do everything from my Logitech Harmony remote.

If she turns on the DirecTV from the OEM remote, Harmony does not know that so when I pick up my Harmony remote to change channels it doesn't work. I have a rule set so that if HDMI 1 is on but DirecTV Harmony activity is not running then turn on the Harmony activity. There is no interruption in the program she's viewing when this automation happens so it works flawlessly. However, it doesn't work well with Google TV since the Harmony activity will bring it back to the home screen on Google TV in the middle of watching a show.

I got the idea from someone who did the same on Home Assisstant. He talks about it here:

Hi. I've been trying to set up something like this... Can you please tell me what type of button you used? I've tried using virtual buttons but they don't show up in the dashboard.

Cheers

Yeah I set them up as virtual buttons like this...

Then for each button I have a simple rule to control what they do, like this...

Then finally on the dashboard, I used a button and the relevant virtual button for each tile, with each image sourced off the local file system on the hub, thusly....


1 Like

Thanks. you confirmed that I was on the correct path!

@ajones I found that you get a UI bleed on the driver page and its due to the driver, its a simple fix though :slight_smile:

So I came home today to all 3 of my Sony Tv's being turned on, in looking at the logs I noticed this


They are setup for a 10 minute refresh but looking at the logs they didn't provide this log entry every 10 minutes until today.

Is it an issue?

Can't figure out what triggered the TV's to turn on, it wasn't my rules as none of the backlights were turned on which is part of those rules and if any of the buttons triggered the entire rule would have fired.

Ideas?

Thanks

I've a similar issue here.
I've setup a rule machine using "When TV turns off" and it seem the rule is triggered every time the refresh is triggered.
Any idea how to solve this ?

It’s common for drivers to poll and keep reporting the on or off status, so the description “when TV turns off” is misleading. It really means “is off when checked”. So if you have a rule that you only want to trigger once when the device turns off or on then there are a couple of ways. First is to use the rule’s Boolean or a variable, set it the first time the state changes, and check for this each time so that you only run the actions you want when the Boolean or variable is not set. Remember to set it back when the TV changes it’s state again. The other method is to instead trigger in when the TV switch status “changes” and then use an ifthen statement to check if the TV is on or off and then run the actions required accordingly.

1 Like