from Hacker News

Show HN: Makejinja: Automatically generate complex Home Assistant configurations

by mlenz on 2/3/23, 6:12 PM with 13 comments

makejinja can be used to automatically generate files from Jinja templates. This allows you to load variables from external files or create repeating patterns via loops. A very interesting use case for this tool is generating config files for Home Assistant: Using the same language that the built-in templates use, you can greatly simplify your configuration. When creating for example dashboards, it allows you to create a view for each room based on a single common template, dramatically reducing the maintenance overhead of complex dashboards. I originally developed this for my smarthome setup, but thought it may be useful for others as well!

A concrete example for Home Assistant can be found in the tests directory: https://github.com/mirkolenz/makejinja/blob/main/tests/data

For more information like detailed features or installation/usage instructions, please visit the GitHub repo.

  • by kkfx on 2/3/23, 7:14 PM

    I always ask myself anytime I have to deal with my HA or k8s stuff why the hell people want to shot themselves in the genitals with YAML crap instead of using a damn programming language for a damn personal config.
  • by MattDemers on 2/3/23, 7:27 PM

    Happy to see this, mostly because HomeAssistant stuff is nowhere near consumer-ready. I barely have the Docker knowledge to get it working in the first place on my NAS, and even just doing basic automations assumes you know much more coding/process stuff than the typical normie.