Problem with condition template in automation

HI,
I have a automation with condition template I have been struggling with for some time now. Perhaps someone else with fresh eyes can see way it’s not working for me.

This is my automation (indentations are OK):

  - alias: Lock update status
    trigger:
      - platform: state
        entity_id: lock.mylock
    condition:
      condition: and
      conditions:
        - condition: template
          value_template: "{{ trigger.to_state.state == 'unlocked' }}"
        - condition: template
          value_template: "{{ trigger.to_state.attributes.changed_by != 'None' }}"
    action:
    - service: notify.FaceBook
      data_template:
        target:
          - 'mynumber'
        message: >
          Lock changed from {{ trigger.from_state.state }}
          to {{ trigger.to_state.state }}
          by {{ trigger.to_state.attributes.changed_by }}

The expected result is that this should only be triggered when the lock has been unlocked by a “named user” i.e when unlocked by “None” i should not get a notify.

Problem is that I get a notify even when the lock is unlocked with the thumb turn ie “None”.
The first part Unlocked and Locked works fine!

The message also clearly says it has been unlocked by “None”.
Tried with “None”, “none”, “null” and “Null”.

Thanks for your time!
Regards PH

Hi @PetrolHead, i don’t think you get attributes from the trigger.


Maybe use the attributes from the lock for your condition and data template.
Something like
{{ states.lock.mylock.attributes.changed_by != 'None' }}