Can lots of trigger sensors (with trigger each second) cause performance issues?

I want to show the remaining time of a lot of timers (up to 30) in the dashbord in a mushroom chips card for each when its running.

For this I need trigger sensors like this one, which works perfect:

- trigger:
    - platform: time_pattern
      seconds: "/1"    
  sensor:
    - name: Freisitz Markise Ausfahrverzögerung Sonne Restdauer
      unique_id: freisitz_markise_ausfahrverzogerung_sonne_restdauer
      state: >
        {% set t = 'timer.freisitz_markise_ausfahrverzogerung_sonne' %}
        {% set fin = state_attr(t, 'finishes_at') %}
        {% set rem = state_attr(t, 'remaining') %}
        {% set fsec = as_timestamp(fin,0)-as_timestamp(now()) %}
        {% set rsec = as_timedelta("0 " ~ rem).seconds %}
        {{ iif(fin == None,iif(rem == None,0,rsec),fsec)|int(0) | timestamp_custom('%M:%S', false) }}

Before I start creating all the other sensors: Could this be a performance issue if all the sensors get triggered every second?

One way to find out. Let us know how it goes, and what hardware you’re running HA on.

Compared with e.g. a video game, that doesn’t sound like a lot of computation to me.

Maybe look for ways to avoid the triggers if the timer isn’t live, or refactor your template to quit early if rem is 0?

1 Like