How many triggers can home assistant handle?

Edit- im a newby HA user.

So im currently migrating hue bridge to mqtt and the sheer number of triggers i need to implement for my remotes feels completely over the top.

8 triggers per remote, i have 20 hue dimmer remotes, for a total of 160 triggers. Then i have 4 rotary hue remotes remotes which all have 12 triggers set and a lexman remote with 19 triggers.

Totalling a whopping 227 triggers just for my remote system.

So the question becomes. How much triggers is too much? Or am i doing something wrong?

Note, im currently using device trigger to detect a button press change. I know you can also use mqtt trigger but i didnt see the benefit (as i have set friendly names and the individual mqtt topics are very convoluted ea. Ox7576uaxo87273)

I wouldn’t dare putting a number on it, but I can tell you HA won’t have a problem with it. But if you want to have my opinion if you’re doing something wrong: buying too many expensive remotes :slight_smile:

If the remotes are tied to lights, I’d consider hard binding them to the light instead of going through HA. It would save a lot of angry housemates if HA is down for some reason. You’ll probably have smoother operation too.

3 Likes

You have 20 remotes. Use 20 automations with one trigger. Then sort out the 8 functions using a choose action. It’s a lot easier to manage. e.g.

- id: 4239ed5b-2f54-4afe-a112-f6a0be1c9389
  alias: Spare Bed Button Events
  triggers:
  - trigger: state
    entity_id: event.spare_bed_button_action
    to: ~
  conditions:
  - condition: template
    value_template: "{{trigger.from_state.state != 'unavailable'}}"
  actions:
  - choose:
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == 'single'}}"
      sequence:
      - action: light.toggle
        target:
          entity_id: 
          - light.lifx_sp_bed_lamp_left
          - light.lifx_sp_bed_lamp_right
      - action: lifx.set_state
        entity_id: 
        - light.lifx_sp_bed_lamp_left
        - light.lifx_sp_bed_lamp_right
        data:
          brightness: "{{ states('sensor.calculated_light_brightness_25pct_min')|int(0) }}"
          color_temp_kelvin: 2700
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == 'double'}}"
      sequence:
      - action: script.spare_bed_close
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == 'triple'}}"
      sequence:
      - action: script.spare_bed_open
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == 'hold'}}"
      sequence:
      - action: script.spare_bed_favourite
- id: 721c91b5-dfe3-4929-b26b-12d400632f20
  alias: Deck Button Events
  triggers:
  - trigger: state
    entity_id: event.deck_button_action
    to: ~
  conditions:
  - condition: template
    value_template: "{{trigger.from_state.state != 'unavailable'}}"
  actions:
  - choose:
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == '1_single'}}"
      sequence:
      - repeat:
          count: 6
          sequence:
          - action: media_player.volume_up
            target:
              entity_id:
              - media_player.deck_zone
          - delay: 0.1
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == '1_double'}}"
      sequence:
      - repeat:
          count: 9
          sequence:
          - action: media_player.volume_up
            target:
              entity_id:
              - media_player.deck_zone
          - delay: 0.1
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == '2_single'}}"
      sequence:
      - repeat:
          count: 6
          sequence:
          - action: media_player.volume_down
            target:
              entity_id:
              - media_player.deck_zone
          - delay: 0.1
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == '2_double'}}"
      sequence:
      - repeat:
          count: 9
          sequence:
          - action: media_player.volume_down
            target:
              entity_id:
              - media_player.deck_zone
          - delay: 0.1
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == '3_single'}}"
      sequence:
      - action: media_player.media_next_track
        target:
          entity_id:
          - media_player.cinema_zone
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == '3_double'}}"
      sequence:
      - action: media_player.media_previous_track
        target:
          entity_id:
          - media_player.cinema_zone
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == '4_single'}}"
      sequence:
      - action: media_player.media_play_pause
        target:
          entity_id:
            - media_player.cinema_zone
    - conditions:
      - condition: template
        value_template: "{{trigger.to_state.attributes.event_type == 'hold'}}"
      sequence:
      - action: media_player.toggle
        target:
          entity_id:
          - media_player.deck_zone
      - action: media_player.select_source
        target:
          entity_id:
          - media_player.deck_zone
        data:
          source: Main Zone Sync
1 Like

Ah so zigbee2mqtt will send out an event payload from which home assistant then chooses a case based upon attribute state.

I currently have setup all 227 triggers already - wasnt that hard, i just followed a blueprint for the 20 remotes. This blueprint does use triggers. Will switching to the event based solution present a noticable optimisation/ any other benefit?

(Most) Triggers are cheap.

Every time HA gets a new value for an entity, it looks if there are triggers for that entity and executes them. That means that the extra workload from just having a trigger is minimal and only comes into play when the entity a trigger is for reports a new value.

So, if I had a million door sensors, each with a million triggers, it would have no effect at all. Until I open a couple of doors, of course, then those millions of automations doing something would have an effect… :wink:

(And yes, I oversimplified a bit.)

Only from an automation management standpoint.