In scripts, you can add tests for conditions. If the condition fails, the script stops. But I think that’s the only kind of condition test allowed?
I was wondering how easy it would be to allow individual items in a script sequence to have a condition added? Ansible scripts do this with a ‘when’ clause – in HA I guess this might look like:
script:
example_script:
sequence:
- service: do_something
- service: light.turn_on
data:
entity_id: light.ceiling
when: "{{ sensor.room_brightness < 128 }}"
- service: do_something_else
I haven’t looked at the code – it may be that this would be tricky for some reason – but it does feel as if the current condition tests are a bit limited.