Sony Devices Binding

Thanks @Jordo and @frejos for your feedback. I’m still struggling with the scalar service that goes offline in my environment due to forbidden error. May I ask you whether you use the normal or pre-shared key authentication for your obviously working binding set-up?

For me was ok 1 day, now it can’t connect with error:

2021-01-12 19:29:25.056 [WARN ] [ache.cxf.phase.PhaseInterceptorChain] - Interceptor for {http://192.168.5.29:32662/sony/webapi/ssdp/dd.xml}WebClient has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.

Could you provide some debug logs (log:set DEBUG org.openhab.binding.sony) of this issue for further investigation?

sony_log_oh.txt (37.9 KB)

sure but… now its working … I set debug and will send you when problem occurs. For now full log with default log level.

Sure, for me I literally dropped the JAR file in my addons directory. The binding immediately discovered my XBR-75XB50C model TV as a Sony Scalar Web thing in my inbox. I added that to my model (powerstatus and volume-speaker are the two channels I use and mapped). That was it, this was a fresh OH3 install so no existing configuration was at play (no shared key). I did already have my TV configured to work with the 2.5 binding and didn’t change any TV settings.

Edit: I confirmed the settings on my TV. It is set to Normal authentication and has Simple IP Control enabled.

Hi there,
Thank you for the updated 3.0 binding.
My KDL-55W950B was discovered, but I had the same issue as before with 2.5 version - my TV scalar binding is always ends up in COMMUNICATION_ERROR - Forbidden state.

Logs are attached.
Pairing is ok, TV says that the devise is successfully registered. Authentication is set to normal.
KDL-55W950B - scalar connection log.txt (941.4 KB)
Can you advise where is the issue?

When openhab tries to connect to the TV, the LED light on the bottom of the screen blinks with blue-ish color.

Minor question to @andan did you have contact to @tmrobert8 about the port to 3.0? He worked on it for 4 years and was about to file a PR. I hope he is still motivated to get the 3.0 version filed after the 2.5 version was closed last week.

Hello @andan ,

Sorry for my late reaction. I am using a normal key for authentication.
I still haven’t investigate the “wrong url” bug i mentioned. But the binding still works fine.

Not yet. I’m still at the beginning of a learning curve and trying to analyze and solve some issues I have observed in my environment (notably the ‘auto’ nomal key authentication which I think is buggy).

I understand that there was already a PR review for the 2.5 release where some non trivial changes had been requested. I can image to support the work on the official OH 3 release but wouldn’t be able to privde any time commitments, especially given the complexity of the binding.

Maybe @tmrobert8 can provide a statement whether he is still ‘motivated’ to work on the 3.0 release and to what extend he would need support.

Hi, i have some Problems with the binding in OH 3… i put your file in the Addons-Folder but my Log shows :

 [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.sony-3.0.0-alpha.andan.1.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.sony [264]

Did i forget something?, i already reboot.

thanks

I have experienced the same issue. I’m currently testing a fix that seems to have solved the issue for me. I plan to release this fix later today.

Please try to manually install the folllowing features from the OH console

  • feature:install openhab-transformation-map
  • feature:install openhab-transport-upnp
  • feature:install openhab-transport-serial

Thank u, this helps.

I’ve released a new version of my OH3 compatible variant of the Sony binding:
https://github.com/andan67/openhab-addons-sony/releases/tag/3.0.0-alpha.andan.2

Main change is the implemention of a fix (probably a workaround) for the ‘COMMUNICATION_ERROR - Forbidden’ error that might occur on initialization of the scalar service when using the ‘normal key’ authentication method (see also error report from @dexter). This bug is also present in the latest OH 2.5 binding, thus I’m wondering why not more people had reported this error.

Hi @andan,

Thank you for the fix! The error has gone and the thing is in Online state. I can confirm that the issue ‘Communication error - Forbidden’ is resolved.

I have set up a couple of channels for a test:

  • Volume headphone
  • Volume speaker
  • Mute headphone
  • Mute speaker
  • Playing Title
  • Content Title
  • Power Status

Volume headphone and speaker channels are not working for me. This is because I have a connected Sony BlueRay Home Theatre system via HDMI, and my TV remode actually controls the sound of external speakers (I think TV gets the command and sends it via HDMI to the Home Theatre and receives the response with the result volume). I figured it out by disconnecting the external system.
When ‘Speakers’ in TV menu is set to ‘TV speakers’ - everything works fine. ‘Volume speaker’ channel changes the volume, ‘Mute speaker’ - mutes.

When ‘Speakers’ in TV menu is set to ‘Audio system’, then ‘Volume headphone/speaker’ is not doing anything.
‘Mute headphone/speaker’ channel also work in a strange way: when I turn the switch into the ON position, then it toggles Mute on TV. So, basically I had to turn the switch On to Mute, then turn off the switch (nothing happens) and turn it ON again to unmute.

Playing Title - shows the name of the file that is playing in the Media player.
Not sure what content title does yet.

Power Status works fine as expected. I can turn on and off the TV now.

Update: regarding the sound issues the original binding says that I need to connect to the device directly somehow and Sony-Sony connection cannot be controlled via TV sound channel.

Update 2: Sony Home Theatre volume and mute control via upnp binding works fine.

Hi andan,
I missed the first version.
The new version works fine for my scalar API so far. No need to set a key. Great work!
I think it’s still registered on my Kd-X 8005.

Still here - just not active. I welcome @andan and any other that wish to participate in the code as it’s gotten too large to maintain easily and my time has become limited again.

A few points (mainly for @andan):

  1. Did you use the starting point from Kai or did you convert from my branch? My branch has quite few changes it on it that the Kai version did not (and maybe duplicated some of the work you have done). If you start with Kai’s version - please merge changes from my version to pick up some very important ‘stuff’ (both bug fixes and new functionality).
  2. IRCC vs ircc - I can guarantee you probably will break other systems with that change (sony is very good at not being consistent). If you would, restore back to “ircc” and check the result - if it returns 404 or 503 or whatever your system returned, then recheck with IRCC. That way you support both. EDIT: most of the time it should be picking the info off the UPNP packet - but I’m guessing your system is one of the ones that doesn’t advertise it? At any rate, make sure you try both lower and upper case to support all systems
  3. Be unbelievably careful with authorization changes (and make sure you have my fix from my branch for scalar items - which was not in the 3.0 branch from Kai - probably why people aren’t encountering the 'communication_error bug" you mentioned) - all that code is time tested over a bunch of systems and what may look ‘buggy’ is actually covering corner cases to various systems. There is 4 years of debugging various authentication issues and that code has been very well tested.
  4. ’ * Set all null annotations checks to warn level’ - EDIT: sorry - thought you mean NPE checks. Surprised - I have no null annotation issues with the 2.5 code - weird that more showed up on the 3.0 code…

When you work on it - always think of why the code is the way it is - many many sony systems react differently that what you’d expect and inconsistenly with others (bravias are a great example - different models react to the API in different ways and I’ve tried to account for those).

Once you feel you are up to speed - I’ll also give you access to the github side of things (which is off by default right now in the code). That alerts me to different APIs but more importantly - give me the ability to define model functionality up front (which is needed because certain services are NOT discoverable on startup - like audio).

3 Likes

Thank you @tmrobert8 for your warm welcome and your helpful hints.

Re your points:

  1. I used https://github.com/tmrobert8/openhab-addons/releases/tag/2.5-1201-2 as starting point. My understanding is that this release should include your latest changes
  2. I’m happy to change this accordingly.
  3. If the release mentioned in 1) includes your latest authorization related changes, than I’m quite sure that I’ve discovered a real bug in that release. Note that I also encountered the error with the unchanged 2.5 binary running in an 2.5 envrionment. Maybe you can double check your release?

I’m still a bit undecided regarding my level of contribution to this great (but from developer’s perspective challenging) binding. But it definately helps to see your engagement to support me and other potential developers to make this binding future proof and become part of the offical release to reach a broader community.

Hello, I am getting this:

23-Jan-2021 17:55:01.943 [DEBUG] [g.sony.internal.providers.sources.SonyGithubSource] - Ignoring update from github - processing is disabled
23-Jan-2021 17:55:17.130 [DEBUG] [y.internal.scalarweb.ScalarWebDiscoveryParticipant] - Found Sony WebScalarAPI service: uuid:00000000-0000-1010-8000-fcf15202bd35
23-Jan-2021 17:55:17.130 [DEBUG] [y.internal.scalarweb.ScalarWebDiscoveryParticipant] - No specific thing type found for KDL-40W605B
23-Jan-2021 17:55:47.532 [DEBUG] [y.internal.scalarweb.ScalarWebDiscoveryParticipant] - Found Sony WebScalarAPI service: uuid:00000000-0000-1010-8000-fcf15202bd35
23-Jan-2021 17:55:47.533 [DEBUG] [y.internal.scalarweb.ScalarWebDiscoveryParticipant] - No specific thing type found for KDL-40W605B
23-Jan-2021 17:55:47.541 [DEBUG] [y.internal.scalarweb.ScalarWebDiscoveryParticipant] - No specific thing type found for KDL-46HX855
23-Jan-2021 17:56:01.945 [DEBUG] [org.openhab.binding.sony.internal.net.HttpRequest ] - 32 * Sending client request on thread OH-SonyDefinitionProviderImpl-3

And the thing is not included to OH.

Any suggestion?

Regards.

Are you referring to the OH3 version? If yes, could you please give some more context of your problem?