What is the recommended way to handle pairing/authorization


I’m working on an OpenHAB2 binding for Sony Bravia TVs. I’m doing my discovery through UPnP and it works great, but to actually control the device I must go through a pairing process:

  1. Binding sends authorization request to the TV.
  2. The TV displays a random authorization code on the screen.
  3. Within a time limit of 60 seconds user must somehow provide this code to the binding.
  4. Binding sends the code to the TV and obtains its authentication key.

I’ve reverse-engineered the protocol and I am able to implement it, but I don’t know how to fit it into the OpenHAB binding architecture and how to handle necessary user interaction.

I could really use some guidance on where to put what.


Hi Mikolaj,

Sorry that I didn’t respond any earlier, somehow your post escaped my attention…

It is a very good question for which I do not yet have any good answer. As it concerns the concepts of the available APIs, which are now part of Eclipse SmartHome, I would suggest that you post your question at https://www.eclipse.org/forums/index.php/f/271/ and we can discuss there, what are the best options to move forwards.


I reposted my question as you asked: https://www.eclipse.org/forums/index.php/m/1710158/

1 Like

I have been investigating the controlling Sony via openhab and have found you don’t need to pair it interactively. You can set a pre-shared key in the TV settings.

settings->network->home network setup->ip control->pre-shared-key

Then in the http post requests you add to the header “X-Auth-PSK:1111” where 1111 is the key you set.

This should make the binding easier to implement.

1 Like

Did you write this binding to work for OH 1.8?

I was reverse engineering the api commands by capturing packets from the Video & TV SideView app on Android, but I got as far to discover auth cookies, and basic commands until i spotted this post and development progress.

Did you try to use the predefined key option that @smee204 mentions?

@msiedlarek Any news on when we can expect a PR from you?

I’m gonna have to try that pre-shared key solution. I kind of hope it won’t work, because I already implemented much more complicated pairing… :slightly_smiling:

@Kai Current state of my work is here:

I haven’t had much time to work on it lately, but I basically got it to the point where the pairing and authorization work, you can turn the TV on/off and you can change the input source. Would you be interested in such a basic binding? There is much more that could be implemented, but I currently have little free time to spend on it.

I don’t mind “basic” bindings as long as they work and provide some useful functionality. If the ground work is done, it can be a good starting point for others to add more specific features on top of it. So yes, feel free to create a PR for it!

Hi colleagues,

any progress on This? Iam also ready to Support since my TV isnot in my Setup t the Moment.
As far as I know there is API which can be used:

If You already started This binding, I will wait for your PR.

Thanks BR,

@Kai and pretty much anyone interested - I’ve finally found some time to dig up this binding and make a proper pull request:

(this system won’t let me post a proper link for some arbitrary reason)

@smee204 Thanks for the tip about X-Auth-PSK, it worked and I had a pleasure of throwing away a week of my work on the pairing authentication system. :slight_smile:

1 Like