Philips TV (2016+) Binding

Tags: #<Tag:0x00007f51f01ab2a8> #<Tag:0x00007f51f01ab168> #<Tag:0x00007f51f01ab028>

(Benjamin) #21

Great, thanks for the information! I adjusted the autodiscovery, it would be great if you could try it again with the new version (same URL like mentioned in my initial post)

(Norbert Schulze) #22

Thank you @bennYx0x, but the new jar doesn’t work as expected.
Your changes are in \org\openhab\binding\philipstv\internal\discovery\PhilipsTvDiscoveryParticipant.class
but \org\openhab\binding\philipstv\internal\PhilipsTvDiscoveryParticipant.class is executed.

There are 2 different PhilipsTvDiscoveryParticipant.class files in different directories in the jar file.

(Benjamin) #23

Thanks for pointing that out, indeed there went something wrong during the build process of the jar file.

That’s fixed now and autodiscovery should work (hopefully) now!

(Sascha ) #24

With the new version, the autodiscovery is working really fine. Pairing code is shown as soon as the thing is added:

2019-01-24 16:26:48.892 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'philipstv:tv:F00DBABE_AA5E_BABA_DADA_70af240ee707' to inbox.
2019-01-24 16:27:02.977 [INFO ] [g.philipstv.handler.PhilipsTvHandler] - Pairing code for tv authentication is missing. Starting initial pairing process. Plea
se provide manually the pairing code shown on the tv at the configuration of the tv thing.
2019-01-24 16:27:04.106 [INFO ] [tv.internal.pairing.PhilipsTvPairing] - The pairing code is valid for 60 seconds.
2019-01-24 16:27:14.971 [INFO ] [g.philipstv.handler.PhilipsTvHandler] - Pairing code is available, but username and/or password is missing. Therefore we try 
to grant authorization and retrieve username and password.

Just in this state, sending a volume request results in error:

2019-01-24 16:28:42.783 [ERROR] [ipstv.internal.service.VolumeService] - Error during the setting of Volume: failed to respond
org.apache.http.NoHttpResponseException: failed to respond
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead( ~[266:org.openhab.binding.philipstv:
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead( ~[266:org.openhab.binding.philipstv:
        at ~[266:org.openhab.binding.philipstv:]
        at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader( ~[266:org.openhab.binding.philipstv:]
        at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader( ~[266:org.openhab.binding.philipstv:]
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse( ~[266:org.openhab.binding.philipstv:
        at org.apache.http.protocol.HttpRequestExecutor.execute( ~[266:org.openhab.binding.philipstv:]
        at org.apache.http.impl.execchain.MainClientExec.execute( ~[266:org.openhab.binding.philipstv:]
        at org.apache.http.impl.execchain.ProtocolExec.execute( ~[266:org.openhab.binding.philipstv:]
        at org.apache.http.impl.execchain.RetryExec.execute( ~[266:org.openhab.binding.philipstv:]
        at org.apache.http.impl.execchain.RedirectExec.execute( ~[266:org.openhab.binding.philipstv:]
        at org.apache.http.impl.client.InternalHttpClient.doExecute( ~[266:org.openhab.binding.philipstv:]
        at org.apache.http.impl.client.CloseableHttpClient.execute( ~[266:org.openhab.binding.philipstv:]
        at org.openhab.binding.philipstv.internal.service.ConnectionService.doHttpsPost( ~[266:org.openhab.binding.philipstv:
        at org.openhab.binding.philipstv.internal.service.VolumeService.setVolume( ~[266:org.openhab.binding.philipstv:
        at org.openhab.binding.philipstv.internal.service.VolumeService.handleCommand( [266:org.openhab.binding.philipstv:
        at org.openhab.binding.philipstv.handler.PhilipsTvHandler.handleCommand( [266:org.openhab.binding.philipstv:]

When replacing username and password from the scripts, the binding begins to work really good!

Keep up the good work.

(Benjamin) #25

So the pairing process finished successfully (you should also have a Logging statement about that), but the volume setting failed. Not sure why your tv didn’t respond, but replacing the credentials reinitialized your thing and then your TV responded again.

The output will be improved in the feature, right now the error logging is pretty chatty as the binding is in beta status.

Thanks for your feedback!

(Slawomir Kruszynski) #26


I’d like to try your binding with my Philips 65OLED803. I’m using not plan text configuration in OH2. Is there anyway to configure your binding using old fashioned ini file?


(Benjamin) #27


If I understand you correctly, you would like to define your TV in a *.things file instead of using paper ui?

This is supported by openhab out of the box, but I never tried it out for this binding (

I guess the TV defined in a *.things file would look something like this:

Thing philipstv:tv:LivingRoomTv "Living Room TV" [host="", port="1926", username="xxx", password="xxx"]

Note that I don’t think that the pairing process will work this way. You would need to get the credentials beforehand with another script.

You could adjust your things definition step by step to trigger that the pin code is shown on TV, but after you would add pairingCode="1234" in your things definition, the credentials would be saved automatically by the binding. This won’t be set in your things file. In the future I could output the credentials as a logging statement, right now it’s only seen if you set Logging level to Debug.

I would love to hear if everything works well with your TV, if you need further help, don’t hesitate to ask.


(Daniel Linder) #28

For some reason the binding/Thing disassociated itself from the TV.
So - deleted the previously installed version of the binding and installed the latest .jar as of Today.
I can confirm the the Auto Detect now works works just fine. (49PUS8503/12)

(Daniel Linder) #29

All Items works as expected except from the Ambilight ON/OFF. If I turn it OFF, Turning it back ON is not possible without using the remote.

(Benjamin) #30

Great to hear that the autodiscovery is now working for you! Thanks also for your feedback regarding the other features.

Sounds pretty odd that the ON command is not working, but OFF does. Could you try it again and check your logs for any output?

(Michael Joos) #31

Great to see that there is a Binding :+1:

I have a 50PUS7373/12 and would like to share my experience: Autodiscovery is fine, ON/OFF (together with WoWLAN and WOL-Binding) and starting Netflix-App is working fine.

What I see:

  • When I switch on and off my TV with the Remote, the Thing doesn’t change its status from Online to Offline and vice-versa. As soon as I control from openHAB the ONLINE/OFFLINE-Status seems to be OK.
  • As soon as I reboot openHAB I get this as Thing-Status: OFFLINE - CONFIGURATION_ERROR Error occurred during retrieval of credentials.

And one general question:
Channels for KeyCode, AppName and TvChannel** have as soon as the TV is initializied a List of available commands --> How an where can I get these commands?

(Benjamin) #32

Would you like to share your rule for starting the TV via WOL-Binding? I would add it above as an example for others! How long does it take until the TV is up and running?

The binding should find out automatically if the TV went ON/OFF via Remote, but that takes some time, like up to 10 secs. Changing Logging Level to DEBUG should show you which “active” devices are constantly found by the binding and could give some hint what’s going on.

I could not reproduce the problem after rebooting openHAB, could you also show what the logs say after changing Logging Level to DEBUG? By the way, how did you fix the issue? The info “Error occurred during retrieval of credentials” does only appear, if the pairing code was set, but username or credentials were not found/configured.

Regarding your last question:

Cheers and thanks for your feedback!

(Michael Joos) #33

Yes, you are right. I did test it again and it looks good now. Could be that I have tested it once I did add the Thing manually. With Autodiscovery it works :slight_smile:

I just tried it again:

  1. TV is OFF = Thing is OFFLINE in openHAB
  2. Restart openHAB

I think this is the interesting DEBUG-Part:

2019-01-31 19:05:06.349 [DEBUG] [g.philipstv.handler.PhilipsTvHandler] - Create a Philips TV Handler for thing ‘philipstv:tv:F00DBABE_AA5E_BABA_DADA_76C94E569D05’
2019-01-31 19:05:06.352 [DEBUG] [g.philipstv.handler.PhilipsTvHandler] - Discovery servic registry was initialized.
2019-01-31 19:05:06.356 [DEBUG] [g.philipstv.handler.PhilipsTvHandler] - State description was initialized.
2019-01-31 19:05:06.479 [DEBUG] [g.philipstv.handler.PhilipsTvHandler] - Init of handler for Thing: 50PUS7373/12
2019-01-31 19:05:06.491 [INFO ] [g.philipstv.handler.PhilipsTvHandler] - Pairing code is available, but username and/or password is missing. Therefore we try to grant authorization and retrieve username and password.
2019-01-31 19:05:06.497 [DEBUG] [g.philipstv.handler.PhilipsTvHandler] - Received channel: philipstv:tv:F00DBABE_AA5E_BABA_DADA_76C94E569D05:keyCode, command: REFRESH
2019-01-31 19:05:06.497 [DEBUG] [g.philipstv.handler.PhilipsTvHandler] - Received channel: philipstv:tv:F00DBABE_AA5E_BABA_DADA_76C94E569D05:power, command: REFRESH
2019-01-31 19:05:06.499 [DEBUG] [g.philipstv.handler.PhilipsTvHandler] - Received channel: philipstv:tv:F00DBABE_AA5E_BABA_DADA_76C94E569D05:appName, command: REFRESH
2019-01-31 19:05:06.513 [ERROR] [g.philipstv.handler.PhilipsTvHandler] - Error during finishing pairing process with the TV: null
java.lang.NumberFormatException: null
at java.lang.Integer.parseInt( ~[?:?]
at java.lang.Integer.valueOf( ~[?:?]
at org.openhab.binding.philipstv.internal.pairing.PhilipsTvPairing.finishPairingWithTv( ~[273:org.openhab.binding.philipstv:]
at org.openhab.binding.philipstv.handler.PhilipsTvHandler.initCredentialsRetrieval( [273:org.openhab.binding.philipstv:]
at org.openhab.binding.philipstv.handler.PhilipsTvHandler.initialize( [273:org.openhab.binding.philipstv:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke( ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:?]
at java.lang.reflect.Method.invoke( ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect( [102:org.eclipse.smarthome.core:0.11.0.oh250M1]
at [102:org.eclipse.smarthome.core:0.11.0.oh250M1]
at [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:?]
at java.util.concurrent.ThreadPoolExecutor$ [?:?]
at [?:?]

What I see: username & password are not there anymore in the Thing after reboot. BTW I’m on 2.5 Milstone 1. To fix it I have to remove and add the Thing again.

And last my rule together with WOL-Binding…quite simple :slight_smile:

Switch Philips_TV_Alexa “Fernseher” [“Switchable”]
Switch Philips_TV_WoWLAN “WoWLAN” { wol=“” }
Switch Philips_TV “TV” {channel=“philipstv:tv:F00DBABE_AA5E_BABA_DADA_76C94E569D05:power”}

// Philips TV
rule “Philips TV Alexa”
Item Philips_TV_Alexa received command
switch (receivedCommand)
case OFF: {
case ON: {
createTimer(now.plusSeconds(2), [|

My target was to use it together with Alexa-Voice-Command. But I’m sure a Sitemap-Switch will do it as well. I just send an ON-Command to the WOL-Item and after 2s (not sure if this is really needed) the Power-ON command. The TV doesn’t start with just the WOL-Package. After sending the WOL-Command the status changes somehow to “I’m ready now to receive commands…”. I have seen this because of my power plug that changes from 0W to 10W after WOL-Command. Philips_Key.sendCommand(“WatchTV”) is needed in case I was on Netflix last time.

Alexa, starte den Fernseher…max 10 seconds and TV is ON (with WoWLAN)

Hope this helps :slight_smile:

Update: OK, this morning WoWLAN did not work. It really seems that this is not 100% stable…and I now understand your comment in first post. Have again to think about :sweat_smile:

(marcel) #34

First of all, thanks for the binding

Is it expected that discovers the same tv multiple times?

It seems to give some conflict over the code

(Benjamin) #35

Nope, thats not intented.

The autodiscovery looks for UPnP devices from the tv. I already adjusted that to create only one tv thing for the UPnP device with description “Media”, which fixed the autodiscovery for 2018er models.

Looks like your tv model exposes more than one UPnP device with that description. Could you share your tv model name and set the logging level to DEBUG? The found UPnP devices are logged constantly and should shed some light on this matter.

(Benjamin) #36

Really strange that the credentials are gone after the reboot. Not quite sure how to look deeper into this, but as a hint: you can fill in the credentials manually to avoid re-pairing after reboot. I hope someone else finds the time to share their experience on this!

Thanks for sharing your rule. :slight_smile: Too bad you are running into the same issue as I did - I was only able to make it nearly stable through setting up the time for the delay + repeating the WOL command if it failed… which sometimes ends up, as mentioned, in startup times as much as 20-30 seconds. :confused:

(Roland S) #37

I first tried my own TV. It was found automatically.

Status afterwards in PaperUI:
Status: UNINITIALIZED - HANDLER_INITIALIZING_ERROR Use JsonReader.setLenient(true) to accept malformed JSON at line 2 column 2 path $

(Benjamin) #38

Your TV model 48PUS7600/12 is from 2015 and therefore does sadly not support the newest Jointspace API.

(Roland S) #39

Now I had some time to give it a try with my girlfriends TV, the 50PUS7393/12 is working in general.
I can turn on/off, mute it, change volume and can change tv channels.
If Ambilight is on, I can turn it off with the switch. But then I can’t turn it on again. But I will investigate some time again, what is working in detail.

Thanks for your work to create this binding! :slight_smile: :+1:

(Mariusz) #40

Great job with this Binding. Thanks.

But I have na issue. The initial configuration has found TV, pairing succeed but after a few minutes, the username and password has vanished and now my TV is offline. What can I do to do the pairing again with a new code to get the username and password? Or another solution… for instance get these data from the existing pairing?