This trace shows that the automation did run and it did turn the lights off.
Although the automation deals with the door being unlocked, the actual entity_id of the automation is front_door_locked - not the end of the world, but adds to the confusion a bit.
EDIT:
Are you absolutely sure you don’t have any other automations acting on the value of this sensor too then?
Sorry, the system wouldn’t let me post anymore… apparently I hit a post limit since it was the first day I joined.
I tried running the automation manually from within the companion app, and the lights turn off fine. I also tried unlocking the door again after some completely unrelated notification from the door had come in, and the automation worked fine. So I think the problem has something to do with how HA recognizes a notification state change. Maybe it only recognizes it as a state change if the first X characters in the notification change (before, only the time in the notification was changing, and maybe those time characters were too far into the notification).
Is there a way to trigger an automation without a notification state change per se, but rather just whenever a notification with the specific text comes in. I could see this state change limitation being an issue if you’re, for example, using a text message notification to trigger an automation, and the text within the text message is always the same.
you can look at the sensor history and you should see everything that the system registers as a state change. tyhey will each be shown in a different color. If the state change registers there then it will be used to trigger an automation.
But of course if both states contain the word ‘unlocked’ then there will be no trigger since the trigger needs to go from false to true. if both states contain the same search term then it will go from true to true and it won’t trigger.
you could try to trigger on either the last_changed or last_updated attribute but that will be less reliable since you won’t know exactly what caused the change in the attribute. then you could get multiple notifications for the same event.
Anyone in this thread know how to pass punctuation in the message detection section?
I have two messages I’m trying to detect at least for now:
The door was unlocked by Pete’s fingerprint
The door was locked by one-tap
If I use the exact text as shown above, the triggers don’t work as the syntax is wrong with the apostrophe and hyphen in play.
If I just use one of these, it works but that’s not enough to do what I need to do.
"{{ 'The door was locked' in states('sensor.pete_s_pixel_7_last_notification') }}"
"{{ 'fingerprint' in states('sensor.pete_s_pixel_7_last_notification') }}"
These DO NOT work:
"{{ 'The door was locked by one-tap' in states('sensor.pete_s_pixel_7_last_notification') }}"
"{{ 'The door was unlocked by Pete's fingerprint' in states('sensor.pete_s_pixel_7_last_notification') }}"
"{{ 'The door was unlocked by Pete\'s fingerprint' in states('sensor.pete_s_pixel_7_last_notification') }}"
Anyone got any tips on how I can format the text string to pass correctly?
The hyphen should work from a syntax point of view. My guess is that the hyphen character in the notification is not the same character entity as you’re using. Try 'The door was locked by one'.
For the quotes, might be the same story: it could be a “smart quote” (’ in HTML). If it is the right character, your third template should work fine.
You could double up the tests:
"{{ 'The door was unlocked by Pete' in states('sensor.pete_s_pixel_7_last_notification') and 'fingerprint' in states('sensor.pete_s_pixel_7_last_notification') }}"
or more compactly:
"{{ ['The door was unlocked by Pete','fingerprint']|select('in',states('sensor.pete_s_pixel_7_last_notification'))|list|count==2}}"
Thanks so much for the prompt and detailed reply. I’ve used your code but it’s too late to test the actual lock now as everyone is in bed.
Using the developer tools though I can see that state changing from true to false for both templates however, I don’t seem to be able to get that state change to be recognised as a trigger.
If I use the set state in Developer tools, nothing happens in the automation. No traces at all.
alias: Test to see if I can trigger Eufy using app messages
description: ""
trigger:
- platform: template
value_template: >-
"{{ 'The door was locked by one-tap' in
states('sensor.pete_s_pixel_7_last_notification') }}"
id: onetap
alias: One tap message
- platform: template
value_template: >-
"{{ ['The door was unlocked by
Pete','fingerprint']|select('in',states('sensor.pete_s_pixel_7_last_notification'))|list|count==2}}"
id: petefingerprint
alias: Pete fingerprint message
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- onetap
sequence:
- service: notify.mobile_app_pete_s_pixel_7
data:
message: The door was locked by one-tap
- conditions:
- condition: trigger
id:
- petefingerprint
sequence:
- service: notify.mobile_app_pete_s_pixel_7
data:
message: The door was unlocked by Pete's fingerprint
alias: Send outbound message based on inbound trigger message
enabled: true
mode: single
Don’t put quotes around the template if you’re using multi-line format.
trigger:
- platform: template
value_template: >-
{{ 'The door was locked by one-tap' in states('sensor.pete_s_pixel_7_last_notification') }}
id: onetap
alias: One tap message
- platform: template
value_template: >-
{{ ['The door was unlocked by Pete','fingerprint']
|select('in',states('sensor.pete_s_pixel_7_last_notification'))|list|count==2}}
id: petefingerprint
alias: Pete fingerprint message
You’re a legend, thank you. I was just copying the code here and building an automation using the GUI so it seems that might be a code checking bug? Nothing was detected as an error. I’ve only recently switched over to building automations in the GUI so a trap for young players.
Me too but though I better get with the program and start using the GUI! Had I checked some of my YAML files I may have possibly spotted the problem but only after about 4 days of looking.
Thanks again for the assistance. I may now be able to install my Eufy T8530 video door lock without a working integration now I have a workaround that will allow me to detect what the lock is doing in HA.