Continue to next action after failed condition in trigger?

I am trying to debug some automations and I’m sprinkling notify actions in them to let me know what action is executing. It looks something like:

trigger:
(Trigger conditions)
action:

  • (notify service call)
  • (actual thing I want done)
  • (notify service call)
  • (second thing I actually want done)

And it works fine. I was thinking I’d like to leave the notify calls there but only have them run if I set an input_select called “debug mode” to true, which would look something like:

trigger:
(Trigger conditions)
action:

  • condition
    • check if debug if true
  • (notify service call)
  • (actual thing I want done)
  • condition
    • check if debug is true
  • (notify service call)
  • (second thing I actually want done)

The problem is that if debug is false the trigger stops right there on the first condition and doesn’t continue on (if I’m reading the docs right). Is there a way to execute the notifications if debug is true but execute the rest regardless?

TIA

Simple answer, no.

Longer answer, you could physically do this by splitting out your actions in to scripts but it’s a lot of work and it’s going to get very messy very quickly.

1 Like

That’s what I was afraid of. Thanks!

I concur with mf_social; you can’t do what you’ve described.

Here is an imperfect approximation of what you want. You’ll soon understand why I say it’s imperfect.

  • You would add the following service call (shown below) to the automation’s action along with your other service calls (the ones that do the real work).
  • It writes to the system log (/var/log/syslog).
  • If input_boolean.debug is on it will write your predefined debug statement.
  • If input_boolean.debug is off it will write nothing (OK, it actually writes a dash).
  • The imperfection is that it will always submit something to system log because even nothing is still recorded as a time-stamped blank entry.
- service: system_log.write
  data_template: >
    {% set msg = '-' if states('input_boolean.debug') == false 
       else 'your debug statement goes here' %}
    message: "{{msg}}"
    level: info

FWIW, I use this technique, but without the input_boolean.debug, for debugging automations. Sometimes I need to see the trigger value, or some other parameter, that occurred during the automation’s execution. I can reveal it by recording it to the system log.

It’s clearly an imperfect solution.

That’s clever. Thanks!