Philips Android TV component

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?

You can build your own script doing this with key input. The the repository with the component in this thread Source is meant for channel and app only.

Thanks, but that might be out of my programming skills.

Most of the times I try to turn on the TV with component it fails. Like 3 of 4 tries fail.

When I turn it on manually the component connects. I have WoWLAN enabled and I read that it not a 100% reliable.

When it fails I also tried to ping my TV with a failing result. So it looks like that’s not an issue of the component but one of the TV, because it’S offline.

Do you also experience this? I also use the ambilights component and I have a similiar experice here. The Ambilight-Light only works in manual mode for about 5 mins after I turn the TV to standby. After that it will go unavailbale (also no ping).

1 Like

It is the same for me. But it should be possible to make the component more reliable.
The steps to turn on the TV using wake on lan (or WoWLAN) has 2 steps:

  1. Send a WOL/WoWLAN packet to the TV. This wakes up the TV API
  2. Send a Power: On command to the TV

To make it more reliable, we would need a function which waits until the API of the TV is online and then sends the command. Currently we send the WOL, and then try a few times to turn it in. This would need to be better.

1 Like

@nstrelow Do you use the ambilight component as well?

Maybe you coudl share you experience with that as well,

See:

Only works when TV is on. The light goes out, when the TV goes to sleep, so the API is not accessible anymore

Everyone should check out the hass.io ADB addon and the custom component made for it.
https://github.com/hassio-addons/addon-adb

This can potentially do much more than just pause and play inside Apps, but show content of the Apps.
I will try it out myself soon.

Keep us updated.

You can use ADB for this: GitHub - eslavnov/android-tv-remote: A simple wrapper around ADB to send commands to Android TVs

UPD: the API itself does not support this AFAIK. Button combos like “source => down => down…” worked terribly for me (constantly selected wrong inputs or you have to add a delay between sending keys, but then it’s SLOW)

Don’t know if this is possible for hassio users like me?

And what does UPD mean?

I tried ADB and it works but not much, you can turn on/off, change volume and see which app is currently running. I haven’t checked if it launch apps. Unfortunately, the player stays in idle mode and doesn’t change to playing mode when app, e.g. Netflix or Youtube, actually playing.

For me it does change.

And this would be one thing, which it is better at as the current component.

It can detect when something is playing or being paused.