Sony Devices Binding

This binding supports Sony TVs, Blurays, BDVs, AVRs, Soundbars and Wireless Speakers. Please note that low end devices generally are not supported (they either do not have a network connection or do not have the services running on the device to support the binding) - there is NO list of what is not supported (sorry). Eventually I’ll start creating a list of known devices - but for now there is not.

Please note this binding has NOT been merged yet and is still a work in progress. You can find the latest release here:

  1. For 2.5: https://github.com/tmrobert8/openhab-addons/releases/tag/2.5-1201-2. Please review the readme at https://github.com/tmrobert8/openhab-addons/tree/1234-Sony/bundles/org.openhab.binding.sony
  2. For 2.4: https://github.com/markus7017/org.openhab.binding.sony.24/blob/master/target/org.openhab.binding.sony-2.4.0-SNAPSHOT.jar (not recommended to use - this version is very behind now)

Note: special thanks to @markus7017 for back porting to 2.4!

Simply download and drop into your addons directory.

How to uninstall/install new version
Here is a pretty complete way to remove an old version of the sony binding and install a new one:

  1. Open the karaf console
  2. From the console - bundle uninstall:org.openhab.binding.sony
  3. Wait about 10 seconds for the bundle to be uninstalled
  4. Shutdown openHAB
  5. Remove all sony jars from the addons directory
  6. Optionally (to fully clean up) - delete the userdata/sony directory
  7. Start openHAB
  8. Wait about 30 seconds for openHAB to startup properly
  9. Copy the new jar into the addon directory
  10. Wait about 30 seconds for the addon to initialize and your things to come back online.

A few notes:

  1. Step 5 is really important. Do not rename the old jar file (like “jar.bak”) or leave multiple versions anywhere in the path. This will confuse openHAB and you’ll get weird behavior or weird exceptions in your logs.
  2. If the version had a lot of channel name changes - would be best to (before step 1) delete all your existing things (both in your inbox and added things). This will allow the system to rediscover and setup with the proper names.

Unresolved Requirements
Please note that you may get unresolved requirement issues in your logs. This happens because dropping bindings into the addons directory will NOT resolve the requirements automatically (when the binding get’s merged - this won’t be an issue).

Here is a list of ‘fixes’ to install the requirements needed (all must be done from the karaf console):

  1. com.google.gson requirement: bundle:install http://search.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar
  2. upnp requirement (for 2.4): feature:install esh-io-transport-upnp
  3. upnp requirement (for 2.5+): feature:install openhab-transport-upnp
  4. xstream requirement: bundle:install http://search.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.xstream/1.4.7_1/org.apache.servicemix.bundles.xstream-1.4.7_1.jar
  5. joda-time requirement: bundle:install http://search.maven.org/maven2/joda-time/joda-time/2.10.3/joda-time-2.10.3.jar
  6. Install map transformation: feature:install openhab-transformation-map

Separating the sony logging into its own file
This is really helpful for me to get ONLY the sony logging into a separate file (that is easy to send to me):

  1. Edit userdata/etc/org.ops4j.pax.logging.cfg
  2. Delete any lines that have “sony” in them
  3. Add the following lines (at the end of the file), save and then restart openhab
# sony
log4j2.logger.sony.name = org.openhab.binding.sony
log4j2.logger.sony.level = DEBUG
log4j2.logger.sony.additivity = false
log4j2.logger.sony.appenderRefs = sony
log4j2.logger.sony.appenderRef.sony.ref = sony
log4j2.appender.sony.name = sony
log4j2.appender.sony.type = RollingRandomAccessFile
log4j2.appender.sony.fileName = ${openhab.logdir}/sony.log
log4j2.appender.sony.filePattern = ${openhab.logdir}/sony.log.%i
log4j2.appender.sony.immediateFlush = true
log4j2.appender.sony.append = true
log4j2.appender.sony.layout.type = PatternLayout
log4j2.appender.sony.layout.pattern = %d{dd-MMM-yyyy HH:mm:ss.SSS} [%-5.5p] [%-50.50c] - %m%n
log4j2.appender.sony.policies.type = Policies
log4j2.appender.sony.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.sony.policies.size.size = 10MB
log4j2.appender.sony.strategy.type = DefaultRolloverStrategy

How to send me a log

  1. From the karaf console, turn debug mode on: log:set debug org.openhab.binding.sony
  2. Shutdown openhab
  3. Delete the userdata\logs\openhab.log and/or userdata\logs\sony.log (if you separated the sony messages like above)
  4. Start openhab
  5. Do whatever action you are having issues with
  6. Stop openhab
  7. Go to https://send.firefox.com and upload the log file
  8. Send the resulting URL to me in a PM (with some explanation of what you did)
13 Likes

You might add a comment on that PR pointing back here so those people involved with that binding are alerted to the discussion.

Hi Tim
I haven’t been able to get it to work properly. I can turn the tv off,but, can’t turn it on. Having only power on and input function is quite limiting for me.

Work on a full function Sony binding would be a welcome addition!

I can help, and learn in the process.

I had implemented most of the functions using the TCP binding. not quite professional, but it works.

Wow! I disagree. That looks very professional. :slight_smile:

1 Like

I coded it all up last night and am in local testing phase today. An interesting tidbit - the API document shows that commands are a 4 letter code. Being the inquisitive person I am - I quickly scanned the TV for all 4 letter codes and found a number of commands that aren’t documented (example: DHPT, DHPU and DRSS - all three return some numeric value). After I’m done testing locally - I’ll want some public testers to try it out before issuing a pull request. While that is happening, I’ll probably investigate what those commands potentially do/return.

1 Like

Hi Tim
Great work. I’m happy to help test if required.

I’ll be more than happy to assist with any testing, I’m currently using a very basic setup using a bash script and tcp binding. So anything that allows two way communication would be very useful to have.

I am however still only running on 1.8.3, as I’m still learning how OH fits together. The Wife uses the setup I have in place right now and has accepted this solution. It’s stable and easy. SO I’m hopefully the binding is cross compatible.

I have no idea if this will work on 1.8.3 (I doubt it since it’s written for openhab2) - maybe someone else can chime in.

What’s the proper way to share a test binding jar? Attach to forum? Create a pull request? Exchange email addresses? Push to my github? uh???

Thanks,
Tim

Correct.

What’s the proper way to share a test binding jar?

First create the PR and than attach the jar to that PR (in a comment by changing the file ext to zip, since jar is not allowed by Github).

I have a couple of Sony Blu Ray players. I can test when you have something for these.

I’m in!

I have a Sony Bravia TV from 2010. It is called Sony Bravia KDL-42EX500.

Can i use this binding with my tv too or is this only workiung with newer tv?

I’ve just posted the pull request for this PR-1232 and you can find the zip file on that post. This is a testing implementation and could (probably) does contain some bugs. I’d love to get your feedback and good luck!

Tim

1 Like

I don’t know really - but I’m going to guess no. I quickly looked at the owners manual and it doesn’t appear to have a network port (wired or wireless) does it? This binding is strictly and IP based binding and without a network port - it wouldn’t be able to communicate to it. If your’s does have a network port - then check the settings to see if you can enable “Simple IP Control”. If you can, then it should work. If the setting doesn’t exist - I’d doubt this will work for you.

I’m going to start looking at the bluray player APIs (if they exist) - could you post your model numbers (and I’ll look for them as well)

My TV has a network port, i will give it a try.

My Blurays are BDP-BX320 and BDP-BX520.

tried the binding with Sony Bravia KDL50W800C and it works great, thanks.
got errors with Broadcast and MAC Address though

13:03:20.506 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error broadcast address
13:03:20.570 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error mac address

EDIT:

also, when the TV is off, there are errors about audio volume… even when Volume channel is disabled

15:14:33.639 [INFO ] [marthome.event.ItemStateChangedEvent] - sony_bravia_Home_power changed from ON to OFF
15:14:33.713 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error issuing audio volume
15:14:33.913 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error issuing audio volume
15:15:03.888 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error issuing audio volume
15:15:33.912 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error issuing audio volume
15:16:03.890 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error issuing audio volume
15:16:33.889 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error issuing audio volume
15:17:03.903 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error issuing audio volume
15:17:33.959 [WARN ] [.sony.internal.bravia.BraviaProtocol] - Error issuing audio volume

Farhanito,

For broadcast/mac address to work - you need to set the netInterface configuration for the thing. For my X830c, it’s either eth0 (for wired) or wlan0 (for wireless). The addon defaults to eth0 if none was specified. If you are connecting wirelessly, try specifying “wlan0” for that config setting. If neither of those works - try a few variants (eth1, eth2 or wlan1, wlan2 if wired or wireless). If none of those works, either your TV doesn’t support them or they use some weird interface name (ath0?). At any rate, since none of this is documented it’s kinda guess work. Play with them and report back your results if you would.

As for the audio volume (and some of the others as well), the next version will be a bit smarter in handling those. When the TV is off, many of the commands return errors (likewise, channel commands return errors when using hdmi). The current version of this binding just blindly submits everything regardless of state.