New Sony Bravia TV integration for 2015 - 2016 alpha

Hi ive created a new Device Handler for Sony Bravia Tv’s i’ve obviously been testing with mine which is a 2015 55 inch and all functions work well so far.

You will need to set up your tv on the network via lan or wifi and turn your tv’s security to PSK, ive tested with a passphrase of 1111 but you should be able to use whatever passphrase the TV allows.

Enable remote start on your TV: [Settings] → [Network] → [Home Network Setup] → [Remote Start] → [On]

Enable pre-shared key on your TV: [Settings] → [Network] → [Home Network Setup] → [IP Control] → [Authentication] → [Normal and Pre-Shared Key]

Set pre-shared key on your TV: [Settings] → [Network] → [Home Network Setup] → [IP Control] → [Pre-Shared Key] → [sony]

Give your TV a static IP address, or make a DHCP reservation for a specific IP address in your router.

Note: Within the Device on the SmartThings IDE the Device Network ID for Device instance must be hex of IP address and port in the form of 00000000:0000 (i.e. 10.0.1.220:80 is 0A0001DC:0050) - if you check the logs the smart device will log the correct address that you can copy paste, once the IP address has been set. If this is not set you wont get updated on/off status. Apparently you can get the Device handler to set it but ive not been able to properly test this yet.

the interface is basic and ive only added a few buttons from the remote, but over time I’ll try to add more

unfortunately there isn’t much in the way of feedback from the tv with the exception of the on or off status so the app works more like a remote than something we can read status from.

I would be interested in hearing some ideas about uses for the device handler however, as in smart apps for TV set up etc. My aim was to be able.to setup some sequences perhaps on a virtual button, for instance a Netflix scene button could in theory wake the TV from standby switch to Netflix and lower the lighting, or you might be able.to have an Xbox scene using one of the HDMI inputs. Not sure how all that would work perhaps a smart app would have to be put together. But maybe I’ll try that another time.

15 Likes

I forgot to mention if your going to have a go with this, can you let me know how you get on setting it up and if it works which model sony TV your using and how old it is,

Im wondering now also if the remote codes will work with CEC and if so i may be able to combine more remote codes from other devices such as surround sound amps and blueray players into the remote i have sony versions of both those things so i should be able to test it although mine are quite a bit older than this tv is

A further note, there is a small bug currently that sometimes shows the TV as on if it’s gone into eco sleep mode as the TV doesn’t respond to any polls for status in eco sleep. My intention is to somehow test for this in future and if the TV isn’t responding at all, ST should send a WOL packet and a turn on command from the normal on button instead of having a separate Wake on LAN button. However for this simple release I’ve not had time to look into that yet. You may want to turn eco sleep off while using this but I do intend to at least try to support it as best I can in future.

1 Like

Thanks Steve, I will give this a try.

Where do I get the port number from, or is it always 80 ?

Ok - Tried it with port 80 and everything is working on my Sony KD-43X8305C

Thank you so much Steve, I owe you a beer !

1 Like

Ok, so install was a breeze, and so was finding the hex IP address, great job!.

I see that it detects my TV is on but nothing works. I am wondering if that’s relating to the PSK. What are you referring with that? Your not referring to WPA2-PSK are you?

Thanks!!

No - It’s not the WPA2-PSK.

On mine it was in Settings, Network, Home Network Setup, IP Control, Pre-Shared Key

I just set it to 12345

2 Likes

I had to run off before I finished this, but I’m trying it on mine at home today.

I’ll let you know what happens when I get back home.

Great work, thanks Steve. Just got it working on my 2015 Bravia KDL-50W805C. Everything seems to work fine, not tried WOL. Setup was relatively straightforward once I’d found the TV’s IP address and converted it into hex.

1 Like

Great news thanks everyone for getting back to me @bennetm3 is correct on the psk front I’ll edit the top post shorty with the full instructions there. Won’t have chance to work on this tonight but perhaps tomorrow I’ll bash about with it and get a few more buttons on there. Are you guys hoping all buttons will be available or are you after some specific functions? I was hoping I’d be able to control more of the buttons from smart apps but at the moment I can’t use any except the off and on one

1 Like

I just tested this and got it working on my Sony X8309C. Everything works except for the status which I think seems backwards e.g. Smartthings shows the device as on when it’s off and vice versa.

Still this is excellent, nice and easy to setup :slight_smile:

I would really like the ability to:

  1. Turn the device on.
  2. Change input to digital TV.
  3. Set the channel.

That way I can make the TV part of our Good Morning! routine and switch the TV on and to Cbeebies for my kids :blush:

For me the most useful function would be ‘Picture Off’ that appears under the Action Menu. I know that seems strange, but I use the speakers connected to the TV when watching on my projector and just turn off the screen.

Mine worked too. Ill have to find the model number. Impressive!

Just confirmed that it works on my XBR-65X750D

I just updated the software earlier today to PKG6.0612.0004NAA.

I’ve been using the home assistant Sony module for a while. We might be able to steal some ideas from it. https://home-assistant.io/components/media_player.braviatv/

XBR-43X800D working like a champ. Thank you for the work you’ve done. I look forward to any future enhancements you may make.

Nice work on the Device Handler code. I have been working on/using something similar but just switched to yours.

My TV is a KDL65W850C

The one problem I have is that when using the json commands for turning the TV on and off, the LED below my TV screen blinks green and then red when trying to turn the TV back on.

It could just be my own TV, I have had to replace the main board once already.

But to get around this I updated the on and off commands to use the “TV Power” option instead. This mimics the behavior of my remote, and even though I’m just putting the TV in standby, I am no longer having the blinking LED issue.

def on() {

log.debug “Executing ‘on’”

poll()

def rawcmd = "AAAAAQAAAAEAAAAVAw=="  //TV power
def sonycmd = new physicalgraph.device.HubSoapAction(
        path:    '/sony/IRCC',
        urn:     "urn:schemas-sony-com:service:IRCC:1",
        action:  "X_SendIRCC",
        body:    ["IRCCCode":rawcmd],
        headers: [Host:"${state.tv_ip}:${tv_port}", 'X-Auth-PSK':"${tv_psk}"]
 )
 sendHubCommand(sonycmd)

poll()
}

have had a small bash around this afternoon. no major changes just trying some things out. I think ive solved the eco mode issue now however. so if your TV has gone into eco sleep. when you press the “on” button the the TV will send a wake on lan packet instead of a standby on packet. however if your tv is in standbye it will send a standby on packet instead, which should remove the need for us to have a wake on lan button and hopefully allow you to keep Eco mode turned on on your TV’s, turn on time is slightly slower but power saving may be much better. Still not yet to solved the TV thinking its on. when its in eco sleep but still bits to do @tinfranca unfortunately i couldn’t get the remote codes for power on and standby to work previously with my tv, but ill have another go later and report back

I’ve updated the code with the latest proddings @bennetm3 should be happy as i added the pic off button to test something I also added a digital button which switches to the tigital TV input.

Wake on lan works on the on button, but eco mode still shows the tv as online when its off :frowning:

ill try to add the rest of the buttons soon but its a slog to add them all on lol

let me know if ive broken anything!

1 Like

Looks like you’ve added a ip to hex converter. Why are there 4 ip address entries in the preferences? I am getting the following error when editing the preferences.

Edit: Never mind. That is for each section of the ip address.