I just created my first Node-Red automation and while I got there I found it a bit trickier than I expected…
For some reason I expected all of the variables of a device to appear (similar to how they do in HA) in a list for me to just select, but the only way I could grab them was to use a debug node to output them - is this correct or have I missed something?
I then also found it tricky to identify which output node to use and just sort of guessed that the cover one was the option - is there a way to know this better?
Finally, out of interest, is there a way to do this in Home Assistant UI with just one item? It seems it would take three, but might be missing something as I’m new to the whole thing…
no, that is how to get details of events. Set the debug to complete message object for all attributes.
Trigger and event are most common. Trigger allows conditions, while the event state has a wait_for option. Then there are mqtt and other specialty nodes that can act as triggers.
There is also a new device node that has specific options for devices that are auto fill. Also the time node that paired with a datetime helper in ha allows you set specific times. There are also other triggers but these are some of the main ones.
Thanks - I’ve actually watched both of those but I didn’t find them too useful
They go straight into capturing motion but missed the simplest thing of ‘pressing a button’ - in fact, I couldn’t find a single guide that mentioned how to do that…
Once I got my head around the fact that I was waiting for a state change rather than a trigger it started making more sense, but nobody really stated that anywhere
I guess the Alpha “Device” action seems to work as I was expecting, but the warnings plastered over it made me steer clear!
EDIT:
One other question
Is there any way to add a folder structure under flows?
This seems to be something that both Node Red and HA automations is missing - you can’t organise your flows/automations which I imagine will get quite unwieldly later
No no folder structure under flows at this stage - just keep making more flows and then you can make subflows to try and help organise and structure things - but yes my Home Automation system that is all done in NR has about 50 flows in it now
Yeah don’t do that - use link nodes across flows or Context variables as appropriate as it quickly becomes complex to track down problems in a flow if you have multiple things happening on the same flow tab.
There is a also a dropbox backup node (check on the NR discord about this) that will backup all your flows on a daily basis - simple to setup and just does its thing in the background - well worth the effort if you are going to put a lot of time into NR)
Not sure what you are asking here - is there a way to find the right node or the service action ?
Typically if replacing an automation you go to the logbook and see what it is doing in terms of calls etc and then map out what you want to achieve
In the example automation you give above - not sure what is triggering it ? It seems to be a simple toggle of a light so if on - turn off etc ?
Step abck and explain how it fits in and then you can decide on the best way to do it.
I came from the NR side into Home Assistant as i found that HA had more devices being integrated and exposed on an ongoing basis - i still do all my processing in NR and all my logic flows etc as it just seems easier and smarter than templates and yaml - i typically use HA for display and device presentation (if not done natively in NR)
So I’m new to HA entirely (coming over from Homey) and I’ve already found that some of my simple flows are tricky to replicate in the HA UI but are pretty easy in Node Red, so I think I’m sticking with NR
The question above was asking (in the context of a blank slate) if
a) is call service the right node to be using in every “action” phase (i.e. turn on bulb / send notification etc - haven’t actually worked out the latter yet, but the former seems to work)
And if so
b) how do I easily identify the actions a available for a device - at the moment I’m sort of guessing with a bit of trial and error. In HA automations if I select the device it lists all the possible actions that can be taken, but NR doesn’t seem to and I have to guess the service - hence wondering if I’m doing something wrong
Edit. Here’s a good example - I’m trying to add Wake-on-Lan node - I know I can do this via wake_on_lan which is built in, but I can’t find the wake_on_lan or magic_packet under the call service node - should I be looking somewhere else?!
Edit2: Another question (almost certainly a newbie one) - how do i do an OR / ELSE?
I have many flows on a single tab. I use the group function from the hamburger menu on the right to create sections on the page.
I wouldn’t worry much about diagnosing problem flows, NR has a robust search function again in the right hamburger menu. You can easily find nodes by their name/number, it also uses a regex search for code inside a node.
Most of the time the call service will be your action. There are specialty cases like modbus out or mqtt out that NR can talk to directly rather than go through HA. At the same time you could use a call service to publish mqtt rather than the mqtt out.
In the example above the or/else would be the other output of the current state node.