Hi
I’m trying to have script that may be triggered in different ways, and the script will have a wait_for_trigger command that will wait for some NFC tag to be scanned. It will be the calling automation or script that will tell the script which tag to check for.
I’m desperately trying to get the right syntax for that but with no success. What am I doing wrong?
Here’s an example of the calling script:
alias: Asktocheckatag
sequence:
- service: script.tagchecker
data:
nfctagvariable: 1%%%%%-%%%-%%%-%%%-%%%%%%%%0
mode: single
And here is the script that will take the variable and wait 10 seconds for that tag to be scanned:
alias: Tagchecker
sequence:
- wait_for_trigger:
- platform: tag
tag_id: "{{ nfctagvariable }}"
id: tag_is_scanned
timeout: "10"
- choose:
- conditions:
- condition: template
value_template: "{{ wait.trigger.id == 'tag_is_scanned' }}"
sequence:
- service: notify.mobile_app_phone
data:
message: The tag {{ nfctagvariable }} has been scanned on time.
default:
- service: notify.mobile_app_phone
data:
message: The tag {{ nfctagvariable }} has not been scanned on time.
mode: single
For some reason, the script never recognizes the tag. What am I doing wrong?