Switch Automations on/off

At first I had helpers that I toggled to on/off that triggerd my automations to do something. In this case it triggered my lights in my livingroom. It is an overrule-trigger that overrules the automation when the lightsensor is above a certain lever and/or the beamer is playing and/or nobody is at home. In all those cases I do not want the automation to flip on the lights.

But then I had the illuminous Idea of stripping out the helper and switch the automation on or off. I thought: one step out of the procedure: it can only be better.

Now I’m wondering if that is such a good idea, as I experience now that once you turn on an automation, you need to trigger it as well, even if one of the triggers whithin that automation is an every minute of the hour trigger (/1).
Why is that nescessary, and secondly: How do I fix this the best?

Best regards.

It sounds like you want to run a sequence of actions manually. That is what scripts are for. Put your actions in a script, call the script from a dashboard button tap action.

I hear what you say, but I do not invoke my automation (or script) with a button on my dashboard. I only toggle my overrule (helper) on my dasboard with a button, whilst during the day that overrule is managed by either the automation that looks how bright the light outside is, or if the beamer is on so that the light stay dimmed during watching something.

This is the construction:

alias: Set Lux
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.tuin_beweging_sensor_illuminance_lux
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - data_template:
      value: "{{ states('input_text.luxname') }}"
    target:
      entity_id: input_text.luxname_last_notified
    action: input_text.set_value
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: sensor.tuin_beweging_sensor_illuminance_lux
            below: 810
            attribute: illuminance_lux
          - condition: numeric_state
            entity_id: sensor.tuin_beweging_sensor_illuminance_lux
            above: 325
            attribute: illuminance_lux
        sequence:
          - metadata: {}
            data:
              value: MEDIUM
            target:
              entity_id: input_text.luxname
            action: input_text.set_value
      - conditions:
          - condition: numeric_state
            entity_id: sensor.tuin_beweging_sensor_illuminance_lux
            below: 325
            attribute: illuminance_lux
          - condition: numeric_state
            entity_id: sensor.tuin_beweging_sensor_illuminance_lux
            above: 99
            attribute: illuminance_lux
        sequence:
          - metadata: {}
            data:
              value: LOW
            target:
              entity_id: input_text.luxname
            action: input_text.set_value
      - conditions:
          - condition: numeric_state
            entity_id: sensor.tuin_beweging_sensor_illuminance_lux
            below: 100
            attribute: illuminance_lux
        sequence:
          - metadata: {}
            data:
              value: NIGHT
            target:
              entity_id: input_text.luxname
            action: input_text.set_value
    default:
      - metadata: {}
        data:
          value: HIGH
        target:
          entity_id: input_text.luxname
        action: input_text.set_value
      - if:
          - condition: state
            entity_id: automation.licht_automaat_elke_30_sec
            state: "on"
        then:
          - action: automation.trigger
            metadata: {}
            data:
              skip_condition: true
            target:
              entity_id: automation.licht_automaat_elke_30_sec
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - condition: template
    value_template: >-
      {{ states('input_text.luxname') !=
      states('input_text.luxname_last_notified') }}
  - metadata: {}
    data:
      message: >-
        {{ states('input_text.luxname') }} ({{
        states('sensor.tuin_beweging_sensor_illuminance_lux') }})
    action: notify.mdb055
mode: single

together with this:

alias: Licht Automaat elke 30 sec
description: ""
trigger:
  - platform: time_pattern
    seconds: /30
  - platform: state
    entity_id:
      - automation.licht_automaat_elke_30_sec
    attribute: current
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: input_boolean.overrule
        state: "on"
      - condition: state
        entity_id: input_boolean.beamer_speelt_meda
        state: "on"
      - condition: state
        entity_id: input_boolean.roomba_maakt_schoon
        state: "on"
action:
  - data: {}
    action: script.licht_benenden_op_basis_ban_lux
mode: restart

together with this script:

alias: Licht Beneden Op basis van Lux
sequence:
  - choose:
      - conditions:
          - condition: or
            conditions:
              - condition: state
                entity_id: input_text.luxname
                state: NIGHT
              - condition: state
                entity_id: input_text.luxname
                state: LOW
        sequence:
          - target:
              entity_id:
                - scene.woonkamer_normaal_2
                - scene.tuin_spotjes_fleur
            data:
              transition: 15
            action: scene.turn_on
      - conditions:
          - condition: state
            entity_id: input_text.luxname
            state: MEDIUM
        sequence:
          - metadata: {}
            data:
              transition: 15
            target:
              entity_id: light.alle_lampen_in_de_tuin
            action: light.turn_off
          - target:
              entity_id: scene.woonkamer_normaal_2
            data:
              transition: 15
            action: scene.turn_on
    default:
      - metadata: {}
        data:
          transition: 15
        target:
          entity_id:
            - light.alle_lampen_in_de_tuin
            - light.alle_lampen_in_de_woonkamer
        action: light.turn_off
mode: single
icon: mdi:lightbulb-auto-outline

I would love to hear how anyone else would organise this more properly.