SkillAgentSearch skills...

Bscpylgtv

Library to control webOS based LG TV devices

Install / Use

/learn @chros73/Bscpylgtv
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

bscpylgtv

Library to control webOS based LG TV devices. Enhanced and faster version of aiopylgtv, it can be installed without calibration functionality, optimized for command line usage (it looks for the same .aiopylgtv.sqlite key config file).

Requirements

  • Python >= 3.8

Install from package

# Install lite package without calibration functionality
pip install bscpylgtv
# Instal full package with calibration functionality (requires numpy package)
pip install bscpylgtv[with_calibration]

Install from Source

Run the following command inside this folder:

# Install lite package without calibration functionality
pip install --upgrade .
# Instal full package with calibration functionality (requires numpy package)
pip install --upgrade .[with_calibration]

Windows binaries

Portable Windows binaries can be found under releases, along with First use guide.

Examples

Available settings can be found in docs directory, also available buttons.

# Get list of apps (including hidden ones as well)
bscpylgtvcommand 192.168.1.18 get_apps_all true
# Push info button
bscpylgtvcommand 192.168.1.18 button INFO
# Switch to HDMI2 input
bscpylgtvcommand 192.168.1.18 set_input HDMI_2
# Get values of backlight and contrast of the current picture preset (using list)
bscpylgtvcommand 192.168.1.18 get_picture_settings "[\"backlight\", \"contrast\"]" true
# Get values of soundOutput and soundMode of sound category (using list)
bscpylgtvcommand 192.168.1.18 get_system_settings sound "[\"soundOutput\", \"soundMode\"]" true
# Swtich to SDR ISF Expert Dark picture preset. Same as set_current_picture_mode method, requires WebOS v9 (2024) or newer.
bscpylgtvcommand 192.168.1.18 set_system_picture_mode expert2
# Swtich to SDR ISF Expert Dark picture preset
bscpylgtvcommand 192.168.1.18 set_current_picture_mode expert2
# Set values of backlight and contrast of the current picture preset (using JSON) See available settings docs for details.
bscpylgtvcommand 192.168.1.18 set_system_settings picture "{\"backlight\": 0, \"contrast\": 85}"
# Set values of backlight and contrast of the current picture preset (using JSON)
bscpylgtvcommand 192.168.1.18 set_settings picture "{\"backlight\": 0, \"contrast\": 85}"
# Turn hdrDynamicToneMapping on in the current HDR10 picture preset (using JSON)
bscpylgtvcommand 192.168.1.18 set_settings picture "{\"hdrDynamicToneMapping\": \"on\"}"
# Set colorGamut to "auto" in the current picture preset (using JSON)
bscpylgtvcommand 192.168.1.18 set_settings picture "{\"colorGamut\": \"auto\"}"
# Set mpegNoiseReduction off in the current picture preset (using JSON)
bscpylgtvcommand 192.168.1.18 set_settings picture "{\"mpegNoiseReduction\": \"off\"}"
# Set truMotionMode to smooth in the current picture preset (using JSON), values: off, cinemaClear, natural, smooth, user, clear
bscpylgtvcommand 192.168.1.18 set_settings picture "{\"truMotionMode\": \"smooth\"}" true
# Turn AI Picture Pro on in the current picture preset (using JSON)
bscpylgtvcommand 192.168.1.18 set_settings aiPicture "{\"ai_Picture\": \"on\"}"
# Setting EOTF in HDMI Signal Override menu, values: auto, sdrGamma, hdrGamma, st2084, hlg (using JSON)
bscpylgtvcommand 192.168.1.18 set_settings other "{\"eotf\": \"hlg\"}"
# Turn PC Mode on/off for HDMI2
bscpylgtvcommand 192.168.1.18 set_device_info HDMI_2 pc PC
bscpylgtvcommand 192.168.1.18 set_device_info HDMI_2 hometheater "Home Theatre"
# Launch and close screensaver
bscpylgtvcommand 192.168.1.18 launch_app com.webos.app.screensaver
bscpylgtvcommand 192.168.1.18 close_app com.webos.app.screensaver
# Turn screen off/on: turn_screen_off [webos_version] (e.g. for older WebOS: turn_screen_off 4)
bscpylgtvcommand 192.168.1.18 turn_screen_off
bscpylgtvcommand 192.168.1.18 turn_screen_on
# Display current picture mode settings
bscpylgtvcommand 192.168.1.18 launch_app_with_params com.palm.app.settings "{\"target\": \"PictureMode\"}"
# Launch installation app hidden menu (Hotel Mode, Password change, USB Cloning, Set ID setup, IP Control)
bscpylgtvcommand 192.168.1.18 launch_app com.webos.app.installation
# Display 3x MUTE button hidden menu (AVReset, Customer Support, etc)
bscpylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.tvhotkey "{\"activateType\": \"mute-hidden-action\"}"
# Display 7x GREEN button hidden Freesync info
bscpylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.tvhotkey "{\"activateType\": \"freesync-info\"}"
# NOTE: this method does not work anymore on newer WebOS versions since end of 2021. Launch hidden software updater on older firmwares
bscpylgtvcommand 192.168.1.18 launch_app com.webos.app.softwareupdate
# NOTE: this method does not work anymore on newer WebOS versions since end of 2021. Launch hidden software updater on newer firmwares, useful to downgrade (using JSON)
bscpylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.softwareupdate "{\"mode\": \"user\", \"flagUpdate\": true}"
# Toggle TPC or GSR in In-Start Service Menu (on 2020 and newer models), values of algo: tpc, gsr
bscpylgtvcommand 192.168.1.18 enable_tpc_or_gsr tpc false
# Set White Balance in Ez-Adjust Service Menu (on 2020 and newer models), values of color_temp: cool, medium, warm
bscpylgtvcommand 192.168.1.18 set_sm_white_balance warm 192 169 111
# Launch In-Start Service Menu (code: 0413) (using JSON)
bscpylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.factorywin "{\"id\":\"executeFactory\", \"irKey\":\"inStart\"}"
# Launch Ez-Adjust Service Menu (code: 0413) (using JSON)
bscpylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.factorywin "{\"id\":\"executeFactory\", \"irKey\":\"ezAdjust\"}"
# Enable full Service Menu on newer models
bscpylgtvcommand 192.168.1.18 set_settings other "{\"svcMenuFlag\": false}"
# Get config values of "tv.model" category (using list)
bscpylgtvcommand 192.168.1.18 get_configs "[\"tv.model.*\"]" true
# NOTE: this method does not work anymore on newer WebOS versions. Activate "OLED Motion Pro" on C9 (using JSON)
bscpylgtvcommand 192.168.1.18 set_configs "{\"tv.model.motionProMode\": \"OLED Motion Pro\"}"
# NOTE: this method does not work anymore on newer WebOS versions. Display Total Power On Time under TV Information on EU models where it's hidden (using JSON)
bscpylgtvcommand 192.168.1.18 set_configs "{\"tv.conti.supportUsedTime\": true}"
# Take screenshot
bscpylgtvcommand 192.168.1.18 take_screenshot
# Reboot the TV fully in case it is malfunctioning
bscpylgtvcommand 192.168.1.18 reboot
# NOTE: this method does not work anymore on newer WebOS versions. Soft reboot the TV in case it is malfunctioning: reboot_soft [webos_version] (e.g. for older WebOS: reboot_soft 4)
bscpylgtvcommand 192.168.1.18 reboot_soft
# Turn the TV off (standby)
bscpylgtvcommand 192.168.1.18 power_off

Multiple commands with arguments can also be passed to bscpylgtvcommand separated by ,:

bscpylgtvcommand 192.168.1.18 set_current_picture_mode expert2 , sleep 3 , set_settings picture "{\"backlight\": 34, \"contrast\": 85}"

Optional command line switches

# -s "[\"<state1>\", "\<state2>\"]" : set states ("software_info" static state is required by some of the calibration commands)
#    values: ["system_info", "software_info", "power", "current_app", "muted", "volume", "apps", "inputs", "sound_output", "picture_settings"]
bscpylgtvcommand 192.168.1.18 upload_3d_lut_bt2020_from_file expert1 "test3d-2.cube" -s
bscpylgtvcommand -s "[\"software_info\"]" 192.168.1.18 upload_3d_lut_bt2020_from_file expert1 "test3d-2.cube"
# -c "{\"lut3d\": \"33pt\", \"dovi\": \"2019\"}" : set calibration_info for unsupported chip types (be careful!)
#    values for "lut3d": "17pt", "33pt"
#    values for "dovi": "2018", "2019"
bscpylgtvcommand -c "{\"lut3d\": \"33pt\", \"dovi\": \"2019\"}" 192.168.1.18 upload_3d_lut_bt2020_from_file expert1 "test3d-2.cube"
# -o : getting hello info (e.g. to get unique deviceUUID)
bscpylgtvcommand -o 192.168.1.18 get_hello_info true
# -w : connecting without SSL
bscpylgtvcommand -w 192.168.1.18 button INFO
# -k <client_key> : specifying a client key
bscpylgtvcommand -k ef6858b2133d68854612831e3df8e495 192.168.1.18 button INFO
# -p <path_to_key_file> : specifying path to key file
bscpylgtvcommand -p "D:\config\.aiopylgtv.sqlite" 192.168.1.18 button INFO
# -m <path_to_manifest_file> : specifying path to manifest JSON file
bscpylgtvcommand -p "D:\config\manifest.json" 192.168.1.18 button INFO
# -l : get list of all saved client keys per ip (otionally from a specified key file)
bscpylgtvcommand -l
bscpylgtvcommand -l -p "D:\config\.aiopylgtv.sqlite"
# --timeout_connect <seconds> : set the connection timout in seconds (default: 2)
bscpylgtvcommand --timeout_connect 2 192.168.1.18 button INFO
# --connect_retry_attempts <attempts> : set the number of times the client tries to connect to host (default: 9)
bscpylgtvcommand --connect_retry_attempts 9 192.168.1.18 button INFO
# --connect_retry_interval_ms <milliseconds> : set the time in ms between connection retries (default: 200)
bscpylgtvcommand --connect_retry_interval_ms 200 192.168.1.18 button INFO
# --volume_step_delay_ms <milliseconds> : set the volume step delay in ms
bscpylgtvcommand --volume_step_delay_ms 200 192.168.1.18 volume_down
# -v : display version number
bscpylgtvcommand -v

Basic Scripting Example

import asyncio
from bscpylgtv import WebOsClient

async def runloop():
    client = await WebOsClient.create('192.168.1.18', ping_interval=None, states=[])
    await client.connect()
    apps = await client.get_apps_all()
    for app in apps:
        print(app)

    await client.disconnect()

asyncio.run(
View on GitHub
GitHub Stars299
CategoryDevelopment
Updated9d ago
Forks29

Languages

Roff

Security Score

95/100

Audited on Mar 25, 2026

No findings