Scripts - Action if a condition is not met

If I have a script with a conditional line item, typically the script just stops if the condition is not met in accordance with this:

Is there a way to run a different action if a condition is not met? For example, if condition is not met, then a notification is sent instead of continuing on with the script.

This is my workaround on my home built garage door opener:

  • service: script.garage_alarm_check
  • condition: state
    entity_id: input_boolean.mode_armed
    state: ‘off’

I call a second script which checks to see if input_boolean.mode_armed is ON, and if so, sends a notification.
Then the main script checks the condition of the same input_boolean, but checks to see if its OFF so that it stops if not met (and a notification was already sent in the second script).

This works fine, just wondering if there is a way to simplify it.

If I understand you right, then there are two ways to achieve that.

#1 Choose action

#2 Not condition

1 Like