Philips Android TV component

Hi. Instead Python3, I would suggest to use Python2 (that helped me). Then I followed these steps

Hi,
I installed the script and can control the TV from the Hass dashboard.
Now I want to make a scene to change the source to Plex, but nothing happens.
What am I doing wrong here?

scene:
  - name: Mattias
    entities:
      media_player.tv:
        source: Plex

This is in the states section:

media_player.tv
media_content_id:
is_volume_muted: false
app_name: :iphone:
supported_features: 23997
source: :iphone: Plex
media_title: Plex
friendly_name: TV
media_content_type: app
volume_level: 0.25
source_list: :iphone: File Explorer,:iphone: Deezer,:iphone: Play Movies & TV,:iphone: Dailymotion,:iphone: Kodi,:iphone: MeteoNews.TV,:iphone: Manage apps,:iphone: How to…,:iphone: Cinetrailer,:iphone: Termux,:iphone: GameTreeTV GOLD,:iphone: SPB TV,:iphone: Help,:iphone: Cloud Explorer,:iphone: Install channels,:iphone: Videoland,:iphone: ES File Explorer,:iphone: BrowseActivity,:iphone: Plex,:iphone: Opera Browser,:iphone: ARTE,:iphone: Social TV,:iphone: Wireless and networks,:iphone: France24,:iphone: Popcorn Time,:iphone: Play Games,:iphone: App Gallery,:iphone: Update software,:iphone: Demo me,:iphone: Euronews,:iphone: App Starter for Netflix Button,:iphone: TV,:iphone: Settings,:iphone: Spotify,:iphone: Play Store,:iphone: Recordings,:iphone: Top picks,:iphone: VLC,:iphone: iConcerts,:iphone: TV5Monde,:iphone: Play Music,:iphone: Prime Video,:iphone: Developer Tools,:iphone: Media,:iphone: QuickSupport,:iphone: YouTube,:tv: Play Movies & TV

Thanks in advance!

Inlcude the icon and a space
:iphone: Plex”

Use the automation or script editor to put it in. Because yaml does not support the emojis, and the editors convert it automatically for you

Hello,

Where can I find those? I’m very new to this, sorry.

you can install the dependencies via apt-get (which is probably better anyway):

sudo apt-get install python3-crypto python3-requests

I changed the emoji the ‘APP_’, but now I’m getting an error:
reproduce_state: Unable to reproduce state <state media_player.tv=select_source:APP_ YouTube

I opened a thread for it here, not to clutter this one: Set scene to change TV source

I added a better description of how to write scripts to change sources. Hope that it helps

so any chance that the pairing process will be built into the component in the future? From my understanding, skimming of the code and this thread that should be possible to accomplish right?

Awesome, thank you for the description and the great work on this script!

So I’m going to post a noob question here, maybe someone can point me in the right direction. I’ve been trying to make this work in the field below the IDE in Home Assist via the browser.

This looks like it’s working but I can’t get past this. I tried python as wel but it doesn’t seem to run Python3 for some reason

   philips_android_tv git:(master) ✗ python2 philips.py --host xxx.xxx.x.xx> pair
Traceback (most recent call last):
  File "philips.py", line 6, in <module>
    import requests
ImportError: No module named requests

Am I doing it all wrong? I tried to install Python 3.7 on my Windows laptop but it does’t make any sense to me (none of the commands work, it just sticks with >>> in the commandline).

Look at step 2

means it is in python shell mode
Python Interpreter: Shell/REPL

You need to install the “requests” pithon module (“pip3 install requests” or equivalent on Windows)

I finally got it working. I had to install PyCrypto (to be honest, I asked someone else to do it for me in the end). I have one small issue.

Changing the volume on the TV works perfectly when the soundbar (via HDMI CEC, so it turns on when the TV turns on) is off. But when the soundbar is on, it will only change up or down by one point, no matter what I tell it to do.

This is the same when I ask Google Home to set the volume to a certian level. It works when the soundbar is off, but not when it is on. So it isn’t a flaw in this component, but I think it might be the best place to ask this question.

Does anyone know a way to fix the volume problem when the soundbar is on via CEC?

Just installed this component to control my 55PUS7303 and it works great. Thank you for this component.

Hi, thanks for making Philips TV support better to Home Assistant.

Is there any way to make EPG working in Home Assistant? Then I could ditch the remote. :sweat_smile:

Hi there, maybe can anyone help me out.

I used the pair-script, with success, on my Linux desktop. So I have an user/password.

I tried to get it working on a Docker Home Assistant install with no success.

EDIT 1: Got these error messages:

Traceback (most recent call last):
File “/usr/src/app/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/usr/src/app/homeassistant/helpers/entity.py”, line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/usr/src/app/homeassistant/util/init.py”, line 315, in wrapper
result = method(*args, **kwargs)
File “/config/custom_components/media_player/philips_2016.py”, line 235, in update
self._tv.update()
File “/config/custom_components/media_player/philips_2016.py”, line 316, in update
self.getChannels()
File “/config/custom_components/media_player/philips_2016.py”, line 359, in getChannels
r = self._getReq(‘channeldb/tv/channelLists/all’)
File “/config/custom_components/media_player/philips_2016.py”, line 291, in _getReq
return json.loads(resp.text)
File “/usr/local/lib/python3.6/json/init.py”, line 354, in loads
return _default_decoder.decode(s)
File “/usr/local/lib/python3.6/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/local/lib/python3.6/json/decoder.py”, line 357, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None > json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Question, is a Home Assistant setup using a Docker (on a Synology NAS) supported?

I could imagine the requirements are different. Because I used the pairing script on my local computer, so do I need to execute the pip3 install -r requirements.txt script on my Docker install?

Does anyone got this working on a Home Assistant (Synology NAS) Docker configuration?

EDIT 2: FYI, I noticed the media_player component in my HA front-page, with an empty source selection, but powering off worked.
EDIT 3: FYI, also a __pycache__ directory is made in the custom_components/media_player directory containing a philips_2016.cpython-36.pyc file.

For anyone interested in automating the Ambilight+Hue setting, I have put together a Switch component using most of the code from my Ambilight Light component, this adds support for Ambilight+Hue status (while the tv is available) and switching on/off from Home Assistant. Note, there is a bit of a lag between HA sending the on/off request, and registering it change, therefore it is advised to decrease the scan_interval in your configuration.yaml

2 Likes

Is there a way to switch to a certain HDMI input? Like HDMI 1

No, Use hdmi-cec

And there is no workarround for this? Because there is an option “Source”.

Maybe something like pressing source and then 4 times down?
Is there a up, down, left, right command?