As I said, NodeRED is not for me, I personally find it to complicated. In my case an automation does the job. But thatās me, everybody has to find itās own method to work with HA.
The brackets is templating. Home Assistant uses Jinja 2 pretty much everywhere so thatās what youāre seeing there. The Jinja engine processes strings like that and anything which isnāt in brackets is just treated as plain old text. Anything in brackets is processed as detailed their in their docs. Home Assistant also has a guide specifically on templating within HA here.
Node RED does something similar btw. It seems like you are dropping into function nodes a lot which is fine but often just ends up requiring a lot more coding work on your part. You can accomplish quite a lot without function nodes at all by combining other nodes into flows and leveraging jsonata for small bits of processing. That is the templating engine Node RED has chosen. Itās quite powerful but not as approachable as Jinja in my opinion, thereās a bit too many āunique to jsonataā operators. But you can do a lot with a little if you take the time to go through their docs and the built in tester for jsonata expressions is fantastic.
Patrick just listed out above most of the other docs I was going to link for explaining the trigger object in such in Home Assistant so I wonāt repeat.
For the node red side I could link docs but for now Iāll just say the debug node should be your best friend. You can drop it in and attach it at literally any point in your flow and print out the entire message object as Node RED sees it. That is more helpful then any documentation for figuring out what you can work with at that point. And then you can can copy that json into an Inject node and make isolated test cases until things work the way you want to.
This functionality of being able to isolate, test and iterate on small pieces of a large complex automation is probably the single reason I do most of my automation in Node RED. That and its easier to see the big picture when you have a piece of functionality that spans multiple automations/scripts since you can organize all of them into one flow/tab.
Thank you all for the great links. I have started reading them and will try to learn a bit more about the syntax used.
I do like the idea of being able to write the code rather than relying on the abilities of a UI. I do the same for other languages, but jinja and json are not mine (yet ).
By the way, I tried
message: "Shelly {{ state_attr('trigger.entity_id', 'friendly_name') }} seems to have a problem."
So, I have to say I like the idea of direclty using code rather than Node Red. It seems more straight forward.
I will be opening a new thread about automations looking for some help with my syntax. I am a bit āstuckā with my code right now. HA isnāt accepting it and hence not saving it as automation.
I have opened a new thread here in the forum Syntax questions for automations
I have to say, I feel much more comfortable ācodingā it myself even though I am still learning about the correct syntax. So much easier in other languages