Did you cut and paste this from the automation manager ?
(Aparently) It doesn’t always display what’s really in the file so if we give you corrected code (AM code is considered weird anyway) then it ‘may’ change it when it actually writes to the file.
Thanks Mutt!
That solved it.
I pasted from automations.yaml within Configurator.
I tried to use the Automation Manager first but couldn’t get the delay to work there .
I really think that in order for HA to spread to the wider masses the Automation Manager interface must be much more developed. Really no help within MA regarding syntax and still some text needs to be entered. For instance i still don’t understand how i should have entered the delay in Automation Manager, tried all kinds of formats before I turned to the yaml file (and failed there as well…)
Will need to focus on learning the syntax from now on. (For instance, my script had a hyphen before entity_id but yours did not, still my script managed to turn on the light?)
There’s such great potential in HA but it won’t be more widely used until the user interface moves radically forward.
I don’t understand
Did you get it to work directly as is ?
Did you have to change anything ?
If so, what ?
The automation manager is only about 3 months old, every time I’ve used it, it has broken something. So never used it in anger.
I’ve just copied and adapted other people’s code, read the documents, experimented etc.
The automation manager has been created to allow newbies greater access with a shallower learning curve. I think it still has a loooonnnnng way to go.
If it solved your problem please mark the post that did it, this helps other users of the forum
Well, can I just say, I’m kinda surprised, I write my automations in packages where the indenting is slightly different, so though I modified my normal format to copy your base layer, I was just guessing at some of the rest (a fairly educated guess, but a guess nonetheless)
Glad you got it solved.
Now, a quick survey … Will this encourage you to use an editor (notepad++, atom, etc.), will you persist with the automation manager or will you try a bit of both.?
Note: as far as I could tell there was nothing wrong with what the automation manager gave you, but
a) obviously there was this time (did you mess with original AM code eg add an action with an editor or something?)
b) I admit a lack of familiarity with AM code, so it might have been miles off.
Funny you would mention notepad++, just downloaded it, been using it before for other scripts.
Will probably use a bit of both, perhaps start out in AM and then edit the code in notepad++.
What I did this time was pretty much as above, started out in AM and then edited in Configurator --> automation.yaml.
I’m also confused as to what the actual problem was, still trying to figure that out.
One thing you might help me with;
Using the AM gives you the option to toggle automations on and off, but if you write them directly in automation.yaml they won’t show up there, can they be turned on or off elsewhere?
There’s nothing wrong with the automation shown in the first post. There are no syntax errors nor logic errors.
I copy-pasted it into my automations file, changed the entity names to match what I have, then reloaded the automations. I opened the rear door and the family room light turned on and then, 5 seconds later, it turned off. The automation works perfectly as-is.
I also viewed the automation using the Automation Editor and it is displayed correctly. I used it to change the delay to 10 seconds, saved it, reloaded automations, repeated the test and it worked correctly. Nothing wrong with the automation or the Automation Editor.
Small point of order, it’s Automation Editor, not Automation Manager.
Automation Editor - got it, when I’m using it daily I’m sure it will stick
As I said to Niklas, it does ‘look’ okay, but he clearly had observed a problem, I don’t think he’d make up that the light didn’t go out, so the automation must have fallen over something around that point.
That’s irrelevant. In fact, in this automation the ‘hyphen’ isn’t even required (it has only one State Trigger). However, the Automation Editor tends to be verbose when creating YAML. For example, the automation doesn’t have a condition but the Editor includes one with an empty list:
condition: []
The Automation Editor also sorts the options alphabetically. That’s why entity appears first in your version. Mutt’s version puts platform first which is a popular convention. That’s why the hypen appears next to platform in Mutt’s version and next to entity in yours. The order of the options, within that specific section, is not important. However, the popular convention is to order them the way Mutt’s version shows it (platform first then the entity_id then other options). Ordering them alphabetically, the way the Automation Editor does, tends to make it harder to read understand.
Sorry, I don’t use these things so I don’t know why you got that impression, can you elucidate ? it may be significant feed back for the devs ?
It may be that the Automation EDITOR () only tracks automations it can edit or access or somesuch.
Automations created with the Automation Editor have an id option containing a unique value.
Automations created with a text editor typically won’t have an id option unless you add one. The automation will work with or without it.
Automations that lack the id option will be listed in the Automation Editor’s UI but cannot be edited using the Automation Editor (the pencil icon will be grayed-out).
As I recall I didn’t see an automation that I had created in the automation.yaml file there.
Not sure though, perhaps a reboot is required before it shows up there?
That’s a good point Taras, how would a newbie know to do that ?
I’m guessing here, that ‘maybe’ becuase the AE wrote the Automation, it knows it will pass the config check (doesn’t mean it’ll work, but that’s another matter) but maybe it runs a ‘Reload Automations’ on a save ???
That would be cleanest.
@Mutt, found Node Red, seems like the way to go for setting up automations easily.
Graphical interface and really well built.
Works great for me so far, guess you knew about it already but not using it for some reason?