What would the alternative be? What would you propose as a better solution to define and store user-configured automations and logic?
Let me answer this question: NodeRed.
I know a lot of HA users use that. I know that a lot of them donāt, sticking to yaml automations.
NR is ingenious in itās simplicity and easy to use at the same time.
And if you need something more than provided by NR nodes (ie do some math), you have JavaScript in hand. So it gives full-featured, popular, easy to learn, real programming language.
Moreover, NR gives access to a huge library of various functionalities, not available in HA. Some time ago I saw a node doing pretty complex stuff to control window blinds based on the Sun position, azimuth, time of a year etc.
You can build whole home automation based on NR alone , since it can even provide a basic gui.
I know there were similar discussions in the past. But I cannot understand till today, why it cannot be the main automation tool for HA.
Well you can use Node-RED in HA, the instalation is very simple and it was one of the first things Iāve installed to HA when I started. Initially I made most of my automations in Node-RED, but since then Iāve moved them to HA. The automations in HA became much easier to use over time and for me they are much easier to mantain now then by using Node-RED.
I still use Node-RED for my advanced climate controll which uses my AC units and gas boiler and has many conditions which are time and occupancy based. This has been working with little tweeks for two years and since it is complex and works Iām not moving it. I also use Node-RED for complex web scraping (like for train schedules).
So as Node-RED is a great tool, right now 99% of my over 100 automations in HA. The great thing about Home Assistant is that you can use external tools like Node-RED in it.
So as for this I do not want the HA automation system to be replaced by Node-RED, I would maybe like some more advanced visualsation of the automations but UI editing as is is fine for me. I do not have any programming experience, started some coding after using HA for over a year. Iāve actually had HA run on a VM in windows for some time before switching to a full install so I could learn and have some fun with it. I still have a second HA install on a another server to test things, because my main install is so advanced and a part of my house that I do not want to test things on it.
NodeRed is already available, so people are free to use it if they prefer it. I personally do not.
You can do a reasonable amount of maths using template sensors already, and sun azimuth/etc are available as attributes in HA already, so depending on the complexity of the automation it should be possible to create whatever was being done in NR.
Since NodeRed is already available, what should the core devs do? Removing all the functionality that already exists in Home Assistant and replacing it would be difficult and have massive backlash.
NR is available but is not encouraged to be used. the transition would take time.
But it would anyway in case of any alternative.
when I mentioned blind control node, the point was it was so complex as it would deserve separate integration in HA. for sure it cannot be mocked up with yaml and templates.
And with due respect, please do not even try to compare yaml/templates scripting abilities to NR. The latter is a different league.
Even basic math operations programmed in javascript look way simpler in javascript than yaml/jinja. Not speaking about more complex tasks.
Itās not that itās not encouraged, but itās not part of Home Assistant. You are still free to use it if it fits you better.
Again, you may prefer NR, but plenty of people do not. I have tried using it in the past and have found a lot more success with HA, what makes it a different league for you? Iām just curious if it really is a matter of the underlying paradigm being inherently better, or if itās just more functionality.
You say it would take time, but I think you are massively underestimating the difficulty of changing the core of Home Assistant, to something which not everybody wants, and only to provide functionality which already exists if you just use NR.
What do you mean by NR is not encouraged to be used? There is no message that you should not use it or any other warning. Also check out who is responsible for the node red add on in HA and for the HA itself, you might be suprised.
The same goes for things like zigbee, you can use the build in ZHA integration or Zigbee2MQTT, what is your preference. But at the end of the day both give you entities in HA which you can work with. I actually use both, because I have two seperate zigbee networks in my house. Once again the power of HA is that there is no limit to what you can use, you like NR - use it, you like HA automations use them or like me use both. Now you want to limit the choice to use just NR and that is not the way to go.
The fact is that Node Red is a viable (and in some cases superior) alternative to HA automation. There is no need to choose one over the other, or for HA to change to be more NR-alike?
And the data field?
Isnāt that JSON you need to type in that field?
Is that really better than yaml?
I would say if you canāt write a template then JSON is not better
But that takes programming skills, and syntaxes.
Something that has already been deemed outrageous.
Which is different from being discouraged, to make it very clear. This is an HA forum, yet itās welcoming towards other technologies, such as NR. Thereās even a forum label for it. The only thing Iāve seen people say is that HA automations has improved to an extent (in terms of capabilities) that you often donāt need NR. The NR UI is another matter and I get that many likes that. Iāve personally never used it. Iāve had some difficult automations to build, but it was difficult because of the logic I needed ā not because it wasnāt possible.
You guys missing the point. likely reading the most recent response without context (how usual).
One of the issues in this thread was related to to complexity of automaticing with use of yaml and jinja, which is kind of frankenstain in world of scripting/programming.
You asked for an alternative. I gave you one, I believe itās easier to learn, is more consistent, the code (if must be used) uses full-featured, popular, easy to learn and easy to read programming language.
It has been stated that yaml/jinja have no such properties. Itās not even programing nor scripting language at the end. And because of that (and together with the fact it lacks programming language abilities) is inefficient.
In both cases newcomer has to learn something. I believe, making your first automation using blocks in NR is easier than then writing it in yaml. And for more complex things one has to learn more, in bot cases. NR with JS still offers more, than yaml/jinja. Itās even not subjective. Itās a fact.
@Hellis81 not sure what data you are about. In all my automation are rarely need to create data. And yes, json is more clear, and less error-prone syntax-wise then yaml.
@parautenbach, the question was about ways and options for newcomers, how to to smoothly propose alternatives to yaml to newcomers. Encouraging using NR instead of yaml would be the way. Not discouraging means doing nothing to give them an option, thus most of them is forced to learn yaml. Itās quite logical.
Thats all. Take it or leave it.
I am aware of the context and think very much on point. I would also encourage you to consider whether the tone here is helping and if it encourages people to engage constructively, although itās easy to misinterpret when writing on a forum.
Sure, and this is already supported in Home Assistant and can be used by whoever prefers it. What would you suggest be done when this is already the case?
NR is easier than YAML, but in my opinion not easier than using the current HA UI. Sure, having JS is more powerful than only Jinja, but I still do not know what use cases it would actually solve that are not possible currently, especially for users who are not used to programming.
And thatās kind of an issue.
Because the way I interpret the above discussion is that there should be no need to learn anything.
The data field is very important when you not only want to turn on/off a light.
If you want to add transitions, color or send notifications then all of the sudden you are completely in the dark in NR.
There is no documentations at all for this. The only thing you can do is go to the yaml documentations and you some how (without syntax knowledge) should guess that yaml and JSON can be translated by adding a lot of extra characters.
Soā¦ Howās that going to work?
When I first set up HA, NR was recommended to me, it seemed quite ubiquitous at least in the local language forums I participated in. And let me tell you - I did not find NR easy at all. I found it slow and with little documentation explaining things from the HA perspective. I spent quite a lot of time learning it.
This was still when I was just testing HA. When I made a decision to stick to HA for all my home automation, and I set it up properly on its own hardware, I havenāt even installed Node Red.
So, you know, just because it was easier for you doesnāt mean it would be easier for everyone.
the question was about ways and options for newcomers, how to to smoothly propose alternatives to yaml to newcomers. Encouraging using NR instead of yaml would be the way.
I really think you should consider writing some guidelines about this, specifically aimed at newbies, if you believe thatās what they should be learning. Thereās a lack of beginner friendly materials out there (in general, not specific to NR).
Site admins and moderators arenāt necessarily Nabu Casa staff - most of us are volunteers
Oh, and some of us have even opened WTFs, because we have opinions on things that could be done better too. Just because we help out doesnāt mean we think everything is roses.
Why would a newcomer to HA write his first automation in yaml? There is a great UI tool for this and I have not made a single automation by writing in yaml, Iāve always used UI for it. Yes yaml writing is harder then NR, but NR is harder to learn then automation UI in Home Assistant.
And another thing your not considering, editing or making automations via the UI on a phone or a tablet is very easy, but try to edit your NR flow on mobile, it is a pain in the ass. Also the documentation and community help for HA is much better then for NR.
Yep. itās all true.
Especially about editing NR on mobile phone. Automation edit form is not great though. Itās illegible and clunky. But this is another story.
I assume it looks better on mobile devices, but I donāt do serious stuff on such devices.
This is what I mentioned by it's not encouraged
. If someone invests time to learn yaml, because NR is not properly documented for use with HA, Iām not surprised with what you are writing. I admit that the installation of NR for HA and the description of all those dependencies is not described in detail enough.
Kind of going in circles. One complaint newcomers have is that some of the things they need, including some very basic things commonly found on other platforms, are not available in the UI tool. Now you are saying new users should just use the UI tool.
YES! For me, absolutely it is! I understand that functionally theyāre the same thing, but from a practical perspective not needing to care about whitespace is great! The flipside though is that commas/brackets/braces kind of become the new whitespace and for a noob I canāt say that thatās any better.
I also prefer Node-Red and have zero automations left natively in Home Assistant (and understand that HA got a lot more capable in the last few years, but I have zero incentive to re-do hundreds of automations), but, yeah, I agree with the rest of your points ā¦ if someone canāt understand curly braces for a template, theyāre going to quickly hit the limitations of what the built in nodes of NR can do and then be upset by how they have to drop into javascript to do anythingā¢ in NR, so I donāt see it as a valid replacement (but absolutely do see it as a valid alternative).
I agree, but, your first automation in HA is going to be using its block equivalents rather than straight YAML, so I donāt really see this as much of a difference.
Agreed, when I get stuck in the weeds with NR, I am generally on my own and the examples I have to extrapolate out from are only kind of conceptually similar to what Iām trying to do. I would imagine that the people that canāt manage the built in HA stuff because itās too hard wouldnāt manage that any better and their potential resources for assistance is smaller.
-=-=-=-=-=-=-=-
I personally find the flow of NR to be easier and js is similar enough to C++ [that I have a high school class level familiarity with] and is BASIC-like enough that Iām able to make things work with it, but, js is not easier than YAML/jinja, itās just different in a way that I like better, but that doesnāt mean itād be better for everyone just starting out. It would also put the HA dev team dependent on a 3rd party that might break things at any moment or theyāll have to fork it and then keep up to date with updates. I think theyāre better off doing as they have been and improving the built in, but continuing to let us use 3rd party if we choose.
DO I have news for you! You can write the entirety of HAās config in JSON.
Yaml accepts both json, and yaml, and a mix of the 2. All 3 are valid yaml showing the same data structure:
yaml
some_random_yaml:
- x: 1
y: 2
json
some_random_yaml: [{"x":1, "y":2}]
some odd mix
some_random_yaml: [{x:1, y:2}]