How to add user defined condition to automation

I have created a script for a sauna session which includes lights, music etc lasting 2 hours.
I want this to override my standard automations such as light sensors, so they have a condition that the sauna session script if NOT running (or there is a user definable state like SAUNA_SESSION == FALSE).
So while the sauna session is active, the normal light automations should be inactive.
How could I implement this ?

I suggest you do this:

  • Create a toggle helper to indicate if a sauna session is active. (Settings > Devices and Services > Helpers > Create Helper > Toggle
  • At the start of your sauna script, turn on the helper toggle. (Call service input_boolean.turn_on)
  • At the end of your sauna script, turn off the toggle. (input_boolean.turn_off)
  • All automations that could interfere with a sauna session should have a condition added to the conditions section to check that the helper toggle is off