Code Monkey home page Code Monkey logo

lgwebosremote's Introduction

LGWebOSRemote

Command line webOS remote for LGTVs. This tool uses a connection via websockets to port 3000 on newer LG TVs, there are other tools which use a restful connection to port 8080 however that port is closed on newer firmware versions.

Supported models

Tested with

  • 43LM6300PSB
  • 43UN73003LC
  • HU80KG.AEU (CineBeam 4K)
  • OLED55B7
  • OLED55C9
  • OLED55CX5LB
  • OLED55CXAUA
  • OLED65B9PUA
  • SK8500PLA
  • SM9010PLA
  • UF776V
  • UF830V
  • UH650V
  • UJ6309
  • UJ635V
  • UJ6570
  • [please add more!]

Tested with python 2.7 on mac/linux and works fine, your mileage may vary with windows, patches welcome. Tested with python 3.9 on Debian Unstable.

Likely supports

All devices with firmware major version 4, product name "webOSTV 2.0"

Available Commands

lgtv scan
lgtv auth <host> MyTV
lgtv MyTV audioStatus
lgtv MyTV audioVolume
lgtv MyTV closeApp <appid>
lgtv MyTV execute <command>
lgtv MyTV getCursorSocket
lgtv MyTV getForegroundAppInfo
lgtv MyTV getPictureSettings
lgtv MyTV getPowerState
lgtv MyTV getSoundOutput
lgtv MyTV getSystemInfo
lgtv MyTV getTVChannel
lgtv MyTV input3DOff
lgtv MyTV input3DOn
lgtv MyTV inputChannelDown
lgtv MyTV inputChannelUp
lgtv MyTV inputMediaFastForward
lgtv MyTV inputMediaPause
lgtv MyTV inputMediaPlay
lgtv MyTV inputMediaRewind
lgtv MyTV inputMediaStop
lgtv MyTV listApps
lgtv MyTV listLaunchPoints
lgtv MyTV listChannels
lgtv MyTV listInputs
lgtv MyTV listServices
lgtv MyTV mute <true|false>
lgtv MyTV notification <message>
lgtv MyTV notificationWithIcon <message> <url>
lgtv MyTV off
lgtv MyTV on
lgtv MyTV openAppWithPayload <payload>
lgtv MyTV openBrowserAt <url>
lgtv MyTV openYoutubeId <videoid>
lgtv MyTV openYoutubeURL <url>
lgtv MyTV serialise
lgtv MyTV setInput <input_id>
lgtv MyTV setSoundOutput <tv_speaker|external_optical|external_arc|external_speaker|lineout|headphone|tv_external_speaker|tv_speaker_headphone|bt_soundbar>
lgtv MyTV screenOff
lgtv MyTV screenOn
lgtv MyTV setTVChannel <channelId>
lgtv MyTV setVolume <level>
lgtv MyTV startApp <appid>
lgtv MyTV swInfo
lgtv MyTV volumeDown
lgtv MyTV volumeUp

Install

Requires wakeonlan, websocket for python (python3-websocket for python3), and iproute2. python-pip (python3-pip for python3) and git are required for the installation process.

python -m venv lgtv-venv
source lgtv-venv/bin/activate
pip install git+https://github.com/klattimer/LGWebOSRemote

To install it system wide:

sudo mkdir -p /opt
sudo python -m venv /opt/lgtv-venv
source /opt/lgtv-venv/bin/activate
sudo pip install git+https://github.com/klattimer/LGWebOSRemote

Example usage

# Scan/Authenticate
$ lgtv scan
{
    "count": 1,
    "list": [
        {
            "address": "192.168.1.31",
            "model": "UF830V",
            "uuid": "10f34f86-0664-f223-4b8f-d16a772d9baf"
        }
    ],
    "result": "ok"
}
$ lgtv auth 192.168.1.31 MyTV
# At this point the TV will request pairing, follow the instructions on screen

# Commands are basically
#$ lgtv TVNAME COMMAND COMMAND ARGS

$ lgtv MyTV on
$ lgtv MyTV off

# If you have the youtube plugin
$ lgtv MyTV openYoutubeURL https://www.youtube.com/watch?v=dQw4w9WgXcQ

# Otherwise, this works reasonably well
$ lgtv MyTV openBrowserAt https://www.youtube.com/tv#/watch?v=dQw4w9WgXcQ

Caveats

You need to auth with the TV before being able to use the on command as it requires the mac address.

TODO

Implement the following features:

closeToast
createAlert
closeAlert
getSystemSettings

Bugs

I couldn't test youtube because it seems the app isn't installed and not available to download right now maybe they're updating it?

lgwebosremote's People

Contributors

klattimer avatar jjc1138 avatar keyofblues avatar darkceptor44 avatar gustry avatar c0rn3j avatar balcsida avatar nopdotcom avatar chron0 avatar eudes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.