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.
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
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.
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:
For more info check the homebridge wiki Connecting Homebridge To HomeKit.
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.
platform
[required]
Should always be "webostv".devices
or tvs
[required]
A list of your TVs.
name
[required]
Name of your TV.ip
[required]
ip address of your TV.mac
[required]
Mac address of your TV.broadcastAdr
[optional]
If homebridge runs on a host with more than one network interface use this to specify the broadcast address.keyFile
[optional]
Specify a custom file path to store the permission token for the TV. If the file doesn't exist it'll be created. Don't specify a directory or you'll get an EISDIR
error. Default: "~/.homebridge/.webosTv/keyFile_xxx"prefsDir
[optional]
The directory where TV model info should be saved. Default: "~/.homebridge/.webosTv"pollingInterval
[optional]
The TV state background polling interval in seconds. Default: 5deepDebugLog
[optional]
Enables additional more detailed debug log. Useful when trying to figure out issues with the plugin. Default: falsesilentLog
[optional]
When enabled all log output will only appear in the debug mode. Default: falsehideTvService
[optional]
Whether to hide the TV service. This is recommended if your TV supports native HomeKit integration, since the TV accessory already exists. Default: false volumeLimit
[optional]
The max allowed volume which can be set using the TV. Range 1-100. Default: 100volumeControl
[optional]
Whether the volume control service is enabled. Default: "both"
channelControl
[optional]
Whether the channel control service is enabled. Default: truemediaControl
[optional]
Whether the media control service is enabled. Buttons: play, pause, stop, rewind, fast forward. Default: falsescreenControl
[optional]
Whether the screen control service is enabled. Shows a button which allows to turn on/off the TV screen, while the content is still playing. Default: falsescreenSaverControl
[optional]
Whether the screen saver control service is enabled. Shows a button which allows to instantly activate the screen saver on the TV. Can be used only when no content is playing on the TV. Default: falseserviceMenuButton
[optional]
Shows a buttons which when pressed opens the service menu on the TV. Default: falseezAdjustButton
[optional]
Shows a buttons which when pressed opens the ezAdjust menu on the TV. Default: falsebacklightControl
[optional]
Whether the backlight control service is enabled. Allows to control the backlight picture setting of the TV. Default: falsebrightnessControl
[optional]
Whether the brightness control service is enabled. Allows to control the brightness picture setting of the TV. Default: falsecolorControl
[optional]
Whether the color control service is enabled. Allows to control the color picture setting of the TV. Default: falsecontrastControl
[optional]
Whether the contrast control service is enabled. Allows to control the contrast picture setting of the TV. Default: falseccRemoteRemap
[optional]
Allows to remap the control center remote buttons. For possible values, see section below. Default: no remap
appButtons
[optional]
Dedicated app buttons which will appear for the TV. Can be used to trigger automations and can be controlled by Siri. Default: "" (disabled)
channelButtons
[optional]
Whether the channel buttons service is enabled. This allows to create buttons for the channels of your choice. This way you can quickly switch between favorite channels. Default: "" (disabled)
notificationButtons
[optional]
Whether the notification buttons service is enabled. This allows to create buttons which when pressed display the specified text on the TV screen in a toast. Useful for HomeKit automations or to display text on TV for viewers. Default: "" (disabled)
remoteControlButtons
[optional]
Whether the remote control buttons service is enabled. This allows to emulate remote control buttons. Default: "" (disabled)
remoteSequenceButtons
[optional]
Whether the remote sequence buttons service is enabled. This allows to run a sequence of remote control button presses. Default: "" (disabled)
remoteControlButtons
above,soundOutputButtons
[optional]
Whether the sound output buttons service is enabled. This allows to switch between sound outputs on the TV. Default: "" (disabled)
pictureModeButtons
[optional]
Whether the picture mode buttons service is enabled. This allows to switch between picture modes on the TV. Default: "" (disabled)
soundModeButtons
[optional]
Whether the sound mode buttons service is enabled. This allows to switch between sound modes on the TV. Default: "" (disabled)
triggers
[optional]
Whether the triggers service is enabled. This allows to create occupancy sensors which trigger when the specified threshold is reached. Default: "" (disabled)
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.
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.
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.
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.
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.
Use the Reset Connection
button and after that try to add your TV to the HomeKit app.
lgtv2 - the Node.js remote control module for LG WebOS smart TVs.
HAP-NodeJS & homebridge - for making this possible.