Trigger Template sensors stopped working

I have some template sensors set up that used to work, but seems it no longer triggers.

The sensors are set up to trigger on if a state attribute contains a specific value.
This was working a few updates ago, but i since had the camera the sensor uses suffer connection issues, so not sure when this stopped working

template:
 
  - trigger:
      - id: gateperson
        platform: template
        value_template: >
          {% if 'person' in state_attr('image_processing.doods_gate_snap','summary') %}true{% else %}false{% endif %}
      - platform: homeassistant
        event: start
    binary_sensor:
      - name: "Gate Person"
        auto_off:
          hours: 0
          minutes: 0
          seconds: 5
        state: "{{ trigger.id == gateperson }}"

Please help?

Try this:

value_template: "{{ 'person' in state_attr('image_processing.doods_gate_snap','summary') }}"

Thanks. Ive given this a try without any success. Result stays the same. Both templates resolve correctly in Developer Tools. but the Binary sensor does not change

Go to the developer tools template editor and try this:

"{{ state_attr('image_processing.doods_gate_snap','summary') }}"

What does it result in?

Looking at your screen shot I do not see a summary attribute. I see a person attribute that has a confidence score.

The doods image processing entity produces a matches as well as a summary attribute:

So when you add the code to template editor, it returns true or false as expected.

So the template definitely returns the desired results
Apologies for using a different image processing entity in the above screenshots, but my initial posts’ screenshot confirms the same result.

Please try this and show the result

The trigger Template doesnt seem to be at fault. These are the results:


I have now gone and set my template trigger to an input boolean i have previously conifgured to simplify things:

template:
  - trigger:
      - id: gateperson
        platform: template
        value_template: "{{ iif (is_state('input_boolean.guests_visiting','on')) }}"
    binary_sensor:
      - name: "Gate Person"
        # auto_off:
        #   hours: 0
        #   minutes: 0
        #   seconds: 5
        state: "{{ trigger.id == gateperson }}"

And this does not even trigger. You can see in the screenshots, the Developer Tools Template does change from true to false with the same expression as used in the code above.


Why are you using an immediate if with no result parameters defined in the template?

This:

value_template: "{{ iif (is_state('input_boolean.guests_visiting','on')) }}"

Should be:

value_template: "{{ is_state('input_boolean.guests_visiting','on') }}"

However you can just use a state trigger for that. No need for a template.

trigger:
  platform: state
  entity_id: input_boolean.guests_visiting
  to: 'on'

Hi Tom

I can write the template any which way. The template doesn’t seem to be the issue. If you look at any of my previous screenshots, the template returns true/false as wanted and expected.

Here is your last suggestion applied:

template:
  - trigger:
      - id: gateperson
        platform: state
        entity_id: input_boolean.guests_visiting
        to: 'on'
    binary_sensor:
      - name: "Gate Person"
        # auto_off:
        #   hours: 0
        #   minutes: 0
        #   seconds: 5
        state: "{{ trigger.id == gateperson }}"


HA restarted after each change.