How to define custom trigger for template sensors in different files?

Hey there!

Configuration.yaml:


## Templates ##
template: !include_dir_list mesa/custom_templates

“custom_templates” has about 10 files in it, each with 1 or more sensors such as:

sensor:
  - name: master_bedroom_temperature_average
    state: >
      {% set matts_closet = states('sensor.matts_closet_motion_temperature') | float(default = 0) %}
      {% set serenas_closet = states('sensor.serenas_closet_motion_temperature') | float(default = 0) %}

      {{ ((matts_closet + serenas_closet) / 2) | round(1, default = 0) }}

    availability: >
      {{ states('sensor.matts_closet_motion_temperature') != 'unknown' and states('sensor.serenas_closet_motion_temperature') != 'unknown' }}

(That’s from one of the files).

Is there a way To define a custom trigger for each of these?

Thanks!
Matt

I’ll just bump this once and not again, but I’m curious if anyone knows how to setup a trigger specifically for a custom template in its own file? Seems like triggers can only be defined at a “top level”.

TIA!

Matt