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

Conditional execution of individual items in a script?

$
0
0

@quentinsf wrote:

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.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 99075

Trending Articles



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