[Release] Sony Bravia TV Rest Control

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

Did avyone ever resolve this issue... super annoying. I saw references to it in earlier posts but no resolution. Even if there were just a way to supress the error I'd be ok with that.

I just disabled that part of the code in the end as it annoyed me and I did not need that bit.

1 Like

Its been awhile since i have been on here. My only Sony TV has been off the wall (on wifi, without driver update) for about 12 months while renovating, starting new job, having baby, so i haven't kept up with this. I did get a few updates from Sony that could cause issues.

So the error that you have shown is a network error where the hubitat calls cannot reach the Sony API. Im not explicitly logging this error as its built in to the hubitat (to my knowledge). The networking stuff inside the Sony endpoint may have some issues that cause this to happen occasionally. In my years of having the rest API polled, it showed up about 3 times, but I never had my status not update (and i polled every minute to set background lights). I'm not aware what @BorrisTheCat did to purge the errors.

Hi Angus_M what was your final rule to get the Sony TV to toggle mute and unmute, every other time.

Yes, very simple...

image

Thanks, is this mute and unmute, or just power.

That was power, this is mute:

image

Thanks for the reply. I'll just disable that part of the code.

I believe I had a similar issue - I have a RM 5 rule to turn on an LED backlight (via a Sonoff Zigbee plug named Backlight) when my Sony TV, an XBR-55X930D, turns on and to turn off the backlight when the TV turns off:

It was intended to be triggered anytime the TV on/off state changed (I have the Refresh Interval set to 1 min), but I found that I was getting a changed rule trigger every time the TV on/off state was queried, even if no power state had changed. I edited the driver at line 224 to check the current state.devicepower against the query response before issuing an event, like so:

With this change I got the behavior I was looking for: backlight comes on when TV turns on, doesn't turn off until the TV does. Note that I have absolutely zero Groovy coding experience, so @ajones was this the appropriate way to handle the superfluous devicepower state triggers? It appears that event triggers based on querying other TV parameters follow the same model as the original on/off event code and may exhibit a similar issue.

4 Likes

Nice improvement, thank you!

I guess this is where the TV is off and so it can’t connect to the IP address? I also get this error every minute when the TV is off.