Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95437

Using Jinja to create multiple sensors & shorten config files

$
0
0

@Vlavonvidden wrote:

Hi all,

I’m currently looking for a way to clean some of my config files which are pretty cluttered.
I thought of using jinja to create multiple elements at once, using a syntax like this :

{% set containers = [0, 1, 2, 3, 4] %}
shell_command:
 {% for container in containers %}
   - restart_{{container}}: 'curl http://127.0.0.1:8126/container/home-assistant/restart'
 {% endfor %}

Obviously, since I’m writing this, it’s not working and I haven’t found a solution for now.

Would you know if what I’m trying to achieve is possible, or is it some alternative that could help me achieve something similar ?

Cheers !

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95437

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>