Philips Android TV component


#285

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).


#286

Look at step 2

means it is in python shell mode
http://www.tutorialsteacher.com/python/python-interective-shell


#287

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


#288

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?


#289

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


#290

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:


#291

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.


#292

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


#293

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


#294

No, Use hdmi-cec


#295

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?


#296

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.


#297

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


#298

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).


#299

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.


#300

@nstrelow Do you use the ambilight component as well?

Maybe you coudl share you experience with that as well,

See:


#301

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


#302

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.


#303

Keep us updated.


#304

You can use ADB for this: https://github.com/eslavnov/android-tv-remote

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)