#automation detecting manual run

8 messages · Page 1 of 1 (latest)

main dragon
#

Made a quick timed automation:

alias: Aquarium schedule
description: ""
triggers:
  - at: "09:30:00"
    id: morning
    trigger: time
  - at: "18:30:00"
    id: evening
    trigger: time
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id: morning
          - condition: state
            entity_id: switch.aquarium
            state: "off"
        sequence:
          - target:
              entity_id: switch.aquarium
            action: switch.turn_on
            data: {}
      - conditions:
          - condition: trigger
            id: evening
          - condition: state
            entity_id: switch.aquarium
            state: "on"
        sequence:
          - target:
              entity_id: switch.aquarium
            action: switch.turn_off
            data: {}
      - conditions:
          - condition: template
            value_template: "{{ trigger is none }}"
        sequence:
          - target:
              entity_id: switch.aquarium
            action: switch.toggle
            data: {}
mode: single```

The purpose is to turn the aquarium light on and off at scheduled times.
I"m trying to 'test' the automation, by having it toggle when the automation is ran manually, but trigger_id doesn't seem to exist when ran manually?
winter nimbus
#

Manually running an automation ignores triggers and conditions.

#

Why not just use a schedule helper and triggering off of that?

main dragon
#

Just didn't think of that. I can activate a toggle action if the automation is ran manually?

winter nimbus
#

Sure. You can run individual actions from an automation.

#

I do mine with a schedule helper. Much easier imo.

main dragon
#

Allright, let me set that up

winter nimbus
#

alias: 60 Gallon Tank Lights On/Off
description: ""
triggers:
  - entity_id:
      - schedule.60_gallon_tank_lights_schedule
    from: "off"
    to: "on"
    id: switch_on
    trigger: state
  - entity_id:
      - schedule.60_gallon_tank_lights_schedule
    from: "on"
    to: "off"
    id: switch_off
    trigger: state
conditions: []
actions:
  - if:
      - condition: trigger
        id:
          - switch_on
    then:
      - metadata: {}
        data: {}
        target:
          entity_id: switch.60_gallon_tank_lights
        action: switch.turn_on
    else:
      - target:
          entity_id:
            - switch.60_gallon_tank_lights
        data: {}
        action: switch.turn_off
mode: single