Hey there!
I’m currently struggling with for loops within card arrays.
My goal would be to create three cards per room and group them together like so:
- Temperature Sensor Card
- Open Window Sensor Card
- Thermostat Card
Do make this as dynamic as possible I wanted to provide an array of room names ([‘bathroom’, ‘office’, ‘livingroom’]) and iterate over that like so:
cards:
- type: "grid"
columns: 2
cards: >-
{% for room in ['bad', 'buro'] %}
- type: "custom:button-card"
template: card_graph
entity: sensor.{{room}}_temperature
variables:
ulm_card_graph_entity: sensor.{{room}}_temperature
- type: "custom:button-card"
template: card_binary_sensor
entity: binary_sensor.{{room}}_open_window
- type: "custom:button-card"
template: card_thermostat
entity: climate.{{room}}
variables:
ulm_card_thermostat_enable_controls: true
ulm_card_thermostat_enable_popup: true
ulm_card_thermostat_preset_mode: true
{%- endfor %}
Sadly this won’t work out as excepted. The frontend just gives me an “Invalid configuration” error.
I couldn’t find any other solution so far so I would really appreciate some hints.
Thanks in advance and have a great weekend!
Max