Trying to send notifications to an LG TV, need help with node.js


(Ed Moore) #1

Hi all,

Hope you don’t mind a question from a utterly clueless douchebag…

I’m trying to get SmartThings to be able to send text notifications to my LG C7 TV so a message will pop up saying “motion on driveway” etc.

The TV runs WebOS and as such supports a pretty decent set of network instructions including sending what they call a “toast” which appears on screen exactly as I want.

I followed the instructions at https://github.com/Danovadia/lgtv-http-server (install node.js; install lgtv package etc) and tweaked the index.js file to point correctly at my TV’s IP address.

I can now run a node command in my terminal locally that will pop up a message on the TV.

I’m a bit stuck though on how I should go about integrating this into SmartThings and my google-fu is failing me. It seems like I need to set up some sort of Node.js server and run the command via REST but I have no experience of this.

I have a Mac Mini server that’s running all the time so I have something to run Node on, it’s just figuring out how to trigger a command to it from SmartThings that’s confusing me.

Any suggestions for the clueless newbie much appreciated. Trying to search for specific simple information on Node.js is like holding a shot glass up to the Niagara Falls…


( I hate Mondays) #2

You need to create an http server in nodejs that accepts requests at some random port of your choice. Include that lgtv package, extract the message from the http request (say you’re using a post with a field message=text_goes_here) and pass it over to the lgtv package. Then use a SmartApp to send a HubAction to that IP and port where the nodejs is running. You can use CoRE or webCoRE to do that if you don’t want to write a SmartApp for it. I can help you out with some teamviewer tomorrow morning.


(Aesgarth) #3

Did you end up getting this working? I’m considering an LG tv in the near future and I’d like to be able to do this.


(Bartek) #4

You can use my fork of his branch

I cleaned a code a bit and added some improvements.

Checkout my code and run “node server.js”
After it run on port 5555 go to
Http://localhost:5555/description

And you will have a list of all API methods.

If you run it on Linux (raspberry pi) you also have there lg-tv.service" if you want run it on startup. Of course you need to modify it and instal. How to do it? Google it :wink:

When server runs fine for you through web browser you also have there a device handler for smartthings which you can (but don’t have to) modify to your needs if you want to call other API methods than what is already in handler. The handler simply calls http endpoint of you server so you have to set your IP adress and port in device settings, after you add it.


(Bartek) #5

Go for it. I bought oled b7 and it is really good TV for both watching and home automations. Magic remote is also great.

I also considered Phillips with Android TV but thanks God I haven’t bought it.


(Bartek) #6

Hey @ady624

Don’t write the server and handler from scratch but feel free to use my fork of code and modify if needed. Read comments above describing fast installation etc…


(Aesgarth) #7

Thanks @btrial , I already have a raspberry pi running as a makeshift Alexa, so i’ll try to get it running on that, once i make a final decision on which TV, and get it bought…