YAML Coding

I’m trying to code in YAML for new automations. Is there a “YAML for Dummies” reference book (or link)? I know C#, Linux/Unix scripting, SQL, etc. but YAML is different and MUST conform to alignment(?).

Try Chat GPT.

Plenty on google. What also works is making the automations with the GUI and then switch to YAML editor to see how it is done.

3 Likes

huge +1 to @fleskefjes … especially if you know how to code already, just use the gui to teach you and look up references for specific things you can’t do in the gui.

sorry but -1 on chatgpt for beginning learning. chatgpt has a lot of ai hallucinations that really trip people up. we spend a decent amount of cycles here correcting mistakes where chatgpt has led someone astray. it’s not that chatgpt isn’t useful (i have and do use it myself once in a while) but i know to check for ai hallucinations.

3 Likes

http://thomasloven.com/blog/2018/08/YAML-For-Nonprogrammers/

Wow! Thank you.

Yep. That’s what I do but the conditions coding in the GUI is so convoluted and complex. I just create a shell in GUI, save it then go to YAML. But the if/then, and/or, date/time, mathematical calculations/equations in YAML are unknown to me yet. So thanks to all for your suggestions.

well… good or bad, most of the yaml tutorials and “for dummy guides” are gonna fall short. you see, yaml doen’t inherently have if/ten, date/time, etc.

looking at the question you posted recently about sending notifications on the 15th of the month on selected monthes, the answer wasn’t a lack of yaml knowledge… it was a lack of home assistant’s capabilities on top of yaml, combined with some jinja2 knowledge (home assistant uses jinja for templating… yaml != jinja).

if there’s a “how to guide” to read, it may be more interesting for you to read a jinja for dummies than a yaml for dummies.

on the flip side… the fact that you’re asking for documentation to read to learn is awesome… you’re in perhaps 0.01% of the population :slight_smile:

2 Likes

If someone asked you to write a screenplay in English, the resulting document’s structure and terminology would follow the unique rules of composing a screenplay. Merely learning the English language would be insufficient to know how to write a screenplay.

In a similar manner, Home Assistant uses YAML for composing automations (and other things). If/then/choose/repeat/etc aren’t inherent to YAML but are unique to Home Assistant’s use of YAML for its own purposes. Merely learning YAML would be insufficient to know how to write a Home Assistant automation.

The “calculations/equations” are not YAML at all, they’re Jinja.

In other words, Home Assistant’s scripting language is an amalgamation of two existing languages.

1 Like

I got you. I hereby request to close this thread. Thanks to all.

This is terrible advice for a beginner. They will not be able to spot hallucinations, and they happen often when asking questions related to HA configuration. Also the model was trained on a very old version of HA.

This will lead to nothing but a great deal of frustration.

2 Likes

Pick the answer that helped you most and select the “solved” icon under that post.

Screenshot 2024-04-02 at 20-05-12 YAML Coding - Configuration - Home Assistant Community

EDIT: also you may find this reference helpful: The Home Assistant Cookbook - Index

1 Like

For a few seconds, I had that honor but then fate smiled on your post. :slightly_smiling_face:

Screenshot_20240402-110957~2

1 Like