eslavnov / pylips

Control Philips TVs (2015+) and Ambilight (+ Hue) through their reverse-engineered API (+ MQTT support!)
MIT License
334 stars 58 forks source link

[BUG] cur_app always returns TV on 55OLED865/12 #86

Closed heikok88 closed 3 years ago

heikok88 commented 3 years ago

Describe the bug In the status message (via MQTT) always "TV" is returned as "app" in "cur_app". The powerstate, volume, mute, ambilight settings etc. are reported correctly - nice work, thank you!

To Reproduce I have a Philips 55OLED865/12 from 2020 TV with Android TV 9.

Expected behavior Should report Netflix, Disney+, Prime, Settings and so far.

Additional context "{"powerstate": "On", "volume": 0, "muted": false, "cur_app": {"app": "TV", "channel": {"channel": {"ccid": 29, "preset": "1", "name": "Das Erste HD"}, "channelList": {"id": "allcab", "version": "1"}}}, "ambilight": {"styleName": "FOLLOW_VIDEO", "isExpert": false, "menuSetting": "STANDARD", "stringValue": "Standard"}, "ambihue": "Off"}"

eslavnov commented 3 years ago

Hi @heikok88!

Sorry for the late reply. I've tried to reproduce the issue, but on my TV it works as expected. I've also checked the code but I don't see any problems there that could lead to such behaviour.

Could you please try opening YouTube on your TV and check two things while it runs: 1) What does the MQTT status message display? 2) Please run Pylips with --command current_app and share the output

I know for sure that YouTube should return the correct status, so this will help me understand what's going on with your particular TV.

Thank you in advance!

heikok88 commented 3 years ago

Hello @eslavnov,

I'm running Pylips in a docker container: `FROM python:3-alpine

RUN apk add --no-cache build-base git && \ git clone -b v1.3.0 https://github.com/eslavnov/pylips.git && \ pip3 install -r /pylips/requirements.txt && \ apk del --no-cache build-base git && \ rm -rf /var/cache/apk/*

VOLUME /config

ENTRYPOINT ["python", "/pylips/pylips.py"] CMD ["--config", "/config/settings.ini"]`

This is the content of my settings.ini: `[DEFAULT] verbose = True mqtt_listen = True mqtt_update = True num_retries = 3 update_interval = 5

[TV] host = 192.168.0.62 port = 1926 apiv = 6 user = ceIa0LSHWanZpsex pass = 340890faa2de5d8324a2b7273e3ea6dfe70144be2f47dee8150354dfc5c01812 protocol = https://

[MQTT] host = mosquitto port = 1883 user = pass = tls = False cert_path = topic_pylips = atv/cmd topic_status = atv/stat`

I am Running Youtube on the TV and the status message prints: pi@raspi:~ $ mosquitto_sub -h localhost -u *** -P *** -t atv/stat {"powerstate": "On", "volume": 0, "muted": false, "cur_app": {"app": "TV", "channel": {"channel": {"ccid": 30, "preset": "2", "name": "ZDF HD"}, "channelList": {"id": "allcab", "version": "1"}}}, "ambilight": {"styleName": "FOLLOW_VIDEO", "isExpert": false, "menuSetting": "STANDARD", "stringValue": "Standard"}, "ambihue": "Off"}

Here is the output of --command current_app: ~ # python /pylips/pylips.py --config /config/settings.ini --command current_app Sending GET request to https://192.168.0.62:1926/6/activities/current Request sent! {"component":{"packageName":"NA","className":"NA"}}

If I change the volume or ambilight settings I receive the updatet status correctly. Just the cur_app is wrong.

Thanks for your help! If I can contribute more information - please let me know! Greetings

eslavnov commented 3 years ago

Thanks for the info! For some reason, your TV indeed does not return the current app, as you can see in the current_app response... Unfortunately, it's either a changed or a broken API in the TV, so nothing I can do. I suggest looking into using adb as an alternative or wait for a TV update that might fix this endpoint.

beam commented 3 years ago

Try call --command get --path system before get current_app, on my TV i have to call /6/system before /activities/current start working

heikok88 commented 3 years ago

Hello @beam, that works for me as well, thank you!