bendavid / aiopylgtv

Library to control webOS based LG Tv devices
MIT License
143 stars 47 forks source link

set_picture_mode() method doesn't work #30

Closed chros73 closed 3 years ago

chros73 commented 3 years ago

Hi Josh!

Thanks for adding these new methods! set_current_picture_mode() works fine here: aiopylgtvcommand 192.168.1.78 set_current_picture_mode expert2 But not set_picture_mode(): aiopylgtvcommand 192.168.1.78 set_picture_mode expert2 hdmi2_pc

Basically, I try to switch to the same preset but into PC mode from non-PC mode. Does it work for you? Thanks

TV: LG B8, fw 4.10.25, webos 4.1.0-5511

bendavid commented 3 years ago

This function cannot actually switch between pc and non-pc mode. What this function call will do is change the picture mode in the pc mode. So if you call that and then manually change hdmi_2 to pc-mode, then you should find that the picture mode has been set to expert2.

I'm not aware of exactly how to automatically change between pc-mode and non-pc mode (but it's likely possible by manipulating other settings through similar api calls)

chros73 commented 3 years ago

I see, and indeed works like this, thanks. Let us know if you manage to figure out switching between PC and non-PC mode :) (set_current_picture_mode is really handy for comparing image: no need for fool around with UI elements, that modifies the image, especially with HDR10/DoVi content, thanks for this!)

chros73 commented 3 years ago

1 more question, how can I use set_current_picture_settings() via command line? I tried these but didn't do anything:

aiopylgtvcommand 192.168.1.78 set_current_picture_settings "\"brightness\": \"75\""
aiopylgtvcommand 192.168.1.78 set_current_picture_settings "brightness: 75"
aiopylgtvcommand 192.168.1.78 set_current_picture_settings "{"brightness": "75"}"
bendavid commented 3 years ago

I don't think you can do that using the command line.

Everything is possible from a python script :)

chros73 commented 3 years ago

Yes, you are right, not by default, but it can be achieved by passing dictionary via JSON string (although dunno how to automate this for every argument, maybe checking that argument string starts and ends with { ?) This would be a nice addition, if it can be done.

And thanks, it works from a script well:

import asyncio
from aiopylgtv import WebOsClient

async def runloop():
    client = await WebOsClient.create('192.168.1.78')
    await client.connect()
    settings={"brightness": "75"}
    await client.set_current_picture_settings(settings)
    await client.disconnect()
asyncio.run(runloop())
bendavid commented 3 years ago

For changing pc mode I THINK it would be something like

        uri = "com.webos.settingsservice/setSystemSettings"

        params = {"category": "other", "settings": {"hdmiPcMode": {"hdmi1" : False, "hdmi2": True, "hdmi3" : False, "hdmi4" : False} }}

        await client.luna_request(uri, params)
chros73 commented 3 years ago

Thanks, but it doesn't seem to do anything (non-PC HDMI2 input is selected).

bendavid commented 3 years ago

Yah unfortunately this method of accessing the settings can't return any error messages, so it's a bit difficult to debug.

chros73 commented 2 years ago

Actually the PC mode trick works! :) I just added another PR for it, thanks!

chros73 commented 2 years ago

I updated the PC mode PR to only apply to the selected HDMI input.