I’m using a condition in a script to check if a light is on for X minutes. Default is 30;
- condition: state
entity_id: light.light1
state: on
for:
minutes: 30
Which works as expected. I am however looking for a solution to pass the minutes as variable, so I can call the script from multiple automations with different “minutes”.
Thanks for the reply @123 I was expecting it wouldn’t be possible this way, was hoping I was wrong… I solved it with some conditions at this moment as I only need to switch between 2 values (0 or 30). I would expect there are more elegant solutions for this case, but this was the first one on my mind (and it looks like it works after a short first test).
- condition: or
conditions:
- condition: template
value_template: "{{ minutes == 0 }}"
- condition: and
conditions:
- condition: template
value_template: "{{ minutes == 30 }}"
- condition: state
entity_id: light.light1
state: on
for:
minutes: 30