Philips TV (2016+) Binding

Hi guys!

Wanna report that I’m testing this binding with a 49PUS8303 - just bought it yesterday…
I’m also trying different things with curl from command line.
Here’s my findings…
First, I confirm that, after restarting openHAB the thing is OFFLINE - CONFIGURATION_ERROR and the pairing code was missing from thing configuration.
Managed to solve it by adding the thing manually with all parameters like this:

Thing philipstv:tv:F00DBABE_AA5E_BABA_DADA_70af24a6ee9a "Livingroom_TV" [host="192.168.200.33", port="1926", pairingCode="8635", username="NDAoG1KzXMuPZ5CP", password="ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115"]

Some strange thing is that the TV is not reporting the current channel… Weird, because yesterday I saw the channel name and also the channel image, but now, looking at the logs it says:

09:10:12.686 [DEBUG] [tv.internal.service.ConnectionService] - Target Uri is: https://192.168.200.33:1926/6/audio/volume
09:10:12.800 [DEBUG] [tv.internal.service.ConnectionService] - ----------------------------------------
09:10:12.801 [DEBUG] [tv.internal.service.ConnectionService] - HTTP/1.1 200 OK
09:10:12.802 [DEBUG] [tv.internal.service.ConnectionService] - {"muted":true,"current":0,"min":0,"max":60}
09:10:12.806 [DEBUG] [tv.internal.service.ConnectionService] - Target Uri is: https://192.168.200.33:1926/6/activities/current
09:10:12.909 [DEBUG] [tv.internal.service.ConnectionService] - ----------------------------------------
09:10:12.910 [DEBUG] [tv.internal.service.ConnectionService] - HTTP/1.1 200 OK
09:10:12.911 [DEBUG] [tv.internal.service.ConnectionService] - {"component":{"packageName":"NA","className":"NA"}}

About Ambilight… Turn it off works, but turning it back on set the Ambilight to ‘follow color’, not ‘follow video’ - previous setting. Also, the binding doesn’t read the current Ambilight configuration.
One idea would be to stop using /ambilight/power and switch over to /ambilight/currentconfiguration and pooling it to get the config.
@bennYx0x, maybe you could take this into consideration?
Here’s some curl examples:

# getting Ambilight supported modes
$ curl -X GET --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 https://192.168.200.33:1926/6/ambilight/supportedstyles
{"supportedStyles":[{"styleName":"OFF"},{"styleName":"FOLLOW_VIDEO"},{"styleName":"FOLLOW_AUDIO","algorithms":["ENERGY_ADAPTIVE_BRIGHTNESS","ENERGY_ADAPTIVE_COLORS","VU_METER","SPECTRUM_ANALYZER","KNIGHT_RIDER_CLOCKWISE","KNIGHT_RIDER_ALTERNATING","RANDOM_PIXEL_FLASH","STROBO","PARTY"],"maxTuning":2},{"styleName":"FOLLOW_COLOR","algorithms":["MANUAL_HUE","AUTOMATIC_HUE"],"maxSpeed":255},{"styleName":"LOUNGE"},{"styleName":"MANUAL"},{"styleName":"EXPERT"},{"styleName":"GRID"},{"styleName":"FLAG"},{"styleName":"APP"}]}

#getting current Ambilight config
$ curl -X GET --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 https://192.168.200.33:1926/6/ambilight/currentconfiguration
{"styleName":"FOLLOW_VIDEO","isExpert":false,"menuSetting":"STANDARD","stringValue":"Standard"}

# setting Ambilight to OFF
$  curl -X POST --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 -d '{"styleName":"OFF"}' https://192.168.200.33:1926/6/ambilight/currentconfiguration

$ curl -X GET --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 https://192.168.200.33:1926/6/ambilight/currentconfiguration
{"styleName":"OFF","isExpert":false}

# setting Ambilight to FOLLOW_VIDEO
$ curl -X POST --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 -d '{"styleName":"FOLLOW_VIDEO","isExpert":false,"menuSetting":"STANDARD","stringValue":"Standard"}' https://192.168.200.33:1926/6/ambilight/currentconfiguration

$ curl -X GET --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 https://192.168.200.33:1926/6/ambilight/currentconfiguration
{"styleName":"FOLLOW_VIDEO","isExpert":false,"menuSetting":"STANDARD","stringValue":"Standard"}

@bennYx0x - keep up the good work! :smile:

EDIT:
Here’s the TV response to a /system query:

$ curl -X GET --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 https://192.168.200.33:1926/6/system
{"notifyChange":"http","menulanguage":"English","name":"Livingroom_TV","country":"Romania","serialnumber_encrypted":"s\/Z17thwTxN7n2P0bmCDVTrhq3kxB2wNxeRIgSSLQ9E=\n","softwareversion_encrypted":"P3OtbBqME0qwDhH4eDV9J9EaEk5pk+ZU7yZ3fMiGDzDlkliTQeMw1iLmU6RHjdJs\n","model_encrypted":"tjoYwzYg3f80h3XdRnKjmnx+SyWA7B4PJBjwmXk1rfo=\n","deviceid_encrypted":"tn8YWAYbFmqwi95xlq\/EnMeMPCs34jDrDSd3oYn1pkU=\n","nettvversion":"8.0.2","epgsource":"one","api_version":{"Major":6,"Minor":1,"Patch":0},"featuring":{"jsonfeatures":{"editfavorites":["TVChannels","SatChannels"],"recordings":["List","Schedule","Manage"],"ambilight":["LoungeLight","Hue","Ambilight"],"menuitems":["Setup_Menu"],"textentry":["context_based","initial_string_available","editor_info_available"],"applications":["TV_Apps","TV_Games","TV_Settings"],"pointer":["not_available"],"inputkey":["key"],"activities":["intent"],"channels":["preset_string"],"mappings":["server_mapping"]},"systemfeatures":{"tvtype":"consumer","content":["dmr","pvr"],"tvsearch":"intent","pairing_type":"digest_auth_pairing","secured_transport":"true","companion_screen":"true"}},"os_type":"MSAF_2018_O"}

Fiddling around the web searching for more about Philips Android TV, jointspace and such I stumbled upon a VEEERY interresting project: https://github.com/eslavnov/pylips
One thing I didn’t know how to do was how to change the brightness level of Ambilight… I have it on ‘follow_video’, but on evenings even a brightness of 4 seems a little much…
I was wondering how I can change it from openHAB, based on, eg. time of day or luminance sensor…
And, with the help of the aforementioned project, I found a way - might be great if this can be included in the binding…

I read the menu structure of the TV using curl (https://github.com/eslavnov/Pylips/wiki/Settings-menu-structure-(GET) and I found the following node:

                  "node_id": 2131230769,
                  "string_id": "org.droidtv.ui.strings.R.string.MAIN_AMBILIGHT_BRIGHTNESS",
                  "context": "ambilight_brightness",
                  "data": {
                    "slider_data": {
                      "min": 0,
                      "max": 10,
                      "step_size": 1
                    }
                  },
                  "type": "SLIDER_NODE"
                },

Next:

$ curl -X POST --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 -d '{"nodes":[{"nodeid":2131230769}]}' https://192.168.200.33:1926/6/menuitems/settings/current
{"values":[{"value":{"Nodeid":2131230769,"Controllable":true,"Available":true,"string_id":"Brightness","data":{"value":4}}}],"version":0}

You can see the current Ambilight brightness set to 4.

I tried to change it to 10:

$ curl -X POST --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 -d '{"values":[{"value":{"Nodeid":2131230769,"data":{"value":10}}}]}' https://192.168.200.33:1926/6/menuitems/settings/update

and here is the result - snapshot taken from an ip camera – I’m @work :smile::
image
Then setting it to 1:

$ curl -X POST --digest --insecure -u NDAoG1KzXMuPZ5CP:ade340a88b18db300b0ab7d19b06e3a656cc8d21834f88bd84302574bad1b115 -d '{"values":[{"value":{"Nodeid":2131230769,"data":{"value":1}}}]}' https://192.168.200.33:1926/6/menuitems/settings/update

image

So… it’s working!!!
@bennYx0x - what about including something like this in the binding?
Every menu setting could be read and updated from openHAB!
Here’s the response from menuitems/settings/structure – it’s a zIP so change TXT to ZIP – menuitem.settings.structure.txt (10.5 KB)

1 Like

Thanks for all the feedback - one common problem seems to be the vanishing of the credentials after the restart of OH. I can’t reproduce this currently with my installation, but I will upgrade to the latest version in like 2 weeks and will verify if this problem also starts occurring.

@Wespen did you succeed meanwhile? Which OH version are you running on? You shouldn’t need to do anything else beside putting it in the addons folder.

@Mihai_Badea thanks for sharing your findings! Indeed the outsourcing of the thing configuration into a file should solve the problem - at the moment my assumption is, that setting automatically the thing configuration (credentials, to be exactly) is not being persisted.

The current channel is not working at all any more for you? Sadly I can’t test this feature myself, since I don’t have cable tv. Therefore I had to implement it kinda “blindly”.

Adding Ambilight configuration is already on my list - my plan is to work on it around Easter!

@bennYx0x vanilla openHAB 2.4.0 Release Build
I just put the JAR in the addons folder.

I only have z-wave installed, no other bindings.
Maybe your install have bindings that already pulled required packages?

I had to install one package in karaf and then it was working in 2.4:
feature:install esh-io-transport-upnp

Thanks for sharing your findings. Indeed I found the following thread which states, that this is needed for bindings dropped into the addons folder: Creating a binding with UPNP discovery

I’ll add this information above.

1 Like

Hi guys
My TV 65PUS8102/12 looses pairing after a few days working. Any solutions, please?

Hi,
does this happen after a restart of OH? Any hints in the logs? Does the credentials vanish in the thing configuration?

Hi,
It did not happen after restart. Binding went offline by itself.
Re logs, it hard to say as I haven’t caught the moment when it happened. I noticed it after some time - hard to say even when.
The thing is configured. To make online again, I edit thing and put a new pairing code. Such configuration works for a few days.

1 Like

Hi :slight_smile:

I have installed the binding, and its online. I can see in the log, that the pairing did not succeed - I did not get any code on the TV. Can I force it to show the code? Its a 8102.

PS, the TV is in another part of the house, so if the pairing is showed only for a few seconds, I missed it.

Hey!

Good that you mentioned that the tv is in another room - because you’re absolutely right, it’s only shown for a really short time. So you should be able to get it done with a short sprint or placing your mobile phone there and taking a video. :wink:

Best regards

Got it, up and running, slightly out of breath :wink: - thanx :slight_smile:

Hi, I have a 55PUS7170/12 which is not listed. I installed the plugin in order to test if it was supported but the TV is not detected from openhab.

Is there something special to do ? Thank you in advance

I have a 65pos9002 I could test.

Regards s

Is there any update planned? Binding works great, but ambilight control is missing.

Hey,

I was kinda busy the last couple of months, but I am still planning to enhance the features of the binding. Great to hear that your tv works fine with the binding so far!

@sbeex did you meanwhile manage to couple your tv? What does the logs say?

@Seaside sure, go ahead and please leave your experience with the binding for your model!

@bennYx0x the TV is not detected. Should I add it manually ?

Using it on 55POS9002/12 and it seems to work fine (not all features tested)

With my 43PUS6412, sending keystrokes, powering off/on works but not setting the volume. This has had worked for me.

Snippet from the log:

2019-08-08 19:42:14.106 [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) ~[196:org.openhab.binding.philipstv:2.5.0.2019012
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) ~[196:org.openhab.binding.philipstv:2.5.0.20190123
        at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) ~[196:org.openhab.binding.philipstv:
        at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118) ~[196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.openhab.binding.philipstv.internal.service.ConnectionService.doHttpsPost(ConnectionService.java:79) ~[196:org.openhab.binding.philipstv:2.5.0.2
        at org.openhab.binding.philipstv.internal.service.VolumeService.setVolume(VolumeService.java:95) ~[196:org.openhab.binding.philipstv:2.5.0.20190123070
        at org.openhab.binding.philipstv.internal.service.VolumeService.handleCommand(VolumeService.java:57) [196:org.openhab.binding.philipstv:2.5.0.20190123
        at org.openhab.binding.philipstv.handler.PhilipsTvHandler.handleCommand(PhilipsTvHandler.java:124) [196:org.openhab.binding.philipstv:2.5.0.2019012307
        at sun.reflect.GeneratedMethodAccessor231.invoke(Unknown Source) ~[?:?]
        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.co
        at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [102:org.eclipse.smarthome.core:0.11.0.oh250
        at com.sun.proxy.$Proxy137.handleCommand(Unknown Source) [196:org.openhab.binding.philipstv:2.5.0.201901230705]
        at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:75) [109:org.eclipse.smarthome.core.t
        at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [109:org.eclipse.smarthome.
        at sun.reflect.GeneratedMethodAccessor230.invoke(Unknown Source) ~[?:?]
        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.co
        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) [?:?]

Anything I can do?

Can i set ambilight color ?