New Sony Bravia TV integration for 2015 - 2016 alpha

Ill fix that at the same time!

Would anyone here like a turn on and switch to option in the setting?

I “may” be able to change the device handler so when you press the on button it turns the tv and switches to a specified input. you would then select either turn on as normal to last used input or turn on to and then a choice of

hdmi 1 -4
Digital TV (probably unable to select a channel however)
App menu
something else (will see what the options are

if you selected one of the options in the list it would then always turn on to that choice using smartthings

it “may” be possible to do this but it might be a bit of a hack, for instance i may have to make it wait 20 seconds then press the button to change it, so it probably wouldnt be as smooth as turning it on and the screen you want being the first to display


I would love this option actually. Is it even possible to also switch to restricted profile as well? Mostly to prevent my kids from messing with my setting.

Its funny that you mention this today…

I finally had a bit of time yesterday to work on my authentication problem but because it was late and I was already pretty tired, I worked on automating the selection of functions that cannot be accessed directly via a command, specifically launching the Amazon Video app. Using CoRE, I created a new piston that triggers off of a simulated switch which then steps through a series of key presses to navigate to and launch the app. So I basically created a macro in CoRE. The tricky part was troubleshooting the potential initial states that the TV could be in at the time of piston activation, so that regardless of the initial state, The piston would navigate to a known top level menu location and proceed from there. Once I had established the necessary keystrokes, I then had to play with the timing between commands to ensure that the TV would respond in time for the next command to function properly. For instance once the home menu is requested, you need to wait a second or two before you try to navigate and the time that it takes for the home menu to pop up varies based on the TV state at the time of the request. If Nexflix is running it takes longer to pop up than if on a source input. I still have a little more troubleshooting to do so that the piston runs as quickly as possible but is also robust, (I think there may be a network lag issue) but it presently seems to be about 95% reliable and executes reasonably fast.

Here’s what the piston looks like right now:

ive not seen core mentioned before, what is it? is it something that will work with the existing device handler? or is it something you are modifying the device handler with.

Id recommend that you also test it with booting from powersave mode, perhaps even proble the TV and wait for a response, as booting from power save mode with wake on lan takes a lot more time than just resuming from standby

Oh man… If you haven’t used CoRE yet (Community’s own Rule Machine) you need to make time to get acquainted with it because it is one of the most useful and powerful smart apps, (possibly the best) ever created for ST. It allows you to create almost any type of automated sequence you can imagine (If, If not, or, then, etc…) with a ton of status’ and variables from your devices, and hub, plus much much more.

Just pop over HERE to get started.

As for the power up situation, I’m not going to worry about that right now because it is irrelevant to my setup until I can fix the authentication issue I have. It would also have to have a way to determine if the TV was already powered up to be bulletproof. So for now, as long as I know my TV has been on for ~10 seconds, I can tell my Echo to turn on “Amazon Video” and Viola! I’m off to the races.

Now it would be cool if Alexa/Echo could identify/activate the commands you’ve made available in the device handler, but I think that is an issue on the Echo side rather than the device handler in that for now the Echo only permits the On/Off activation of switches, the setting of dimmers, and a few other very specific functions like thermostat settings. Hopefully that will change in the future, but for now those can be pulled out via virtual switches and custom pistons in CoRE for Echo activation

1 Like

ok alex, ill check out CoRE sounds excelent.

Ive just updated my code again, Ive fixed the Netflix button and it looks I hadnt broken the code in the latest build above, i just needed to go into settings and save the settings again and everything sprung into life.

how is everyone getting on with the device handler, working as you would expect?

1 Like

I updated with your latest code and was able to turn on and off and the other buttons I tried worked fine. My only problem is the status indicator not matching but I think it just takes a few minutes to sync like discussed earlier.

Thanks so much this is my first “custom code” and I love it!

Same as @dash. Thank you for the DTH.

Just wanted to say thanks for this SmartThings handler. I have this working with my XBR55X850C running the latest firmware (version PKG3.709.0120NAB) and my Echo. You rock!

Ditto to all the above, and thank you for putting so much work into this. This is a great handler.

Using successfully on a Sony 2015 Bravia XBR 55x850c.

If anyone would mind helping me set this up, step by step… please let me know. I am getting no where and very frustrated. I have a XBR-49X700D.

I can certainly try my best to help you jim…

you need to follow the instructions on the first post as closly as possible, or your going to struggle

if you go through them can you let me know any parts of the instructions you get stuck on?

Ok, I created a device handler in smarthings dev but it doesn’t do anything. When I search for new devices in smartthings, my tv does not show up. I think I am missing a step. Can you please email with your replies. Thanks a ton for the help.

I created a CoRE piston to poll the TV status. Works like a charme :slight_smile:

what steps did you do to do that @Joern?

so you pasted the code into the IDE ?

lets check its correctly setup, log back into the smartthings dev environment on your computer where you pasted the code, and click “My Device Handlers”

look down the list and find sony bravia Tv, it should say Published next to it, if it isnt in the list or isnt published it wont work.

if it is in the list but not published click on it and it should take you to see the code you pasted. In the top corner, press the publish button, then the “for me” button

now on the website, click “my devices” link, and in the top corner add new device. Give it a name like living room tv

you can set label to the same

you should be able to leave zigbee and network id empty

in the “type”, scroll right to the bottom of the list, hopefully you will see “sony bravia TV”

Version i think self published

select the location

select the hub

group can be empty

click create, now click on the link at the top “live logging”, keep the live logging page open on your computer while you pick up your mobile phone

open the smart things app, and go to my home, hopefully sony tv will be listed, click on it, then press the settings cog button in the top right (if this doesnt open up automatically the first time which i think it might.

It will ask you to name your device again it may already have the name in it that you entered on the IDE i cant remember.

you can choose an icon, ive set mine to a TV icon

now this is where you enter the IP address of the TV, you should ideally have set the IP address on your tv to a static address so it doesn’t change otherwise the app might stop working. but this is beyond the scope of this tutorial. The details of setting up the TV correctly are in the first post on this page.

enter the ip address into the app

for example (this wont be the same for your tv so make sure you find it) if your TV displays, IP Address

ip address part 1 will be: 192

part 2 will be: 168

part 3 will be: 0

part 4 will be: 10

the port number is usually 80 unless you change it on the tv

PSK passphrase you will have setup when doing the steps in the first post

make sure you have the IDE live logging page open on your computer when you click done on the phone app

you should see on your computer a line appear that looks something like this

Netid c0a80065:0050

copy the part that looks like: c0a80065:0050 with your computer mouse

still on the comuter click “my devices” again, and click on sony TV

click the edit button at the bottom, and find the “Device Network ID” box

Paste in the code into that box and click update

that should be it

Let me know how you get on

1 Like

I am guessing at the port number (80). Is there any way for me to confirm that is what my router is using?

The basis is a very simple Basic piston

Trigger happens every n minutes
Using TV

This will give you the current status of the TV. Works very very well.

I added some more conditions (motion sensor in the living room, only at home) whatever.

Based on the TV status radio, lights and other devices switch on and off.

Hopefully that helps

1 Like

Got it!!! I am not even going to tell you the STUPID mistake I made. :slight_smile:

Just in more question…in smartthings when I look at the “recently” for SonyTV, it only show that it was turned on this morning… there are no other log entries even after I press selections in smarthings…i.e. Off,on, volume,mute. Why?