Node Red + Home Assistant 2022: Beginner, Advanced and EXPERT Motion Detection and Notifications
ฝัง
- เผยแพร่เมื่อ 6 ก.ย. 2024
- Following up on my older Node RED videos, this video covers motion based lighting and actionable notifications using the Home Assistant node red addon. This is not intended to be a beginners video, if you've never used Node RED you should watch this video first: • Node Red for Beginners...
Follow me on Twitter: @TheHookUp1
Join me on Facebook: www.facebook.c...
Support my channel:
Patreon: / thehookup
Music by www.BenSound.com
8:43 Thanks to one of your regular viewers, this bug was reported to us yesterday and I fixed it last night. Will be in Node-RED 2.2.3/3.0 when they get released in the coming days.
Hey Nick! Thanks for all your amazing work with Node RED!
6:42 Is it expected behavior to not be able to access flow from the call services node? @nick
Hahaha great addition using the Linus footage 😂
Jeff Geerling has some nice PIR frustration grimaces too.
Loved this video. More beginner, advanced, expert nodered or homeassistant automations would be awesome. One thing I've been playing with is having a smart switch control light groups and brightness depending on time of day and would love to see your take on that.
I will second this. Itwould be amazing for an expert plus to say, turn on the lights in the hallway and bathroom to 30% between sunset and sunrise or time-based. Would be great for a night light for the kids when going to the toilet
Great video Rob!
I have the same flows with brightness resume etc, except my lights slowly fade over the course of 10 seconds instead of fading instantly to 50 % and then 0%.
I also have schedules for night and day as well as flow variables set by a trigger node when I MANUALLY turn the lights on and off, which I suggest as an expert plus level automation. Furthermore, I have conditions based on the state of the tv and the light in the room.
What this means is that when motion is detected in the dining room at night, my ligts only turn on at 5 % and fades to 0% after 10 seconds of inactivity. But if I manually turn on the light in the dining room, then the day scedule is used instead and the lights are only turned off after 20 mins of inactivity, etc...
In some rooms I only have motion sensors turning OFF the light and never on. But when the light is turned of by the motion sensor flow, it will turn on the lights again if motion is detected within 10 seconds.
You should post some of these somewhere
Could you please(!) export and dump these flows somewhere? I would love to import these new ideas into my setup. Thank you!
Thankfully I've been using NodeRed for perhaps 4 years now with Home Assistant so this video made a lot of sense.
I imagine people who haven't used it as much or at all will be watching this video about 15 times 😆 ...but there's loads of great content packed into 15 minutes. Good work Rob!
lol, I am big fan of Linus Tech Tip and seeing those mini-clips of his home automation snafu put a smile on my face. Thank you for doing an update of Node Red in Home Assistant. I see that I have a lot of automation to update :)
I'm 2 years deep into using Node-Red and I have never used the visual editor...WOW. This was super helpful!
I think it's fairly new.
Wow, this video is a master class in NodeRed automation setup! I used to use NodeRed for more things but have moved a lot to Home Assistant automations as those became more powerful, seeing this will definitely have me trying out new things in NodeRed first. Tracking state through time and allowing different triggers to interact with each other in NodeRed was always something I struggled with, I'd love to see more content digging into how to structure flows to accomplish tasks like this targeted at common home automation tasks.
Home assistant automations have come a long way in the last year. I have a lot of very complex automations using frigate detections and other inputs and have yet to find something I couldn’t accomplish in HA directly.
Either way good video about ways to create more sophisticated motion detection 👍
Can you give α few examples of your Frigate triggered automations?
I'm blown away by all my options. So far I have a houseful of Zwave Switches, Home Assistant in a VM, and Unifi Protect around the house.
I have some motion events in the main areas of the house, some LED indications for door lock status, and a Bedtime Scene that turns off every light in the house with one button. This Node-Red seems easier to implement than the HA automations, especially when I'm pulling in Unifi States and outputting to NTFY. I think I'm going to jump in with both feet.
I may not use those exact ideas, but your Node-Red videos ALWAYS end up teaching me new/better ways of doing things. I can't wait for the next one!
As an Expert++ option, I've added brightness settings in Home Assistant with a slider, to set the preferred brightness based on time of day. Then have Node Red read that preset value and use it to turn on the lights at the preferred percentage. I've also made the time-out configurable from the Home Assistant front-end. Those settings all go on a special settings dashboard in Home Assistant.
{
"brightness_pct":$number(
$entities("input_number.brightness_day_pct").state
)
}
The fact that you've used LTTs video on their light problem is awesome! Very nice.
But has he use those clips with LTT's knowledge and permission?
Fair use brotha
Thank you! Didn't know Node-Red could be connected to Home Assistant so easily! I find HA automations UI cumbersome to use and was considering moving everything into yaml-configurations. But this looks a lot easier and more intuitively to use than either!
Useful video. I hadn't used node RED before and this helped me get started. For the expert-plus idea, I've implemented my lights as a finite state machine, since there's a dedicated state machine node. I use this to switch my lights between normal mode, dimmed mode, resumed (woken from dim) mode, and tv mode. Waking from dimmed mode puts the lights back to the last saved state, but turning the lights on from off sets them to a specific colour temperature and brightness. The TV modes automatically set when the TV is turned on/off.
Your tutorials rock! They get right to the point which is exactly what I needed to get my motion sensors working in Node Red and HA. Been using HA for some time now and just started with node red.
This is excellent! Thank you :)
I've stopped using NodeRed with Home Assistant a few years ago because the integration was so crappy (I have many Home Assistant nodes so I was running against the 2048 device limit). But the Home Assistant automations are still rather messy and unorganized to setup. For many tasks you need multiple automations so I've got 3 automations for a single motion controlled light in some cases.
My "dream" light automation also includes switch trigger that turns that light permanently on. But if no motion is detected for extended period of time (1+h), turn that light off anyway. And maybe restore previous state if motion is detected again.
It should be easy, but I ran into several edge cases, where thing got messed up, so for now I play it safe...
Gotta say, these are some of my favorite types of videos from you. I haven't done much in the way of my utilizing my HA, but this really motivates me to give it a try since you've totally walked through each step in detail - including even showing how it would work with Unifi. Really loving the three level variants as well! Hope to see more videos like this in the future.
These were all very good exmples. HA addon really makes it easy to work in node red and use no function nodes and very few change nodes.
As someone who is considering Home Automation, I wonder how much time I will need to (1) learn (2) implement (3) maintain such system. Most often I see people comparing the time to implement HA with the time the automations save them in the long run, but this comparison doesn't seem to include the time needed to learn how to do all these (and keep learning, as they keep changing), and the time needed to maintain everything in perfectly working condition.
At the end of the day, it's about 2 things:
1. Enjoyment of a hobby. Some people just love to tinker. The learning IS the benefit, because it's fun and mentally simulation.
2. Skill building. There's an exponential effect at play. When you keep stacking skills on top of each other, the time you invest to do so makes you exponentially more empowered to do things quickly, easily and without relying on (and paying) other people. This is where, even if you don't have the "enjoyment of learning" part, you could still make a case for doing things like this. Eventually, there IS a net reward in terms of time saved.
While using the "For" field in the Entity State node keeps things compact, it does mean that the only thing that can reset that timeout is the node state itself. I still use Trigger nodes for my timeouts so that I can interrupt timeouts based on other actions. One place I use this is when you press a button in the bathroom to force the lights to stay on while you're in the shower (when you press the button, a Link node sends the message through a Change node that sets msg.reset and feeds that into the trigger.
The sprinkler integration alone is worth a Like... :)
Expert+ would be time (or ambient light) bases starting brightness levels or even color. So at night the pantry doesn't resume to the same brightness as it was during the day or if the kitchen lights are off you don't blind yourself walking into the pantry.
This isn't pantry limited, but would be very useful in a bathroom.
Yes! This is what I'm struggling with.
Also, I want to use default times in the living room (e.g. dinner time 17:30-19:00 (bright, timeout 30min), TV from 19:00-23:00 (not too bright, timeout 1h) and dim from 23:00-6:00(to not be blinded going to the bedroom, timeout 5min)).
However, I also want them to be overridable when we don't follow our default rhythm of the day: e.g. dinner is late or we go to bed early. And then back to default next morning. Up to now I was able to get it right 75% a couple of times, but always missing some of the described functionality.
I set up my original Node Red instances using your guides. Sounds like it is time for me to go back in and take a look at my instances and update them! Also agree - new series on Node Red Would be great!
For your expert plus mode; I've implemented the luminance sensor (built-in in the Hue motion sensor) to check if it's dark enough to actually turn on the lights. Takes some trial-and-error to get the right values for each room/sensor but when it works, it works like magic.
Where did you implement the condition? I want to do exactly the same but can't figure out where to put what :D
The debugging output looks really useful. I've recently added a Reolink camera (one with pet-detection AI) to my back yard to give me notifications of deer eating the landscaping - still have some plumbing to do but having access to the payload should make this a lot easier. Thanks Rob!
Thanks, I will be watching this a few times. I like the way node red - home assistant is linking up
Expert plus: using ESPresense as a condition. I have my motion lights use that as condition so if Iam still in the room with my phone it won't turn off. I'd love to see it in node red
Awesome, I have been using Node Red for years and didn’t know half of this.
6:35 You don't need the change node, you can use JSONata (The "J: expression" option) and do $flowContext("lightBrightness") and the rest is the same as JSON
Another great video rob! I've been using the trigger node for time based (mostly motion light control) since I started with node red a couple years ago. I've always wanted an easy way to change the time delay in a trigger node without having to open node red (mobile ui is rough) and finally figured it out. I used an input slider and some "expert" level node red tinkering to get it to work. I think that might be a good add-on to this video.
Rob, at this point you go so fast in these videos I'm not sure if your doing this so we can learn or just doing it to show us what you can do. 🤣
I did specifically move fast through the things that I've already covered before. Call services nodes with no properties don't need me to slow walk through them :)
@@TheHookUp I'm still a beginner🙂I'll have to catch up on some of your other videos. Looking forward to the doorbell reviews video.
Please! please! More vídeos like this with node-red simplicity 👏
Expert++ mode for your pantry lights....Personalization: put a camera at the door to detect the color of the shirt you are wearing and adjust the lights to that color....or facial recognition to set the color/brightness for each person based on time of day etc
One of my favorite shows, happy to watch this video and thanks for the upload...,.,.
Love the automation examples
Another great video Rob. Please, please do more Node-Red, they are my favourite videos.
Is there a way to do all this with scenes instead of lights? I want to be able to adjust a bunch of lights but not have all the lights changed. It would be nicer to control the scene lights rather than individually trying to adjust each output in node-red.
To understand the steps somewhat better, I've set the speed of this video to 0.75.
Hey Rob, great video once again. I love the TTS option for the doorbell, it's about the only thing I miss from my Nest Hello. Is the UniFi doorbell the only one that supports that? I haven't seen any others that expose the speaker as a media player.
Great video and very professional as always. Lots of info there, but glad you ran through it succinctly. I'm going to be pausing and rewinding this one. Great learning tool.
The only thing you could add is a sprinkler above the door. haha.
thanks for the great video, how to add a toggle button to set brightness to 100% and bypass the motion detection event while when toggle off will resume motion detection. Thanks
can you make a video on how to make heating smart?, like if a temperature detector senses its cold it turns on the heat, and once its warm it turns it off again. maybe even add a check if the window/door is open or not
Overall excellent, but one flaw (or I misunderstand something).
If the pantry lights are initially Off, then the value of flow.lightBrightness will be zero when the On path is triggered, so the lights won't come on. For this to work smoothly, you have to manually turn on the lights to your desired value, wait for the lights to timeout and turnoff (during which it'll capture the desired lightBrightness), and thereafter all will work. If I'm right, is there a way to initialise flow.lightBrightness on the very first run only?
You should try frigate for room presence .. it works wonders even with basic node red level as I am ;) ..
All in all I must say the advanced notifications is wicked and I need to try this out, always wanted to show images from my cams on my kitchen tablet when someone is at the FED!
Always love your videos rob especially node red ones - I always come away with a different idea on how to do something.. keep up the good work
I like the fact that you can access any state / attribute without those 'current state' nodes. You can address its specific location under global -- example: global.homeassistant.homeAssistant.states["sun.sun"].attributes.rising
currently the value for me is "false"
A list of all the entites can be found under the "context" tab (looks like a burger or database, right there by the debug tab)
then you can easily find your entity by going to your browsers find in page button (typically using the hotkey wont work since nodered has its own find function)
In a function node, you can access a flow variable value with flow.get('name_of_your_variable'). in a template node, you can access a flow variable value with {{{flow.name_of_your_variable}}}. Hope this helps
Just tested those out, unfortunately still no luck when calling them straight from the data field of the home assistant call services node.
Great video! Are there going to be more videos about Node Red + Home Assistant? I would love to see more!
Pro plus idea on the node red light be nice to have time of days lighting 100%. Or Ning but 1% at night.
Keep up the good work love it
Brilliant! It took less that 5 minutes before you had to resort to JSON coding to solve your problem using this no-code / low-code tool. 😢
Been waiting for something like this!
Thanks, Rob !
Thanks Ron!
Love it. Let’s get an updated one going!
Mate, you are absolutely awesome!!!
Love Your videos. Is there anyway to post a video on a tutorial that show us how to make a flow for motion triggered lights with a light on condition? I have lifx bulbs and want my family room motion to trigger my lights unless the lights are all ready on. Thank you
Great video! Thank you for keeping us updated. I was able to go and remove all of my high multi node flow with this simple one. How do you schedule the flow to occur only during a certain time of day (sat 7pm to 6am)?
This is great, and got it working, with one caveat. The textInput, nor the camera popup.
Android?
@@TheHookUp Yeah, Galaxy Z Fold 4
@@TheHookUp For the uri, I have the following:
"uri": "/lovelace/Garage-cam", but when it opens, it just opens the HA companion app, and not the actual dashboard with the camera.
The word on the street when I made this video was that camera popup was coming to android within 1-2 weeks, but it never happened.
@@TheHookUp Makes sense. Just for the record though, the pathing was correct, right? I saw others using /lovelace-dashboard/ as opposed to /lovelace
Guess I will wait to see if Android gets it up and running.
Thanks for the reply, and appreciate your content!
Thank you very much for this great Video!
I am looking for the following solution: Through Alexa I want to turn on, turn off and also control the brightness of my Hue lamps, as an example: Alexa, light bedroom 50%.
How can I map it in Node-RED and what panels do I need for this? I would be very grateful for a video for my request!
Really great video Rob. Thanks.
Can you please make a video showing how to set up a RPi running Hass. And then using Node-red to use the GPIO of the RPI? TY!
I use the switch input (central scene) to disable the motion sensor in my kitchen for when my wife is going to be in there for a long time, then re-enable it once the switch is turned off
Since the payload on the motion sensor is on or off you could connect them to a combined "turn on/off block" with the service turn_{{payload}}
Very true, although I would have had to use separate nodes anyways for the brightness calls.
super great video. i'd love to see more like this for other common automations! I think some for bed sensor automations... or some dealing with lights in the middle of the night (when you don't want to just crank lights on at full brightness but want to be able to let people override them to full brightness - i've been struggling with this one). Or maybe some cool automations with the robot vacuums! Thanks for the great video and the ideas!
Great video love the nodered tutorials and how nodered/HA has evolved. how about an update flow of lights turning off when you leave the turning back on with the same state when you return.
Wow man this was awesome! good job 👍
Great stuff Rob! HA automations are much better then they were a couple years ago, but I still prefer Node Red for it's graphical representations of the automations. I'm definitely going to create some actionable notifications over the weekend!
It seems like an arms race. Every time HA automations get easier to use Node RED gets more powerful.
Hello Rob, great tutorial video as always..question I’m using your first pantry demo on my staircase where I grouped 2 motion sensors and it works flawless, where and what node do I use to schedule the lights to motion trigger when it gets dark say from 6pm-7am or using lux thank you so much
Have been struggling with node-red coming over from hubitat/smartthings with webcore, finally at least got a light motion activated thanks to your video. But still a looong way to go until I can replicate my webcore automations. More Node Red videos!
Great Video, not sure if there is huge difference between using a light and a Switch in the lights on and off nodes, but i tried with philips hue motion detector and a lutron caseta switch to turn on closet lights when you walk in. the issue is the lights turn on when motion is triggered but will not turn off after 15secs or 30secs of no motion. I never get the waiting 15 seconds on the State changed node after motion was detected and the light turned on.
Awesome video! I for some reason can't get my doorbell feed to push to the notification. Amcrest AD410 using the Dahua integration.
Great video, very informative and learnt ways to simplify my current automations.
Excellent, more please.
Good info, but wow, you talk fast! I had to play this at .75 speed to keep it at a tempo where I could follow-along (yes, I'm new to HA and Node Red). Consider slowing down a bit, for all of us beginners that are trying to follow-along and learn from your expertise. I'm more than happy to sit thru a 30 minute video that doesn't rush the content vs a 15 min video at warp speed :-P
Thanks for sharing.
The problem that I get with the current brightness is that the lights will dim to 50% and then on the next movement will start from the last 50% and they keep diming on several movements until they go to 0% :)
how do I overcome this ?
How about if you have 2 motion sensors in the same room that have to control same light? So if motion is detected by any will do the same thing.
Depending on the time of day, you may not want your lights to come on at full brightness. From 1 AM to 6 AM, you might want the bathroom light to only come on at like 25% brightness.
Have you dabbled with presence sensors as an alternative to motion sensors?
why do you use events:states "off" instead of "on" your example? I tried to reverse this.. and it didn't work as i expected..
Hey Rob!! great video!! thanks for all your hard work!!!!! I have a few questions!! for some reason my action doesn't work from node red... I can create the automation on Home Assistant with category and they work.. but when I do it on node red I can't see the video on the push notification on my iPhone but the actions doesn't load.... any idea of what could be wrong? the other question... when I try the tts and I type my reply it doesn't work... I can heard the leave package or go away on the tts but no any custom reply... when I check on node red it said api error.. but don't know what is the error.. and I did it the same way you did.. even when and copy the path {"message":msg.payload.event.reply_text} to confirm it the same path as yours.. but doesn't work....
I just got te G4 door bell POE version.. when I see the live stream on home assistant it have super delay... do you have it too?
any assistant will be really appreciated!!!!!
It's still ridiculous how much effort it is to get basic hue-style sensor+room associations (inc dimming and sensor pairing)
These notifications are so much better on IOS - Android only gives a static image of the camera
Supper video! Any chance you would do a video on automating Shelly trvs through node red?
Great video, I am new to HA and Node-red,form Smartthings. How do I send notifacations to only 2 of my available devices? I seems silly to to 2 call services in line.
Great video! I just got started with HA and NR. How to enable the advanced properties? I did't found it to turn this feature on.
Is it possible to stream when doorbell is pressed to stream on google home device?
when trying to creat mine... in the call services domain nothing shows up to enter also the service
This is not working for me. I can get the message to fire with two actions, but no matter what I select, there is no event "heard" by the events:all node.
hi,, thanks for this great video. one quick question how to use or condition in node red? say if this ligh is on or other light is off do action
Not sure what I am doing wrong... no action buttons are appearing on my notification
The node red graphics looks so easy to 'mind map' configurations, however I've heard node red is for industrial/commercial use and Home Assistant is for residential use?
Nah, node red is the ultimate companion to home assistant. Node Red was originally for industrial automation, but it's matured significantly since then.
Great, thanks! I was hoping to use it as images make it easier. Thanks for your awesome videos and Happy New Year!@@TheHookUp
Rob great video,any recommendations for node red resources to learn more, I can replicate and modify things I see but am looking for more of a teach a man to fish.
how to do this if you have 2 motions sensors like in a staircase controlling the same light?
Please, can you review pinhole surveillance cameras. Thanks in advance.
This was an awesome update to node red. are there any updates with the one you did with presence detection when home/away?
Since video notifications is not supported on android , what change do i need to accomplish to work on android?
Another fantastic video
I have a tuya based contact sensor. I have the local key, id and the ip address for it, I am not able to add it to local tuya in homeassistant. Please guide how can I add it via .yaml configuration to local tuya.
Kindly guide.
He Rob,
I love your nodered examples and explanation.
Also your practical examples with notifications, lightning etc.
Unfortianaly you aren't making them often so my suggestion would be more nodered tutorials ;-)
One thing i'm running into is that i have your (old) motionbased lighting schema in use but i want to disable the motiondetector with my lightswitch.
This switch is connected to a shelly1PM (to see consumption) which switches the power to my 3 hue lights.
The idea is when i press the switch one time it goes on or off (depanding on the state it's in) and when i do a double press it should disable my motionsensor.
This untill the next double click or for a x time.
Advancing this would be that i could do a triple, four or more press to change different color setings.
Hoping you have a sollution or better more tutorials 😀