Multiple triggers and multiple actions in one automation

Hi,

I have made the HALO air quality sensor and is working just great with home assistant. Now I want the LED ring light up when the CO2 is low (green) medium (orange) or high (red).

is it possible to do this within one single automation and how can I turn off the led when it is within a specific range?

thnx for the help.

You can run the whole world with a single automation if you wanted (, although it would probably be a bad design decision).

You should post some more information, along with code that you’d tried, or the best most people here can do is point you to The Documentation.

thx for the help

I now have this yaml file but I don’t know how to integrate the trigger ID into a specific action:

alias: Light 'Turn on on Halo Air Quality Sensor Halo
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.halo_v1_co2
    below: 800
    id: low
  - trigger: numeric_state
    entity_id:
      - sensor.halo_v1_co2
    above: 801
    below: 1100
    id: medium
  - trigger: numeric_state
    entity_id:
      - sensor.halo_v1_co2
    above: 1091.2
    id: high
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    data:
      rgb_color:
        - 255
        - 38
        - 0
      transition: 5
    target:
      entity_id:
        - light.halo_v1_halo
mode: single

thnx

I have tested an automation where i have used the choose action for selecting the trigger id:

alias: timer test trigger
description: ""
triggers:
  - trigger: time
    id: time-1
    at: input_datetime.time2trigerevent
  - trigger: time
    id: time-2
    at:
      entity_id: input_datetime.time2trigerevent
      offset: "00:00:30"
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - time-1
        sequence:
          - action: switch.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: switch.esp32_s3_relay_6ch_relay_1
      - conditions:
          - condition: trigger
            id:
              - time-2
        sequence:
          - action: switch.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: switch.esp32_s3_relay_6ch_relay_1
mode: single

alias: Light 'Turn on on Halo Air Quality Sensor Halo
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.halo_v1_co2
    below: 800
    id: green
  - trigger: numeric_state
    entity_id:
      - sensor.halo_v1_co2
    above: 801
    below: 1100
    id: orange
  - trigger: numeric_state
    entity_id:
      - sensor.halo_v1_co2
    above: 1091.2
    id: red
conditions: []
actions:
  - action: light.turn_on
    metadata: {}
    data:
      color_name: "{{ trigger.id }}"
      transition: 5
    target:
      entity_id:
        - light.halo_v1_halo
mode: single

Reference

light.turn_on

1 Like

Looks so simple… :wink: why can’t I think of it…

going to test this asap

thnx

Looks like it is working… superb!

thnx all for the help

1 Like

If 123’s answer works for you, please consider scrolling up to it and marking it as a Solution.

This will help other readers of the forum who might be searching for the same answer. Thank you!

1 Like

I have just one question and don’t know how to solve this using this config.

I have setup the brightness to 30%

      brightness_pct: 30

Now I only want for the red light to have a brightness of 100%, is this something I have to setup in conditions or can It be done in the action itself?

actions:
  - action: light.turn_on
    metadata: {}
    data:
      color_name: "{{ trigger.id }}"
      brightness_pct: "{{ iif(trigger.id == 'red', 100, 30) }}"
      transition: 5
    target:
      entity_id:
        - light.halo_v1_halo

Reference

Templating - Immediate If

2 Likes

It all looks so simple… ;: