eslavnov / pylips

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

[FEAT] Listening to music - To be able to set "screen off", "screen on" or otherwise toggle display panel on/off #71

Closed old-square-eyes closed 3 years ago

old-square-eyes commented 4 years ago

Describe the solution you'd like To be able to set "screen off", "screen on" or otherwise toggle.

This is a setting in my quick settings menu for turning off the panel (but not the TV), for example when you are listening to music.

I have this setting on my 65PUT6703 GUI

eslavnov commented 4 years ago

I've actually looked into this functionality some time ago: I also have this option in the menu, but I was unable to make it work through the API, unfortunately.

If somebody manages to make it work, please share your solution!

begner commented 3 years ago

"unable to make it work" - same here. Also decompiled the settings app and digged depper into this functionality... Its the action "org.droidtv.settings.GREEN_MUTE" (ScreenOffService) - but i cant manage to start ist from adb-shell as well

It should be possible - but i didnt find the trick :D

begner commented 3 years ago

ok - finally understand the settings apk from philips...

So - in one call - you can execute screen mute with:

adb shell "am start -n org.droidtv.settings/.setupmenu.SetupMenuActivity --es LAUNCH screen_off && input keyevent 23"

this will launch the Settings Menu, directly jumps to the „screen_off“ context, and then press „ok“.

note: the context you need to launch is the one we get from "menuitems/settings/current".

so - for example - if you want to open the "audio output format" settings node simply launch:

`adb shell "am start -n org.droidtv.settings/.setupmenu.SetupMenuActivity --es LAUNCH digital_output_format'

maybe this helps

eslavnov commented 3 years ago

Hi @begner, thanks for sharing, this is great news! Based on your adb commands here is how to do it with Pylips:

python3 pylips.py --command launch_app --body '{ "intent": { "extras": { "LAUNCH": "screen_off" }, "action": "Intent {}", "component": { "packageName": "org.droidtv.settings", "className": "org.droidtv.settings.setupmenu.SetupMenuActivity" } } }'

python3 pylips.py --command confirm
elupus commented 3 years ago

There is also a screenstate endpoint.

begner commented 3 years ago

There is also a screenstate endpoint.

can you give an example how to use it?

nullEuro commented 1 year ago

Screenstate can be used like this:

python3 pylips.py --command post --path screenstate --body '{"screenstate":"Off"}'

Works on my TV and turns off the screen.