if for some reason Bill can’t/won’t make a patch available, it would be pretty easy to create a port forwarder if you have an intermediate system at your disposal. Something running a light-weight linux distro would be optimal, like an RPI or NAS, but any always-on system could be made to work. You would point THR to it, then it would forward the unfiltered packets to TCP 3001 on the TV.
This is going to require a patch. THR is using a fixed value of 3000.
No luck trying to port forward in my router or UniFi access points.
Will revert back to
PowerOn: Wake on Lan plug-in (working)
PowerOff: Global Cache (waiting on Amazon delivery)
Anyone able to interface webOS with Global Cache? Netflix?
Not sure how you set up your router / APs (I also use Ubiquiti products) but If the source and destination are on the same subnet, I think the traffic would go directly to the host vs through the firewall.
what you might try as a test is setting up a python script on a PC (or Mac, whichever you use) on the same segment to listen on port 3000 and then just forward to 3001 on your TV.
Here’s an example: GitHub - supernifty/port-forwarder: Simple Python scripts to listen, log and forward network traffic (I’ve not tried it myself; YMMV)
@LJR, thanks. Downloaded, installed python 3.11, script didn’t run (threw errors on ‘thread’ call). Turns out it is a Python 2 script. Installed python 2.7, got to run…no luck. While running the forwarder, I launched new instance of THR, new project, add device, “unable to connect to remote server”. Guess just need to wait until Bill is able to fix.
Well if you’re not against getting a little more creative with a solution that will give you A LOT of versatility, I just checked and Node Red has an integration module for LG TVs: node-red-contrib-lgtv (node) - Node-RED
I have been successfully using Node Red for years to overcome all sort of limitations/obstacles with THR and it has helped also to offload polling and state management from the THR client (with help from MQTT which THR supports very nicely).
If you are open to giving it a shot, reach out to me and let me know what features you would want support for. I can then help by writing a basic custom plugin that would talk to Node Red as the middle-man, or how to leverage MQTT in Node Red and THR.
I’m attaching a sample of how I integrated Node Red with my Bluesound Node.
Node Red - Bluesound.txt (7.1 KB)
@LJR, Ok, installed Node-Red, got up and running on my laptop. downloaded node-red package, tried to import the json file, no luck. throws a flag on import. “Input not a JSON Array”. I was able to import your Bluesound file.
What i’m looking for:
Power On (currently handling with a WOL plugin in THR)
Power Off (discrete)
Input Select:
HDMI2
Netflix
disney+
Paramount+
Hulu
etc.
Hopefully this gets you on track (this is not tested and my ability to troubleshoot will be limited, but perhaps others have a LG TV and could help on the plugin/Node Red development side.
- change extrnsion from .txt to .zip
- extract files
- Import .json flow
a) conflgure your TVOS device - use *.plugin in THR
a) be sure to supply correct IP of the system where Node Red is installed
LGTV_PoC.txt (1.6 KB)
got it. imports for both work. could you send me a simple. hrp file with a button for power on and one for power off. i should be able to take from there.
I have a brand new LG G3. Everything work,s fine, with the existing official plugin, except for Power on. I solved it, with codeset 1 from Global cachè tower, and then use IR for ON. I then think it will be possible to get a label, from the plug in. It will show when the TV is ON.
I have downloaded your POC and added the plugin. I updated the IP address both in the plugin and in the NodeRedTVOS. What TvosNodeRed.? Command should I use? MediaCommand? I tried TvosNodeRed.switch with value = On and it did not work.
Anything else should I do?
How did you get his plug in working? I changed the IP address and set up a mediaCommand. Could not get it to work.
I was unable to get the plug in working. I ended up going the global cache WF2SL route.
Solution link:
The only downside is that it operates at the serial command level, and not the webOS level. So no direct commands for say Netflix, or AmazonPrime.
For me the official LG smart TV plug in, by Bill, is now working totally. Both discrete ON and OFf, The trick was to turn on “ let mobile device be used as remote”. Actually I can also go directly to the apps. Netflix, Live TV and the other in the “List” command. I have a LG G3 2023.
Have you done any firmware updates? Which firmware are you running? Can you do a port scan?
If you type the tv IP into browser with port 3000, what does it return?
Http://:3000
I am not a programmer but I typed
192.168.50.151:3000 and got the response “Hi world” so I assume the port is open. When I did the same with :3001 it failed.
The firmware are 03.11.30
So I’ve found a work-around with the Hubitat.
Follow these instructions to add the LG WebOS TV to the hubitat:
dan-danache/hubitat
Make sure to enable “Simulate TV Remote” in the preferences (once the device is created), this will create a child device, but you wont need to do anything with it.
Add the hubitat (if you dont already have it), and if you do, syncronize. you need to add the LG WebOS TV device to the maker API to expose that device to the home remote. make sure you have Allow access via remote/cloud in the Maker API app in the Hubitat.
In that same window you’ll find the access token and the Hub ID (which is in the cloud URL)
Then in the Home Remote, click on the LG WebOS (the name you gave the device) and add “Command” to the Capabilities list.
Then add a button, EventTrigger, Action, Collection, DataSetter. Bind to LGWebOSDevice.Command
Value = ‘command’
From ChatGPT:
A) Every Maker API command your LG device exposes (ID 432)
No-parameter commands
Use the value exactly as shown:
onoffrefreshinitializemuteunmutevolumeUpvolumeDownchannelUpchannelDownplaypausestopscreenOnscreenOffscreenSaverOnscreenSaverOff-
take(snapshot / image capture) getAllActivitiesgetCurrentActivity
1-parameter commands
Format: commandName/PARAM
- Set volume (0–100):
setVolume/15 - Set channel:
setChannel/5 - Ping interval (minutes,
0disables):setPingInterval/5 - Sound output (one of the enums below):
setSoundOutput/external_arc - Start an activity/app (exact activity name or appId):
startActivity/Netflix - Open a web page (URL-encode the URL):
startWebPage/https%3A%2F%2Fexample.com - Play a video URL (URL-encode the URL):
startVideo/https%3A%2F%2Fexample.com%2Fvideo.mp4 - Speak text (URL-encode spaces etc.):
speak/Hello%20world
2-parameter commands
Device notification: deviceNotification/TEXT/TYPE
You can safely use Toast or Alert for TYPE (avoid the longer strings with spaces):
- Toast example:
deviceNotification/Hello%20there/Toast - Alert example:
deviceNotification/Important%21/Alert
5-parameter command (picture settings)
setPicture/BRIGHTNESS/CONTRAST/COLOR/BACKLIGHT/MODE
You can provide all 5, or just the first N params (Hubitat typically lets you omit trailing params):
- Brightness only:
setPicture/50 - Brightness + contrast:
setPicture/50/90 - Full example:
setPicture/50/95/55/88/sports
Picture modes:
cinema, eco, expert1, expert2, game, normal, photo, sports, technicolor, vivid, hdrEffect, filmMaker, hdrCinema
Sound outputs:
tv_speaker, external_arc, external_optical, bt_soundbar, mobile_phone, lineout, headphone, tv_speaker_bluetooth
B) Every “remote button” possible (via pushRemoteButtons/...)
How to send one button
pushRemoteButtons/BUTTON
Example:
pushRemoteButtons/HOME
How to send sequences + delays
Use spaces encoded as %20:
pushRemoteButtons/HOME%20WAIT:500%20RIGHT%20RIGHT%20ENTER
WAIT:xxx is milliseconds.
Full list of supported BUTTON names
You can use any of these inside pushRemoteButtons/...:
Directional / OK:
LEFT, RIGHT, UP, DOWN, ENTER
Navigation / system:
HOME, BACK, EXIT, MENU, QMENU, INFO, GUIDE, PROGRAM, INPUT_HUB, MYAPPS, RECENT, LISTPOWER, MUTE
Playback:
PLAY, PAUSE, STOP, REWIND, FASTFORWARD, RECORD
Channel / volume (remote-style buttons):
CHANNELUP, CHANNELDOWN, VOLUMEUP, VOLUMEDOWN
Color buttons:
RED, GREEN, YELLOW, BLUE
App buttons:
NETFLIX, AMAZON
Other:
ASTERISK, DASH, CC, AD, SAPASPECT_RATIO, SCREEN_REMOTELIVE_ZOOM, MAGNIFIER_ZOOMTELETEXT, TEXTOPTION- Digits:
0 1 2 3 4 5 6 7 8 9 3D_MODE
I’ll try and put together a sample .hrp file.
Working .hrp for latest version of LG WebOS.