[RELEASE] LG webOS TV Driver (Oct 2024)

Hubitat Driver: LG webOS TV

Link to Code

Introduction

The LG webOS TV driver for Hubitat enables you to control your LG webOS television directly from your Hubitat smart home system. This driver supports a wide range of functionalities, allowing you to turn your TV on and off, adjust volume, change channels, and launch applications seamlessly. With this integration, you can create automated routines and enjoy a smarter entertainment experience.

Description

This driver provides the following capabilities:

  • Switch: Control the power state of the TV (on/off).
  • AudioVolume: Adjust and monitor the TV volume.
  • Media Input Source: Change the input source of the TV.
  • Refresh: Update the TV’s current status.
  • Actuator: Represents the TV as a controllable virtual device.
  • WOL: is built in and just works
  • No extra app or driver: no discovery or separate WOL app needed. just one clean driver that shows up when adding a virtual device

Attributes:

  • Channel: Displays the current channel.
  • Media Input Source: Shows the active input source.
  • Mute: Indicates whether the audio is muted.
  • Volume: Reports the current volume level.

Key Features:

  • Connects via WebSocket for real-time control.
  • Custom commands for launching apps and sending button presses.
  • Pairing key management for secure connections.
  • Debug logging for troubleshooting and monitoring.

Installation Instructions

Step 1: Prepare

  1. Enable External Device Control on your TV: Settings -> Devices -> External Devices -> Enable on with WiFi and On with Mobile
  2. Enable static IP and note IP/MAC addresses: Settings -> Network -> Connection (Wired/WiFi) -> Other network -> Advanced W-Fi Settings -> Edit (use the same ip and Mac address that you see before clicking "Edit" -> save. this will ensure your IP is static without needing to set it on your router. You can also just do this on your router if you know how to.

Step 2: Install the Driver

  1. Log into your Hubitat Dashboard.
  2. Navigate to Drivers Code under the Apps section.
  3. Click on New Driver.
  4. Copy the entire driver code provided above and paste it into the code editor.
  5. Click Save to create the driver.

Step 3: Add the Device

  1. Go to Devices in the Hubitat Dashboard.
  2. Click on Add Device. (virtual)
  3. Select LG webOS TV from the list of available drivers.
  4. Enter your TV’s IP address and MAC address when prompted.
  5. Set the following preferences:
  • Pairing Key: Leave this blank initially; it will be populated automatically after pairing.
  • Enable Debug Logging (optional): Useful for troubleshooting.
  1. Save

Step 4: Initialize the Device

  1. After pairing, navigate to the device page for your LG webOS TV.
  2. Click Initialize
  3. you should get a prompt on your tv asking you to allow control using the external device
  4. One you allow this, the pairing key should populate in Hubitat.
  5. Click save again

Step 4: Use Your TV with Hubitat

  • You can now control your LG webOS TV through the Hubitat dashboard or via automations.
  • Use commands to turn the TV on/off, adjust volume, change channels, and launch apps directly from your smart home setup.

If you experience any issues, enabling debug logging can provide insights for troubleshooting. Enjoy your enhanced home entertainment experience!

8 Likes

Well just tried this and nothing seems to work, just keeps giving same message in the logs over and over...

IP and MAC are good, LG Connect App is turned on on the TV. I never get any messages on screen so never got the pairing key.

Working for me
@mrferreira89 thank you

@mrferreira89, I'm having similar struggles as @nclark. I wonder if it is because I already used an older HE - LG webOS integration that has since stopped working, but can't figure out if the LGTV integration needs to be reset somehow? I'm not getting the on-screen confirmation request when configuring via this driver, though I have in the past with older, now defunct integrations. Also I never get the pairing key to populate automatically. My debug logs are same as @nclark's.

Also, the instructions in the OP, if I understand them correctly, seem inconsistent. Step 2, item 4 says to enter the IP and MAC. But then Step 3, Item 2 also says to enter the TV's IP and MAC. Can you clarify? Maybe I'm doing it wrong -- though I've tried every permutation I can think of. @JPV, what was your process?

@mluck
I just followed the steps as outlined... And it just worked
Pairing key populated immediately.

My only issue is
I can control the TV via this app ie turn the TV on and off
But..
The TV is not updating this app ie the TV has been turned on via tv remote but with this app it is in off mode and the opposite.. TV off via tv remote.. app is still on

Haven't investigated further..as my work is interfering

1 Like

hey did you enable mobile device control via wifi on your tv? also make sure to double check the Mac address and ip. finally, did you set a static ip on your router?

hey sorry for the instructions. I used chatgpt to write them lol. I'll clean them up after this reply. but I would say the same as I said to the other guy. make sure your tv is set to allow wifi devices to control it. and make sure to set a static ip. you can do this on your tv or on your router. either is fine.

thanks for this feedback. I didn't think to check that because I dont need current state for my use. but I will see if I can fix that sometime this weekend

I just checked - current state does not update when turned on/off using controller. I am not sure if there is a way for the tv to send that status to Hubitat but I can try and will keep you posted. it does however update current state if turned on/off via Hubitat.

can I ask what your use case is for current state status updating with remote control? just in case there might be a workaround

Yep my TVs are all setup to allow wifi and they all use a static ip, so I'm confused. Any other ideas?

fwiw the prior community integration that I believe is no longer working provided state updates to the driver so I assume it's possible -- or at least was possible lol.

If my wife has left the TV on, as she rushing to work.. I can remotely ( or based on presence) turn off as I do with the Denon amp

Yes it is...

Yes both MAC and IP confirmed right by checking on the TV AND the router and yes it is a reserved IP as all my IOT devices are.

I tried other integrations and none ever worked, I guess I'll need to try and see if I can even use an app on my phone first of all and then try this integration again.


I have also noticed..its very chatty
Not sure how to turn off the debug in this app

@mrferreira89, my situation is exactly the same as @nclark. With one exception, The old integration from @asj worked for me--until it didn't.

I can control my TV via LG's apps, and I can control my LGTV's from Home Assistant's integration, which makes this even more perplexing.

Wonder if it's a webOS firmware issue? Should we trade version info?

I'll check that out tonight after work.

even if the state is off while the tv is actually on; pressing the off button in Hubitat will still send the command to turn the tv off regardless of the state. I suppose the state is useful if you are building if statements. but. let me know if that is helpful to know

could be! not sure if this matters but I have internet access disabled on my router for the tv. it can access local only. I don't want any automatic updates breaking the integration. I also made sure to update to latest version before installing this

I'm on 03.40.82 if that is helpful

What version of webOS are you on now?

I’m on 03.40.82