Philips Android TV component

I tried to change the port in philips.py to 1925

python3 philips.py --host 192.168.2.51 pair
Starting pairing request
Traceback (most recent call last):
File “/home/pc/.local/lib/python3.8/site-packages/requests/packages/urllib3/connectionpool.py”, line 597, in urlopen
httplib_response = self._make_request(conn, method, url,
File “/home/pc/.local/lib/python3.8/site-packages/requests/packages/urllib3/connectionpool.py”, line 345, in _make_request
self._validate_conn(conn)
File “/home/pc/.local/lib/python3.8/site-packages/requests/packages/urllib3/connectionpool.py”, line 844, in validate_conn
conn.connect()
File “/home/pc/.local/lib/python3.8/site-packages/requests/packages/urllib3/connection.py”, line 319, in connect
self.sock = ssl_wrap_socket(
File "/home/pc/.local/lib/python3.8/site-packages/requests/packages/urllib3/util/ssl
.py", line 324, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File “/usr/lib/python3.8/ssl.py”, line 500, in wrap_socket
return self.sslsocket_class._create(
File “/usr/lib/python3.8/ssl.py”, line 1040, in _create
self.do_handshake()
File “/usr/lib/python3.8/ssl.py”, line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1131)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pc/.local/lib/python3.8/site-packages/requests/adapters.py”, line 413, in send
resp = conn.urlopen(
File “/home/pc/.local/lib/python3.8/site-packages/requests/packages/urllib3/connectionpool.py”, line 630, in urlopen
raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:1131)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “philips.py”, line 140, in
main()
File “philips.py”, line 90, in main
pair(config)
File “philips.py”, line 41, in pair
r = requests.post(“https://” + config[‘address’] + “:1925/6/pair/request”, json=data, verify=False)
File “/home/pc/.local/lib/python3.8/site-packages/requests/api.py”, line 110, in post
return request(‘post’, url, data=data, json=json, **kwargs)
File “/home/pc/.local/lib/python3.8/site-packages/requests/api.py”, line 56, in request
return session.request(method=method, url=url, **kwargs)
File “/home/pc/.local/lib/python3.8/site-packages/requests/sessions.py”, line 488, in request
resp = self.send(prep, **send_kwargs)
File “/home/pc/.local/lib/python3.8/site-packages/requests/sessions.py”, line 609, in send
r = adapter.send(request, **kwargs)
File “/home/pc/.local/lib/python3.8/site-packages/requests/adapters.py”, line 497, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:1131)

@Kardesken Hi, whats the custom integration? I have the same issue. Works reliable for a few hours then is being offline in HA

Are you asking me for what custom integration I’m referring to in this post (5 posts ago…) ?

I am not a techie either, but i am learning is there som update for Microsoft Visual C++ Compiler for Python 2.7?

I just want the credentials so i can add my Philips TV

So the new Models 805/855/865 support WakeOnWlan (WoWLan). Was anyone able to implent this?

Hi all,

I’m trying this out on my new Philips 936. I wanted to try to select apps, which apparently should be possible on this TV as it uses the V6 API, but for sources I only get my 4 HDMI inputs. I tried doing it as explained here like so:

service: media_player.select_source
data:
  source: "\U0001F4F1 YouTube"
target:
  entity_id: media_player.philips936_tv

But I can’t get it to work with apps.

Is anyone successfully choosing the smart tv apps with this? If so, could you please share a sample?

Thanks.

Answering my own question here. Didn’t notice the little media icon at first in the media player when I tried it, but it does actually have all the apps and favorites and channels (except strangely Apple TV so if anyone knows the ID for that, please tell me)…

By choosing one and tailing the log I was able to figure out the syntax and one app ID. The proper service call to open an app looks like this:

service: media_player.play_media
data:
  media_content_id: com.amazon.ignition.IgnitionActivity-com.amazon.amazonvideo.livingroom
  media_content_type: app
target:
  entity_id:
    - media_player.philips936_tv
3 Likes

Hi there.

Has someone else recently purchased a model from the 7906 series or similar? (mine is a 55PUS7906) Or generally a new 2021 model Philips TV?
It seems there is no jointSPACE API on those models (neither requesting the API version via http, nor setting up the integration works). Can someone confirm this?

1 Like

Best way to confirm is to point your browser to:

http://IP_ADDRESS_OF_TV:1925/system

If you get something then you have jointspace, if you don’t, then you don’t. AFAIK no additional work is needed to enable the API (at least there wasn’t on my TV).

Also just noticed that there is also a full list of supported TV’s that need activation to activate the API at the very beginning of the docs too:

http://jointspace.sourceforge.net/download.html

so basically RTFM ;-). If your TV is not in either of those methods then I think it’s safe to assume it’s not supported.

Do you know the bundle id for Netflix?

Here’s some stuff I was trying to add to the docs but messed up the PR for. Will try again. Bundle ID for netflix is in there.

Selecting apps, channels, or favorites

Apps, channels, and favorites are exposed as media content to the integration. You can see which ones are available by clicking the media button in the media player more info card for your TV. To capture the content_id for the one you want to use in an automation or script, turn your logging on to debug level and tail the log while choosing the media content in the media player more info card. You will find a log message that looks like this when you choose the media:

2021-11-22 01:45:14 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=media_player, service=play_media, service_data=entity_id=media_player.philips936_tv, media_content_id=com.amazon.ignition.IgnitionActivity-com.amazon.amazonvideo.livingroom, media_content_type=app>

Then you can turn that into a service call for the script or automation like the following, which can then open the app/channel/favorite automatically.

service: media_player.play_media
data:
  media_content_id: com.amazon.ignition.IgnitionActivity-com.amazon.amazonvideo.livingroom
  media_content_type: app
target:
  entity_id:
    - media_player.philips936_tv

Here are some example media_content_id’s for apps that have been discovered with this method. These might not be the same for every TV, so YMMV.

App Name Media Content ID
Hulu com.hulu.livingroomplus.WKFactivity-com.hulu.livingroomplus
Google Play com.google.android.videos.tv.presenter.activity.TvLauncherActivity-com.google.android.videos
TV1 Russia ru.kino1tv.android.tv.ui.activity.MainActivity-ru.tv1.android.tv
YouTube com.google.android.apps.youtube.tv.activity.ShellActivity-com.google.android.youtube.tv
Curiosity Stream com.curiosity.activities.OnboardingActivity-com.curiosity.curiositystream.androidtv
HBO Max com.hbo.go.LaunchActivity-com.hbo.hbonow
PBS com.pbs.video.ui.main.activities.StartupActivity-com.pbs.video
Plex com.plexapp.plex.activities.SplashActivity-com.plexapp.android
PBS Kids org.pbskids.video.splash.ui.SplashScreenActivity-org.pbskids.video

Selecting HDMI Input

Selecting the HDMI Input on the TV is done as follows

service: media_player.select_source
data:
  source: HDMI 4
target:
  entity_id: media_player.philips936_tv
3 Likes

I made a remote control for Philips TV in lovelace by using built in integration.

If anyone is interested here is the template you can use as a starting point.

cards:
  - cards:
      - icon: mdi:television-box
        tap_action:
          action: call-service
          service: media_player.select_source
          service_data:
            source: HDMI 3
          target:
            entity_id: media_player.svetainestv
        type: button
        name: Televizija
        hold_action:
          action: none
      - icon: mdi:netflix
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: media_player.play_media
          service_data:
            media_content_id: com.netflix.ninja.MainActivity-com.netflix.ninja
            media_content_type: app
          target:
            entity_id: media_player.svetainestv
        type: button
        hold_action:
          action: none
        name: Netflix
      - icon: mdi:youtube
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: media_player.play_media
          service_data:
            media_content_id: >-
              com.google.android.apps.youtube.tv.activity.ShellActivity-com.google.android.youtube.tv
            media_content_type: app
          target:
            entity_id: media_player.svetainestv
        type: button
        hold_action:
          action: none
        name: Youtube
    type: horizontal-stack
  - cards:
      - icon: mdi:restore
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: Back
          target:
            entity_id: remote.svetainestv
        type: button
      - icon: mdi:arrow-up-drop-circle
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: CursorUp
          target:
            entity_id: remote.svetainestv
        type: button
      - icon: mdi:import
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: Source
          target:
            entity_id: remote.svetainestv
        type: button
        hold_action:
          action: none
    type: horizontal-stack
  - cards:
      - icon: mdi:arrow-left-drop-circle
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: CursorLeft
          target:
            entity_id: remote.svetainestv
        type: button
        hold_action:
          action: none
      - name: OK
        show_icon: true
        show_name: false
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: Confirm
          target:
            entity_id: remote.svetainestv
        type: button
        hold_action:
          action: none
        icon: mdi:circle-slice-8
      - icon: mdi:arrow-right-drop-circle
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: CursorRight
          target:
            entity_id: remote.svetainestv
        type: button
        hold_action:
          action: none
    type: horizontal-stack
  - cards:
      - show_icon: false
        show_name: true
        show_state: false
        tap_action:
          action: none
        type: button
        hold_action:
          action: none
      - icon: mdi:arrow-down-drop-circle
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: CursorDown
          target:
            entity_id: remote.svetainestv
        type: button
      - icon: mdi:television-guide
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: TvGuide
          target:
            entity_id: remote.svetainestv
        type: button
        hold_action:
          action: none
    type: horizontal-stack
  - cards:
      - icon: mdi:volume-plus
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: VolumeUp
          target:
            entity_id: remote.svetainestv
        type: button
      - show_icon: false
        show_name: true
        show_state: false
        type: button
        tap_action:
          action: none
        hold_action:
          action: none
      - icon: mdi:plus-circle-outline
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: ChannelStepUp
          target:
            entity_id: remote.svetainestv
        type: button
    type: horizontal-stack
  - cards:
      - icon: mdi:volume-minus
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: VolumeDown
          target:
            entity_id: remote.svetainestv
        type: button
      - show_icon: false
        show_name: true
        show_state: false
        tap_action:
          action: none
        type: button
        hold_action:
          action: none
      - icon: mdi:minus-circle-outline
        show_icon: true
        show_name: true
        show_state: false
        tap_action:
          action: call-service
          service: remote.send_command
          service_data:
            command: ChannelStepDown
          target:
            entity_id: remote.svetainestv
        type: button
    type: horizontal-stack
type: vertical-stack
4 Likes

Hey guys, short question.

I have an Philips 2018 Android TV with API v6 on port 1926 and https protocol.
Was running this without issues with another smarthome system and pylips.py python script.
Want to ditch the seperate script and use an integration.

Now after researching, there are two integrations, the official one and the one from HACS.
I am a little bit confused because the official one should support v6 API but states port 1925, see here: Philips TV - Home Assistant

So which one is recommended for my “Philips 2018 Android TV with API v6 on port 1926 and https protocol”?

thx

The HACS integration is deprecated since the official integration is available.

1 Like

thx, installed the official integration and paired without an issue.

Same exact model here. Confirm that apparently there are no API via HTTP.

Weird thing is that other mobile apps that are supposed to work, like the Philips TV Remote (declared to work for TVs 2019+), can’t find the TV on the network.
The only way to interact with is Google Home. It’s nice, but useless from my side since i would like to control at least the Ambilight and Power On/Off features through Home Assitant.

Any ideas on how to make this possible?

You can turn it on and off with the Android TV integration.
Haven’t found a way to control the Ambilight though…

1 Like

Hi, I have te problem that I can remote the TV (42PFK6549/12) after about 20 seconds. Turning te TV off and on, I can remote it again for about 20 seconds.
Strange thing is. that the original “Philips Remote” app also don’t work. But the app “PhilRemote” works fine. Also after the 20 seconds.

Any suggestions for a solution?

I have an oled 706 TV and with wifi it did not connect to home assistant. I have connected it with a an Ethernet cable and activated wake on lan and wake with google and now it works perfectly. I put it in case it can help someone. something as simple as being connected by cable or Wi-Fi can cause it to not work.

1 Like