So I wanted to cover today a topic that I’ve briefly touched on in previous articles and that is notifications through LG’s WebOS. Home-Assistant has an integration that allows us to communicate directly with LG TVs (at least the most recent ones anyway) and it’s awesome. Aside from the usual control like input switching and volume / standby etc, LG’s also have the ability to accept and display notifications. These I find really useful. Let’s face it, most of us watch a lot of TV, and so displaying notifications briefly and directly on the screen can serve us well. I will list a couple of useful ways we can use the notifications, and then I’ll walk you through the set up and execution. As always, the components are set up in Home-Assistant, but the heavy lifting is done in N0de-red.
Let’s get started with a list of useful notification types that we can create and use:
- Notification if a sensor’s state is changed. For example, if my Xiaomi zigbee contact sensor is triggered (i.e. a door or window is opened) – the TV responds with the following notifications “The (insert the name i.e. ‘back door’) has been opened.” The notification appears in the top right and disappears after a few seconds. Normally, after a certain time of the evening, I might well trigger a voice assistant also, but if you have very young children, or don’t want alexa or google blasting through the house, then this could be a potentially better option. Also if you have a home theatre, maybe you wouldn’t be able to hear or don’t own a voice assistant anyway. This is a decent alternative.
- I’ve already covered how much I like gaming with this most recent post. If it’s getting late but I’m tempted to sly off and try and get a few quiet rounds of call of duty with the boys, maybe I don’t want Alexa or Google ratting me out. Maybe a nice quiet 2 second pop up on the screen is exactly what’s necessary. i.e. “SteamID / Clan Warrior is online and playing “insert game” (you can get the game sensor from steam also).
- Maybe your children’s favourite Twitch streamer has just gone live and you’d like to watch them instead of reruns of a soap opera.
- Perhaps it’s nearing the kids’ bedtime and the internet is about to be cut from their rooms (doable in pfSense!) or the smart plug their bedroom TV sits on is about to have the power turned off. Maybe you want to give them a notification at 15minutes and 2minutes before on a school night that they have 15/2minutes left respectively. This can be set up on a daily weekday trigger very easily.
- Speaking of triggers. Perhaps you’d like a reminder 5 minutes before your favourite TV show is being broadcast. Again, you can send this to any LG tv in the house as well as a phone. I would use the Bigtimer node for the timing trigger, and this notification component.
The list goes on and on. My point is this can be really cool and useful, and super simple to set up once you have the component installed. I’ll show you how to set this up.
Firstly, give your TV internet access, whether this is wireless or wired, and give it a static IP address (usually best to do this at the router side and reserve a dhcp address). Ideally, get the TV on it’s own network (via VLANs). My reasoning for this is that some of the applications on the new smart TVs are ridiculous for the amount of connections they’re trying to make to god knows where, and some of the applications are, well, crap. By putting them on a separate network or VLAN you can control where they speak back to, as well as helping to keep them separate from your main LAN and your computers where all the valuable data sits.
Secondly, we look in home-assistant and we head over to the integrations page and search for the LG Web OS integration.
We have to add the following in our configuration.yaml page:
In node-red we’re going to go with a simple notification based off a manual inject node just to test everything’s working as it should be.
Two things to point out here
1) I added the if state is “on” – On my sensor that is when you pull the contacts apart.
2) You need to wire the notification to the top option on the state change node – if you hover over it, it shows ‘true’ (i.e. the condition of ‘on’ has been meant). If you want to wire a notification to the bottom part, when the contacts are closed, it can tell you something else. For this example I didn’t bother.
So everything works. This is the most simplest use for this component.
How about a notification that tells you the temperature of the room? How would that be triggered? I’ll show you the formatting side of things for the message, but it’s up to you to think about how you would trigger it (At a set time? When the temperature falls out of a certain range? When you ask Alexa what the temperature is?). Let me know in the comments how you would do it.
Firstly the flow:
The inject node figures the Get State Node (Office Temperature). I am using my Xiaomi Aqara Temperature/Pressure/Humidity sensor I’ve already covered throughout my blog. You would change the inject node to a trigger of your choice.
The notification gets a little trickier here, as we need to pass through the actual result from the node we’ve just configured previously.
And the result:
I thought i would show you a slightly more advanced flow. I wont go into details and i’ve annotated the flow already, but in essence you can see from the debug window that I am manually showing what the flow results could be for internet speed by injecting various values into the flow on the left. I also trigger my actual internet speed to enter into the flow also. Only when the internet speed is 60 or below, do I get an alert to the LG tv about the download speed.
I could trigger this to run continually every X minutes or hours, or i could trigger this by asking Alexa what the download speed is etc.
I just want to show you what can be done, and how you can go about physically coding the messages accordingly. If you’d like more details on that last one or anything else I’ve covered, let me know in the comments.
If you find these tutorials useful, please consider giving my page a like on facebook where you can then see whenever a new tutorial is posted. The page can be found here: https://www.facebook.com/thesmarthomebook/
Nice writeup. Just implemented. Thanks
Glad it worked out!