Hi there!
I experience a strange phenomenon while executing a for each loop in an automation.
I have the following yaml, which I want to use, for turning off the candles of my advent wreath (german: Adventskranz) via a script (which send IR codes to the candles):
repeat:
for_each:
- candle_1_off
- candle_2_off
- candle_3_off
- candle_4_off
sequence:
- action: notify.mobile_app_iphone_von_michi
metadata: {}
data:
message: "{{ repeat.item }}"
enabled: true
- action: script.ir_blaster
metadata: {}
data:
ir_blaster: esz_ir_blaster
command: "{{ repeat.item }}"
enabled: true
The action notify.mobile_app_iphone_von_michi is just for debugging purposes.
The variable repeat.item in the action script.ir_blaster is not passed correctly to the script. However, it works with the same syntax of "{{ repeat.item }}" in the notify action.
The botifications are always sent with the corresponding content from repeat.item:
When I manually set the value of command instead of using the variable, the script gets executed correctly and the IR command will be sent.
- action: script.ir_blaster
metadata: {}
data:
ir_blaster: esz_ir_blaster
command: "candle_1_off"
enabled: true
I also tried without quotation marks and with only single ones.
- action: script.ir_blaster
metadata: {}
data:
ir_blaster: esz_ir_blaster
command: {{ repeat.item }}
enabled: true
- action: script.ir_blaster
metadata: {}
data:
ir_blaster: esz_ir_blaster
command: '{{ repeat.item }}'
enabled: true
But neither of those worked either.
Does someone know why this is the case? I would appreciate any advice or tips.
