LG webOS change picture setting mode with scripts

I have root telnet enabled. I can connect via Putty, and send commands such as below which successfully changes picture mode.

luna-send -n 1 luna://com.webos.settingsservice/setSystemSettings '{"category": "picture", "settings": {"pictureMode": "expert2"}}' & exit

However I’m unable to get the command_line switches code here to work. The switch simply resets to off. The logs show no error.


Edit:

Finally managed to get it working with below…

switch:
  - platform: command_line
    switches:
      lgtv_picture_bright_cl:
        unique_id: "lgtv_pict_bright_cl"
        command_on: >
            echo "luna-send -n 1 luna://com.webos.settingsservice/setSystemSettings '{\"category\": \"picture\", \"settings\": {\"pictureMode\": \"expert1\"}}' & exit" | curl --raw --max-time 1 telnet://192.168.1.4:23
        command_off: >
            echo "luna-send -n 1 luna://com.webos.settingsservice/setSystemSettings '{\"category\": \"picture\", \"settings\": {\"pictureMode\": \"expert2\"}}' & exit" | curl --raw --max-time 1 telnet://192.168.1.4:23
        command_state: > 
            echo "luna-send -n 1 luna://com.webos.settingsservice/getSystemSettings '{\"category\": \"picture\", \"keys\": [\"pictureMode\"]}' & exit" | curl --raw --max-time 1 telnet://192.168.1.4:23 | grep -c expert1
        friendly_name: "LG Picture Bright"
4 Likes