Home

Awesome

<span align="center">

homebridge-webos-tv

HomeKit integration for LG webOS TVs how it's supposed to be

verified-by-homebridge homebridge-webos-tv mit-license follow-me-on-twitter join-discord

<!---[![Discord](https://img.shields.io/discord/725015107985473598.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/5c8njh)---> </span>

homebridge-webos-tv is a plugin for homebridge which allows you to control your LG webOS TV from your Home app! It should work with all TVs that support webOS2 and newer.
If you are already running a TV with native Homekit integration then you can still benefit from using this plugin with adding even more features and functionality to your TV.

Features

<!---* Adjust any system settings--->

Installation

If you are new to homebridge, please first read the homebridge documentation. If you are running on a Raspberry, you will find a tutorial in the homebridge wiki.

Install homebridge:

sudo npm install -g homebridge

Install homebridge-webos-tv:

sudo npm install -g homebridge-webos-tv

Configuration

Add the webostv platform in config.json in your home directory inside .homebridge.

Add your TV or multiply TVs in the devices or tvs array.

Example configuration:

{
  "platforms": [
    {
      "platform": "webostv",
      "devices": [
        {
          "name": "My webOS tv",
          "ip": "192.168.0.40",
          "mac": "ab:cd:ef:fe:dc:ba",
          "pollingInterval": 10,
          "volumeControl": "buttons",
          "channelControl": false,
          "mediaControl": false,
          "serviceMenuButton": true,
          "appButtons": [
            {
              "appId": "com.webos.app.livetv",
              "name": "Live TV"
            },
            {
              "appId": "com.webos.app.hdmi1",
              "name": "PS4"
            },
            {
              "appId": "youtube.leanback.v4",
              "name": "YouTube",
              "params": {
                "contentTarget": "https://www.youtube.com/tv?v=Bey4XXJAqS8"
              }
            }
          ],
          "channelButtons": [
            3,
            5,
            7
          ],
          "notificationButtons": [
            {
              "message": "Motion detected - living room",
              "name": "Living room motion",
              "appId": "com.webos.app.browser",
              "params": {
                "target": "https://www.google.com/"
              }
            },
            {
              "message": "Motion detected - kitchen",
              "name": "Kitchen motion"
            }
          ],
          "remoteControlButtons": [
            "HOME",
            "EXIT"
          ],
          "soundOutputButtons": [
            "tv_speaker",
            "external_optical",
            "headphone"
          ],
          "remoteSequenceButtons": [
            {
              "sequence": [
                "HOME",
                "RIGHT",
                "RIGHT",
                "RIGHT",
                "ENTER"
              ],
              "name": "screen_share_seq"
            },
            {
              "sequence": [
                "VOLUMEUP",
                "VOLUMEDOWN",
                "MUTE",
                "MUTE"
              ],
              "name": "volume_seq",
              "interval": 1000
            }
          ],
          "ccRemoteRemap": {
            "arrowup": "VOLUMEUP",
            "arrowdown": "VOLUMEDOWN",
            "arrowleft": "CHANNELDOWN",
            "arrowright": "CHANNELUP",
            "select": "PROGRAM",
            "back": "BACK",
            "playpause": "YELLOW",
            "information": "TELETEXT",
            "youtube.leanback.v4":{
              "information": "MUTE",
              "select": "HOME"
            }
          },
          "pictureModeButtons": [
            "eco",
            "game",
            "cinema"
          ],
          "soundModeButtons": [
            "standard",
            "music"
          ],
          "triggers": {
            "volume":{
              "threshold": 50,
              "name": "Volume above 50"
            },
            "backlight":{
              "threshold": 70
            }
          }
        }
      ]
    }
  ]
}

You also need to enable mobile TV on on your TV for the turn on feature to work correctly.

This is located on your TV under Settings > General > Mobile TV On

On newer TVs LG Connect Apps under the network settings needs to be enabled.

Adding the TV to the Home app

Since HomeKit expects only one TV per bridge they will be declared as external accessories and acts as a bridge.
This means that a TV will not appear in your Home app until you add it!

To add a TV to HomeKit follow this steps:

  1. Open the Home <img src="https://user-images.githubusercontent.com/3979615/78010622-4ea1d380-738e-11ea-8a17-e6a465eeec35.png" height="16.42px"> app on your device.
  2. Tap the Home tab, then tap <img src="https://user-images.githubusercontent.com/3979615/78010869-9aed1380-738e-11ea-9644-9f46b3633026.png" height="16.42px">.
  3. Tap Add Accessory, and select I Don't Have a Code or Cannot Scan.
  4. Select the tv accessory you want to pair.
  5. Enter the Homebridge PIN, this can be found under the QR code in Homebridge UI or your Homebridge logs, alternatively you can select Use Camera and scan the QR code again.

For more info check the homebridge wiki Connecting Homebridge To HomeKit.

Inputs

Inputs and apps are automatically fetched from your TV. As default only Live TV and basic external inputs (HDMI1, HDMI2, etc) are enabled in the "inputs spinner". To add more apps to the spinner simply go on the accessory configuration in the Home app and check all the inputs which you would like to have in the spinner.

Parameters

Platform Configuration fields

TV Configuration fields

<!--- - `systemSettingsButtons` [optional] [advanced] Whether the system settings buttons service is enabled. This allows to change any system settings on the TV. **Default: "" (disabled)** - Due to the complexity, not available in the homebridge ui configuration. For possible configuration values see below. - Set an array of objects as the value. An object can have the following properties: - *category* - [required] category e.g *picture*, - *settings* - [required] settings which should be applied, - *name* - [optional] the system settings button name - Not all picture modes might be available for all TVs. --->

Remote control values

Picture modes

Sound modes

<!--- #### System settings To set system settings you need to specify a category and an object of settings which you would like to set. Known categories with settings: `picture` ```js { "category": "picture", "name": "Set picture settings", "settings": { "adjustingLuminance": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "backlight": "80", "blackLevel": { "ntsc": "auto", "ntsc443": "auto", "pal": "auto", "pal60": "auto", "palm": "auto", "paln": "auto", "secam": "auto", "unknown": "auto" }, "brightness": "50", "color": "50", "colorFilter": "off", "colorGamut": "auto", "colorManagementColorSystem": "red", "colorManagementHueBlue": "0", "colorManagementHueCyan": "0", "colorManagementHueGreen": "0", "colorManagementHueMagenta": "0", "colorManagementHueRed": "0", "colorManagementHueYellow": "0", "colorManagementLuminanceBlue": "0", "colorManagementLuminanceCyan": "0", "colorManagementLuminanceGreen": "0", "colorManagementLuminanceMagenta": "0", "colorManagementLuminanceRed": "0", "colorManagementLuminanceYellow": "0", "colorManagementSaturationBlue": "0", "colorManagementSaturationCyan": "0", "colorManagementSaturationGreen": "0", "colorManagementSaturationMagenta": "0", "colorManagementSaturationRed": "0", "colorManagementSaturationYellow": "0", "colorTemperature": "0", "contrast": "80", "dynamicColor": "off", "dynamicContrast": "off", "edgeEnhancer": "on", "expertPattern": "off", "externalPqlDbType": "none", "gamma": "high2", "grassColor": "0", "hPosition": "0", "hSharpness": "10", "hSize": "0", "hdrDynamicToneMapping": "on", "hdrLevel": "medium", "localDimming": "medium", "motionEyeCare": "off", "motionPro": "off", "mpegNoiseReduction": "off", "noiseReduction": "off", "realCinema": "on", "sharpness": "10", "skinColor": "0", "skyColor": "0", "superResolution": "off", "tint": "0", "truMotionBlur": "10", "truMotionJudder": "0", "truMotionMode": "user", "vPosition": "0", "vSharpness": "10", "vSize": "0", "whiteBalanceApplyAllInputs": "off", "whiteBalanceBlue": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "whiteBalanceBlueGain": "0", "whiteBalanceBlueOffset": "0", "whiteBalanceCodeValue": "19", "whiteBalanceColorTemperature": "warm2", "whiteBalanceGreen": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "whiteBalanceGreenGain": "0", "whiteBalanceGreenOffset": "0", "whiteBalanceIre": "100", "whiteBalanceLuminance": "130", "whiteBalanceMethod": "2", "whiteBalancePattern": "outer", "whiteBalancePoint": "high", "whiteBalanceRed": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "whiteBalanceRedGain": "0", "whiteBalanceRedOffset": "0", "xvycc": "auto" } } ``` --->

CLI

The plugin also offers a command line interface to control your TV directly from the command line.
Just type webostv in the console to get a list of available options.

Troubleshooting

If you have any issues with the plugin or TV services then you can run homebridge in debug mode, which will provide some additional information. This might be useful for debugging issues.

Homebridge debug mode:

homebridge -D

Deep debug log, add the following to your config.json:

"deepDebugLog": true

This will enable additional extra log which might be helpful to debug all kind of issues. Just be aware that this will produce a lot of log information so it is recommended to use a service like https://pastebin.com/ when providing the log for inspection.

Fixes to known issues

‘Connecting to TV’ when adding the TV to HomeKit

Most probably the ports assigned to your tv accessory are not open in your firewall.

To fix that you need to first update the config.json with a fixed range of ports like this:

...
  "bridge": {
      "name": "Homebridge",
      "username": "**:**:**:**:**:**",
      "pin": "***-**-***",
      "port": 51283
  },
  "ports": {
      "start": 52100,
      "end": 52150
  },
...

After that make sure that the specified range of ports is open in your firewall to allow connections.

TV not visible when trying to add to HomeKit

When you try to add your TV to the HomeKit app but it is not visbile even when in the homebridge UI it appears, then it most probably is a homebridge cache issue.

Homebridge Config UI X

Go to Homebridge Settings and click on Unpair Bridges / Cameras / TVs / External Accessories and remove the TV from the list. After that try to add your TV to the HomeKit app.

HOOBS

Use the Reset Connection button and after that try to add your TV to the HomeKit app.

Special thanks

lgtv2 - the Node.js remote control module for LG WebOS smart TVs.

HAP-NodeJS & homebridge - for making this possible.