Philips TV (2016+) Binding

Hello community,

I created a binding for the Philips TV 2016 and later Series (Jointspace v6+), which use the Android TV OS. Therefore I am reaching out to you, seeking for tester. Please give me feedback and also write down your TV model.

I’ve tested all the functionality by myself with the 55PUS7101/12 model.

Below you find all the information needed for getting started, enjoy!

History:

17.01.19: Initial Version
22.01.19: Adjusted autodiscovery for 2017&2018 TV models
29.09.19:

  • Reworked the binding to the new openhab binding model and improved connection handling
  • Added Ambilight features (setting style, setting all colors/brightness/saturation, specific side color)
  • Added TV Picture Settings Brightness, Contrast, Sharpness

01.10.19: Replaced release link with new version, which has now required thirdparty libs bundled due to reported problems with resolvement.
10.11.19: Added Ambilight Lounge Mode Feature as a Switch
08.12.19: Refactored Code, fixed decimal Volume bug, added Configuration option to disable UPnP discovery and use constant HTTPS polling instead if desired, added standby as valid ONLINE thing status → Recreation of thing is needed
18.12.19: Added WOL support for turning on the TV + automatic retrieval of MAC if WOL is enabled in the tv settings, improved Standby logic
28.12.19: Minor adjustments to retry logic for requests (don’t retry if tv is off or does not accept commands) + added WOL support for turning ON the Amiblight Lounge Mode
24.12.20: Migration to openHAB 3 (thanks to @marcel_verpaalen for doing the migration job!)
09.01.21: Fix for updating current tv channel name
01.04.21: Enhanced determination of tv power state, technical improvements (lib folder removed, jackson version updated, technical lock to avoid refreshing tv if there is already a refresh running)

Features:

  • Initial Pairing Process
  • Automatically discovers if TV is turned on/off or in standby
  • Turn On/Off TV (On does only work with WOL, read Side notes below)
  • Set and Read Volume/Mute
  • Set TV Picture Settings Brightness / Contrast / Sharpness
  • Send Button commands (emulate Keys from infrared Remote Controller)
  • Turn On/Off Ambilight
  • Turn On/Off Ambilight + Hue
  • Set all Ambilight Colors, Brightness or Saturation
  • Set the color for a specific Ambilight Side (Left/Right/Top/Bottom)
  • Toggle Google Assistant on TV for a given Input (e.g. “HDMI1” switches to HDMI1 or search for content)
  • Start an Application (Netflix and so on)
  • Show current App running plus Icon (ItemType: Image)
  • Start a TV Channel
  • Turn on Ambilight Lounge Mode (Wake-On-LAN functionality is integrated, see Side Notes below for WOL)
  • Automatic refresh of current running App name, icon and the Volume (default 10 secs, configurable at the Thing)
  • Switch for deciding if UPnP discovery (default & recommended) or constant HTTPS polling should be used

Side notes:

  • Turning ON Wake-On-LAN needs to be enabled in the TV settings. If done, the MAC can be retrieved by the binding. It can also be added manually in the configs. It will be used automatically when turning on the power channel if the MAC is given.
  • Source can be set but not read. Switching source / input channel can be done via the “search content”-Channel as it uses Google Assistant. For example “HDMI 1” will switch the source/input.
  • TV Channels cannot be read, only set. This was also removed, compared to earlier jointspace versions.
  • Channels for KeyCode, AppName and TvChannel have as soon as the TV is initializied a List of available commands.
  • Only Android TV based Philips TVs are supported right now.
  • Sometimes, pretty rare, the TV does not accept commands (unknown reason). If this appears, the binding tries it automatically again.
  • Ambilight Styles and available Algorithms have as soon as the TV is initializied a list of available styles+algorithms.
  • Setting a specific Ambilight Side will turn on a special “Ambilight Mode”, where the once previously manually set colors are shown
  • Turning Ambilight Lounge Mode on if the tv is powered off requires wake-on-lan beforehand
  • Turning Ambilight Lounge Mode on/off changes randomly the colour to a preset from philips

Standby is defined as “TV is off, but network card is still awake”, summarized logic:

* Thing state OFFLINE: TV is off and network card is in deep sleep mode and therefore not reachable
* Thing state ONLINE with Message “Standby”: TV is off and network card is awake and receives commands
* Thing state ONLINE with any other message then “Standby”: TV is on and network card is awake

Difference of UPNP Discovery and HTTPS constant polling regarding Standby recognition:

* If TV is turned ON, the TV broadcasts UPNP devices and is therefore recognized as ONLINE or ONLINE STANDBY (= tv screen, network card awake) at this point of time. If the TV turns off, the network card is watched until it turns off.
* HTTPS constant polling monitors the network card the whole day through sending commands and therefore monitors the network card nonstop

Tested TV Models:

  • 55PUS7101/12 (WORKS)
  • 43PUS6412/12 (WORKS)
  • 65PUS8102/12 (WORKS)
  • 49PUS8503/12 (WORKS)
  • 50PUS7373/12 (WORKS)

Installation:

Important: The TV must be configured to always use the same IP via the network setting. See How do I manually configure the wireless settings on my Philips TV? | Philips for help.

Place the jar matching your openHAB version in your addons folder and follow the instructions below:

Release from 18.12.19 (deprecated openHAB 2.x version)

Release from 01.04.21 openHAB 3

Follow the following instructions and look at the full example items (open the Link for better view!):

…and give me feedback :slight_smile:

Thanks go out to the creator and contributors of the SamsungTV Binding. Their code helped me a lot building a binding for a TV!

11 Likes

I will definitely try this. Bought a 49PUS8503/12 for one of my daughters a few weeks ago

1 Like

My Philips 55pus7909 seems to be a little bit to old?!?
It’s an Android TV but not with the newest version.

2019-01-17 20:31:38.417 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing 'philipstv:tv:5AFEF00D_BABE_DADA_FA5A_1c5a6b75309e' to inbox.
2019-01-17 20:31:48.558 [INFO ] [g.philipstv.handler.PhilipsTvHandler] - Pairing code for tv authentication is missing. Starting initial pairing process. Please provide manually the pairing code shown on the tv at the configuration of the tv thing.

No pairing code is displayed.

Hey,

thanks for your feedback! Indeed, the 55pus7909 TV model is from the year 2014. According to https://www.domoticz.com/wiki/Philips_tv your TV uses v5. Version 6 uses HTTPs with Digestauth, therefore the pairing process.

You can verify your jointspace version browsing this path: http://<TV-IP>:1925/5/system . This should show you a JSON with jointspace v5.

Btw: Setting the logging level to DEBUG for my binding, should show exactly whats going on.

Did you note that while the TV is still in it’s shutdown process you can not send a wake on lan command but have to send the power command again and are you handling this properly in the binding? By pinging the device you can get the power status, that’s how I am doing it right now.

What exactly do you want to achieve by using WOL during shutdown of the TV? But yes, I’m handling these cases during startup and shutdown phase, where the TV does not accept commands.

I’ve used the WOL way to turn the TV on myself but didn’t find it very reliable nor fast enough. Maybe other TV models are better with this. The “Philips TV Remote App” for mobile phones is also using WOL for turning the TV on and only succeeds sometimes (at least for my TV).

Hi and thank you for the binding!!

My TV: 43PUS6412 / 2017

Working but the pairing had to be done with already known secret key as the PIN code has not been requested when adding the thing. Also the PIN shown on the TV with the philips app has not been accepted.

Thing shows online but changing volume does not change the volume but shows this stack trace in the log:

2019-01-18 20:09:34.835 [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) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56) ~[265:org.openhab.binding.philipstv:2.5.0.20190117
1527]
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.openhab.binding.philipstv.internal.service.ConnectionService.doHttpsPost(ConnectionService.java:79) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.openhab.binding.philipstv.internal.service.VolumeService.setVolume(VolumeService.java:95) ~[265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.openhab.binding.philipstv.internal.service.VolumeService.handleCommand(VolumeService.java:57) [265:org.openhab.binding.philipstv:2.5.0.201901171527]
at org.openhab.binding.philipstv.handler.PhilipsTvHandler.handleCommand(PhilipsTvHandler.java:124) [265:org.openhab.binding.philipstv:2.5.0.201901171527]
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.10.0.oh240]

Any ideas or is this the current supposed state?

Thank you again!
Sascha

Did not work. Nothing is found. I belive I read somewhere that Jointspace is not available on 2018 models.

Hey Sascha,

this is not the intended behavior! It’s working with my TV model. What about the other features, do they work? (It would be surprising)

Could you try to open the following URLs and copy the shown text?

http://10.0.0.41:1925/6/system
http://10.0.0.41:1925/system

Thanks!

Hey Daniel,

that doesn’t sound so good. By “nothing is found”, do you mean the auto discovery at the inbox does not work? Could you try to add the thing manually via the inbox? You would have to set the IP and Port at the Thing Configuration.

Something I really have to add above is the information, that it is required that the TV always has the same IP, set via the Network Settings. But this has nothing to do with your problem.

Hey Benjamin,

thank you for your support. No, the other features also don’t work. The thing status nevertheless is online.

The URLs provide JSON output, pasted here:

http://10.0.0.41:1925/6/system
{“notifyChange”:“http”,“menulanguage”:“German”,“name”:“Wohnzimer”,“country”:“Germany”,“serialnumber_encrypted”:“LMG+lGXBOSkd9H7BL3Cmqpz9XtaYY2NZOQK5eNG237Q=\n”,“model_encrypted”:“C1s4oAUsj/9ATHkVZihhLvuqRtCkiP6i4KxUa2RZbME=\n”,“deviceid_encrypted”:“yhPjj0XqP8QX1ZDTgtQQPcIOFuOmEFOopxzOKSZ7SHc=\n”,“nettvversion”:“8.0.0”,“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”}}}

http://10.0.0.41:1925/system
{“notifyChange”:“http”,“menulanguage”:“German”,“name”:“Wohnzimer”,“country”:“Germany”,“serialnumber_encrypted”:“IXJR9pbsYlao2SpMUdE6ZwqGtRfyzGdBqn46HKc3t1o=\n”,“model_encrypted”:“6/mlZnveVI6tDfbGsquzkZ4uUe+eYo1khk6RU3Y89og=\n”,“deviceid_encrypted”:“U6VF4/rpPkm/WAKkUiK8gzH8uecqrMeUEFB6aVUWgRU=\n”,“nettvversion”:“8.0.0”,“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”}}}

Between these, only the encrypted properties are different.

If you need something, I’ll do my best to support your development! :slight_smile:

Sascha

Ah okay, the api_version indicates, that you are using jointspace version 6.1. (“api_version”:{“Major”:6,“Minor”:1,“Patch”:0})

Interestingly, from what I’ve seen on other boards you shouldn’t need any pairing or secured communication. (“pairing_type”:“digest_auth_pairing”,“secured_transport”:“true”)

What is the output from the following URL:

http://10.0.0.42:1925/6/audio/volume

Could you also please name your tv model?

I give my best to work this out with your help. :slight_smile:

Connecting to the audio/volume URL from my browser results in a connection time out.
Currently, I am using https://github.com/suborb/philips_android_tv/blob/master/philips.py to control my TV.

My TV is a 43PUS6412 from 2017.

Just tested this, working fine. https://github.com/arzzen/philips-tv

Hi,
I made some wrong conclusions here. Have been trying to communicate via jointspace with no success. However, manually adding the thing is working. The TV spits out a verification code - and voila. The thing gets connected and the items are available. All the available Items actually seems to work as expected.

Awesome! It seems that I just have to improve the autodiscovery for newer tv models.

Hmm the scripts mentioned are working the same way as the binding does. Could you verify the Username and Password are the same as the ones using the script? Thanks

I only want to turn it on and off. So now I send a turn off command, the TV enters it’s shutdown procedure but wake on lan won’t work yet to turn it back on, however sending turn off again turns it on properly.

So my 48PUS7600 is also one year too old? But my girlfriend has a 50PUS7373 Android
So I can try it on her installation.

You can try it out, but it’s pretty likely that your 48PUS7600 won’t work.

Please give me feedback if also the autodiscovery worked for your newer tv, I just adjusted my binding to support 2017&2018 tvs.

I have a 55POS9002 and the autodiscovery also doesn’t work.

The log entry for discovery is:

… - Device found: Philips TV DMR with desc UPnP Media Renderer 1.0