3 ms·
I've been playing with Home Assistant[0] recently and, as a result, getting exposed to YAML. I don't find it pleasant to work with at all. I'm sure a big part
by Mister_Snuggles 8y ago
I've been playing with Home Assistant[0] recently and, as a result, getting exposed to YAML. I don't find it pleasant to work with at all. I'm sure a big part of that is how Home Assistant uses YAML for automation stuff[1] that would probably be better served by a real programming language.
I think a big part of the unpleasantness comes from how non-obvious some things are. For example, why does the first automation example require a "-" in front of "platform" (under "trigger"), but the second doesn't? The comments explain when it's required, but not why? Shouldn't the parser be able to figure it out from the significant whitespace?
I found it so unpleasant that I'm using Node-RED[2] to do anything even vaguely automation related and have relegated Home Assistant to being the UI and communications abstraction layer.
In contrast, XML, while overly verbose, has a more reasonable structure. I haven't played with JSON much, but it also seems pretty reasonable.
[0] https://www.home-assistant.io/ https://www.home-assistant.io/
[1] https://www.home-assistant.io/docs/automation/examples/ https://www.home-assistant.io/docs/automation/examples/
[2] https://nodered.org/ https://nodered.org/
- IshKebab 8y agoI agree. This is my biggest issue with YAML - the syntax is just so weird and unintuitive. Compare arrays in YAML to JSON. YAML makes no sense. Then there is the significant whitespace, difficult to remember quoting rules, etc. I think the only reason it had gained any traction is because it is relatively easy to write multi-line strings in, so it is good for shell scripts, e.g. in CI configuration. Someone should really come up with a sane alternative that works well for that use case though.
- balloob 8y ago(Founder Home Assistant here) Everything that you can do in YAML + more, you can do in Home Assistant using Python. Have a look at my PyCon talk [1] from 2 years ago or check the available functions in the docs [2]. About the dashes. In Home Assistant when an option takes a list, you can omit the list if you are just passing in a single entry. [1]: https://youtu.be/Cfasc9EgbMU?t=1038 https://youtu.be/Cfasc9EgbMU?t=1038 [2]: https://dev-docs.home-assistant.io/en/master/api/event.html https://dev-docs.home-assistant.io/en/master/api/event.html