Why won't my trigger sensor show up as an entity

I’m trying to understand how to use trigger sensors and running into a wall.

I have this in my configuration.yaml

template:
  - trigger:
      - trigger: state
        entity_id: 
          - switch.air_cleaner_plug
        from: "on"
        to: "off"
    sensor:
      - name: air_cleaner_last_ran
        state: "{{ now() }}"

I have done an all yaml reload, but when I do an entity search I have nothing that shows up as air_cleaner_last_ran.

Where is my sensor?

I’m the farthest thing from an expert on templates round these parts, but I seem to recall that if this is your very first template, then you need to do a full HA restart to get it to show up.

You do not need to restart the entire HA host, but you do need to restart the HA core, when adding a template through a YAML config file.
That goes for the first time and every other time you make a change.

You do have to restart Home Assistant (not reboot!) the first time you use any integration configured in YAML. After that you can use the the reload option without restarting - if you have included a unique_id in the entity configuration.

3 Likes