Adding condition for a step in script sequence

i have a script which i can execute from lovelace. i want this script to publish MQTT message, but only if an input_boolean is set to on.

is this possible with a script? if not what’s the alternative? i wish to have several operations in the sequence where each one is dependent of its own input_boolean.

Yes it is.

Of course, the way a condition works is that if the condition isn’t met, the script stops. You can’t do a series of only do X if Y is set without the use of templating. There you’d pick a dummy topic to publish messages to if the boolean isn’t set.

isn’t there a simpler way to achieve this? adding automation for every operation will look terrible - i have many items in the sequence which all need to use conditions…

You’ve got two choices

  1. One script per item
  2. Templating

or option3 - use a python_script which in this case will be much better i believe…