data:
entity_id: switch.living_room_table_lamp_switch
service: switch.turn_off
alias: Living Room Floor Lamp Off PM
condition:
id: ‘1505695368764’
trigger:
at: ‘22:00’
platform: time
I tried to set up another in automation tool, but it will not save. There is no error message at top when I hit that icon. I am up for editing the automations.yaml manually, but my question is about the ID field above… Where does that come from? If I was adding another automation in the yaml file, would it need a different ID?
Valid values for weekday are mon, tue, wed, thu, fri, sat, sun. Time condition windows can span across the midnight threshold. In the example above, the condition window is from 3pm to 2am.
so I would have:
condition:
condition: time
weekday:
Mon
Tue
Wed
Thu
Fri
Sorry for the funky formatting, other than blockquote, what should I be using to maintain spaces.
And what is the purpose of ID the automation edit stuck in there?
It would really make sense if the automation editor is creating the automation in the same format as the docs. I look at the top post and see something I’m not used to seeing and assume it’s incorrect.
The new automation editor is confusing! I’m used to the old automation.yaml which let me edit in Notepad++ pretty well. Now if I have set up a new automation in the editor and want to add another automation to the .yaml it doesn’t work. Is it even possible to edit the yaml file?
I was also wondering why the new automation starts with ’ action’ while the old starts with ‘alias’.
When I see automation examples containing id’s, they are always in single quotes.
Don’t know whether they are really needed ore not.
The whole thing is totally confusing in my opinion.
In my Hassio installation the Editor generates 13-digit id’s like this in single quotes;
id: ‘1523635427469’
Some examples on github are selfwritten text ids without any quotes:
-id: a_alarm_triggered
Many config examples on github do not contain any id’s when separated in different files in a directory
The “alias” is sometimes within single quotes, double quotes or no quotes at all.
alias: “3D Printer Finish Off”
alias: Doorbell - Turn On Front Porch when Rung
alias: ‘Alarm Clock’
Unfortunately in the documentation to automations in Home assistant says noting about the id or usage of quotes.
But what they say::
“You have to set an initial state in your automations in order for Home Assistant to always enable them upon restart.”
automation:
- alias: Automation Name
initial_state: True
trigger:
On another page they recommend setting
initial_state: ‘off’
Seems that an automation entry can have the states true, false, “on” or “off”. ?!
Looking into examples on github, most of them do not set “initial_state”
but seem to work without this setting.
id is a text field, quotes don’t matter and are optional (and the length doesn’t matter). If you omit initial_state, it defaults to what ever it had when it shut down. ‘on’/True are treated the same in many fields, same as ‘off’/False.
It would be lovely if the automation docs could be fleshed out a bit. It doesn’t even cover the fields available or required like many of the others, and it seems automations is pretty important to folks. I’m here because the help itself was pretty unhelpful. I’d offer to update it, but I’d have to understand it first. I’d also humbly suggest that a ‘last updated date’ be included on the pages so it would be easier to determine what needs updating when. But perhaps you guys are using githup repo tools for that, don’t know.
I guess. maybe if you already understood how they work. But for the first-timer, there’s the section on “Exploring the internal state” which feels out of place and never really explains how any of that is to be used (nor links to other pages that might). As for attributes, at the bottom, alias is used, but there is not the usual entry for such in a list as on other pages. It made me wonder what other attributes there were. Same with initial_state, but at least I can infer it’s use and possible values from the text. Granted, ‘alias’ is pretty easy to guess, if one has looked at any other pages. Consistency is the issue for me, mostly.
The Triggers and Conditions pages provide good detail and plenty of examples, although the Actions page pales in comparison (IMHO). There are just so many possibilities with Actions, and only two examples. What about syntax for calling scripts, or using templates, etc., references to more details. I found myself at a loss as to what was even possible.
I’m not being critical, only passing along my struggles as a fairly technical person and retired career SW Engineer, but someone new to HA, YAML, Jinja, etc., trying to use this incredible platform. The more I know the more I can hopefully contribute one day. And I’m pretty much at this every day now.
actions don’t have documentation. Go to dev tools services tab to see all available services on your system. It will also list out all fields that are required or optional for the service data.
Also, all documentable services are covered in the scripts section. Because script services and automation actions are identical.
Thanks petro, I had been through all of that multiple times, but read the “action part follows the script syntax” as describing the format “if you were using a script”. But I now put together that a Script is just a series of actions, most if not all of which are listed in the Script Synatx page. Sorry to be so dense.