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)
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.
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!
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: 10.0.0.41:1926 failed to respond
org.apache.http.NoHttpResponseException: 10.0.0.41:1926 failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141) ~[266:org.openhab.binding.philipstv:2.5.0.2019012
30705]
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) ~[266:org.openhab.binding.philipstv:2.5.0.20190123
0705]
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) ~[266:org.openhab.binding.philipstv:
2.5.0.201901230705]
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705
]
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118) ~[266:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.openhab.binding.philipstv.internal.service.ConnectionService.doHttpsPost(ConnectionService.java:79) ~[266:org.openhab.binding.philipstv:2.5.0.2
01901230705]
at org.openhab.binding.philipstv.internal.service.VolumeService.setVolume(VolumeService.java:95) ~[266:org.openhab.binding.philipstv:2.5.0.20190123070
5]
at org.openhab.binding.philipstv.internal.service.VolumeService.handleCommand(VolumeService.java:57) [266:org.openhab.binding.philipstv:2.5.0.20190123
0705]
at org.openhab.binding.philipstv.handler.PhilipsTvHandler.handleCommand(PhilipsTvHandler.java:124) [266:org.openhab.binding.philipstv:2.5.0.201901230705]
When replacing username and password from the scripts, the binding begins to work really good!
Keep up the good work.
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!
Hi,
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?
Thanks
Hey,
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 (https://www.openhab.org/docs/configuration/things.html).
I guess the TV defined in a *.things file would look something like this:
Thing philipstv:tv:LivingRoomTv "Living Room TV" [host="192.168.0.100", 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.
Cheers
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)
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.
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?
Great to see that there is a Binding
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?
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:
-
KeyCodes are static and can be seen at http://jointspace.sourceforge.net/projectdata/documentation/jasonApi/1/doc/API-Method-input-key-POST.html
-
AppNames and TvChannels are retrieved during startup of the TV (= each time TV thing changes to ON) and set dynamically. You can only see the origin list if you set the Logging Level to DEBUG, then you will be able to see logging statements outputting the retrieved apps and tvchannels.
Cheers and thanks for your feedback!
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
I just tried it again:
- TV is OFF = Thing is OFFLINE in openHAB
- Restart openHAB
- 50PUS7373/12 OFFLINE - CONFIGURATION_ERROR
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(Integer.java:542) ~[?:?]
at java.lang.Integer.valueOf(Integer.java:766) ~[?:?]
at org.openhab.binding.philipstv.internal.pairing.PhilipsTvPairing.finishPairingWithTv(PhilipsTvPairing.java:87) ~[273:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.openhab.binding.philipstv.handler.PhilipsTvHandler.initCredentialsRetrieval(PhilipsTvHandler.java:187) [273:org.openhab.binding.philipstv:2.5.0.201901230705]
at org.openhab.binding.philipstv.handler.PhilipsTvHandler.initialize(PhilipsTvHandler.java:154) [273:org.openhab.binding.philipstv:2.5.0.201901230705]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [102:org.eclipse.smarthome.core:0.11.0.oh250M1]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [102:org.eclipse.smarthome.core:0.11.0.oh250M1]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
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
Items:
Switch Philips_TV_Alexa âFernseherâ [âSwitchableâ]
Switch Philips_TV_WoWLAN âWoWLANâ { wol=â192.168.1.255#70:c9:4e:56:9d:05â }
Switch Philips_TV âTVâ {channel=âphilipstv:tv:F00DBABE_AA5E_BABA_DADA_76C94E569D05:powerâ}// Philips TV
rule âPhilips TV Alexaâ
when
Item Philips_TV_Alexa received command
then
switch (receivedCommand)
{
case OFF: {
Philips_TV.sendCommand(OFF)
}
case ON: {
Philips_TV_WoWLAN.sendCommand(ON)
createTimer(now.plusSeconds(2), [|
Philips_TV.sendCommand(ON)
Philips_Key.sendCommand(âWatchTVâ)
Philips_TV_WoWLAN.sendCommand(OFF)
])
}
}
end
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
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
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
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.
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. 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.
I first tried my own TV. It was found automatically.
Status afterwards in PaperUI:
Status: UNINITIALIZED - HANDLER_INITIALIZING_ERROR com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 2 column 2 path $
Your TV model 48PUS7600/12 is from 2015 and therefore does sadly not support the newest Jointspace API.
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!
Hi
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?
Thanks.