Attribute as trigger

Hello everyone,

Have a problem with an automation;

Why doesn’t the following automation trigger?
Can’t really find what’s wrong!


alias: aaaaaaatest
description: “”

  • platform: template
    value_template: |
    {{state_attr(‘device_tracker.iphone_bart_deco’ ,
  • platform: template
    value_template: |
    {{state_attr(‘device_tracker.iphone_bart_deco’ ,
    condition: []
  • condition: template
    value_template: >-
    {{not is_state_attr(‘device_tracker.iphone_bart_deco’ ,
    ‘deco_device’,‘Keuken’) or
    is_state_attr(‘device_tracker.iphone_bart_deco’ , ‘icon’, ‘mdi:lan-disconnect’) }}
  • service: light.turn_off
    data: {}
    entity_id: light.groep_alle_lichten_keuken_zks
    mode: single

It’s difficult for us too. Please format it properly in future and do not be tempted to post a screenshot.

Your problem is that template triggers have to return true or false. They trigger when the template changes from false to true. Your templates only return an attribute value.

You probably want is_state_attr(... to compare the value with something. However you could just use a state trigger for that. They support attributes. So do numeric state triggers if you want to see if the attribute is more or less than some value.

Please have a read of this:

1 Like