New Sony Bravia TV integration for 2015 - 2016 alpha

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.
Thanx
Jim

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 kc7ryd@yahoo.com 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 192.168.0.10

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

Steve,
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

If
Trigger happens every n minutes
Then
Using TV
->Refresh

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?

Firstly thanks for adding and supporting the integration! I managed to get this to work on a 50W829B but I’m right down at the start of the learning curve.

I did have the problem that I couldn’t turn the TV back on with the power tile - only the WOL function. Now there’s a good chance I’m just using the wrong source version but the area I was looking at is:

def on() {
  log.debug "Executing 'on'"
  
  if (state.tv == "polling"){
  	  WOLC()
      def json = "{\"method\":\"setPowerStatus\",\"version\":\"1.0\",\"params\":[{\"status\":true}],\"id\":102}"
  	  def result = sendJsonRpcCommand(json)
  } else {
  	  def json = "{\"method\":\"setPowerStatus\",\"version\":\"1.0\",\"params\":[{\"status\":true}],\"id\":102}"
  	  def result = sendJsonRpcCommand(json)
  }
}

I was wondering about a couple of things, one or both might have something to do with my problem.
a) Firstly it doesn’t ever seem to get into the first part of the “if” so I removed the “if” completely so it always calls the WOLC() function.
b) The WOLC() returns - but not executes - a HubAction object and (as far as I can tell) this HubAction will only execute if passed on out to the calling environment.:

So I’ve ended up with something like:

def on() {
  log.debug "Executing 'on'"
  
  def result = WOLC()
  def json = "{\"method\":\"setPowerStatus\",\"version\":\"1.0\",\"params\":[{\"status\":true}],\"id\":102}"
  sendJsonRpcCommand(json)
  return result
}

Something else - whereas on my TV remote “Digital” changes back to TV from an HDMI input - I can’t get the Digital tile to work here?

Finally, I wanted to set a channel after switching on the TV. As digital() didn’t work I used num1() in a call like this inside the on() method:

runIn (2,num1)

Now these 2014 Sonys are slow to respond to commands right after switch on, so although 2 seconds is enough from warm it’s not from cold - but this is obviously a problem due to the TV booting and not ST.

@jwsg ive been having trouble turning on my tv recently from standby, the wake on lan button works, but the “on” button doesn’t, (when in powersave sleep) im guessing you’re seeing the same issue as me. I think most dont have power save enabled so haven’t seen the issue, you solution may just work. Ill have a proper look at it at some point.

@Kc7ryd no idea, maybe need to add something to the code to make it show up there. ill have a look into it next time i play with the code.

First and foremost, Thanks to @steve.bratt for coding this for us. Is there a way to make the “tiles” titles in he app to read “Apple TV” “DVD” instead of HDMI 1, HDMI 2? I tried to change the code lines that I thought would do this (I changed the one that referred to Label: HDMI 1), but I was unable to get the titles on the app tiles to change. I am sure this is an easy change to the code, but really don’t know what code lines I need to change


yes this should be simple, look for these lines of code

standardTile(“tv_source”, “device.switch”, inactiveLabel: false, height: 1, width: 1, decoration: “flat”) {
state “default”, label:“Source”, action:“tv_source”, icon:""

in the above example change Label:“source” to Label:“Whatever you want it to display as”

just make sure you save and publish after you make the change

Worked perfectly! Thanks for the detailed instructions!:grinning:

I think i can use icons t5oo, but it would probably take me ages to find them all

icons would be nice. I did get the inputs renamed to APPLE TV, DVD, etc. I was tempted to change the size of the inputs to 2x2, but chickened out. I would really only do this if I had an icon to easily identify the most used buttons like inputs and channel up /down.

Very cool though. I dig it, but my wife thinks i’v gone nuts, ha ha ha!!!

Confirmed on 2016 X850D. Great work, sir!

Question: is there a way to put the Set Top Box option in? On the remote you press the Action Menu button, cursor over to the Menu drop down, then click Power (STB). If that could be automated, all would be awesome.

This works really well ! Congratulations 
 also thanks for the detailed instructions to get it up and running.

I would like to add to the functionality so it can perform the following steps (I have 2016 Sony XBR65x850d)

Switch TV on
Open YouTube or Netflix
Search for an items (pre programmed)
Run that item

I this specific case I am thinking about one of the ‘screensaver’ movies that shows a fish tank.

Does anyone know if the commands to execute this type of function exist and where I might find them ?

Thanks