Trigger a process from reading of any NFC tag
Moderator: Martin
Trigger a process from reading of any NFC tag
Dear Martin
Is there a way to trigger a process from an NFC reading of any tag ?
The requirement is to activate a flow every time a tag (non-registered) is detected.
I had been trying Global patterns with the wildcard characters like "*" and "?" but I haven´t got no success.
Thanks & Regards,
Eduardo
Is there a way to trigger a process from an NFC reading of any tag ?
The requirement is to activate a flow every time a tag (non-registered) is detected.
I had been trying Global patterns with the wildcard characters like "*" and "?" but I haven´t got no success.
Thanks & Regards,
Eduardo
Re: Trigger a process from reading of any NFC tag
Hi Eduardo
You can react to multiple tags written by Automagic using a wildcard * or a comma separated list that lists all the IDs you are interested in.
Automagic does not provide a wildcard option when Existing Tag ID is selected (e.g. for read-only tags, NFC tags in credit cards and the like). I think it should be possible to extend Automagic by adding an option to react to all scanned tags and provide the tag id in a variable to the executed flow. This would not work when another app also handles the NFC tag and has higher priority than Automagic.
Regards,
Martin
You can react to multiple tags written by Automagic using a wildcard * or a comma separated list that lists all the IDs you are interested in.
Automagic does not provide a wildcard option when Existing Tag ID is selected (e.g. for read-only tags, NFC tags in credit cards and the like). I think it should be possible to extend Automagic by adding an option to react to all scanned tags and provide the tag id in a variable to the executed flow. This would not work when another app also handles the NFC tag and has higher priority than Automagic.
Regards,
Martin
Re: Trigger a process from reading of any NFC tag
Hi Martin,
I need to be able to bring the Tag ID into Automagic, even if it is triggered by the Name. This is a problem now because If I write all my tags with the same Name I have found that the variable {nfc_tag_ids} appears to be null at the time to read.
I have thought of a possible solution, which would be to initiate a process using two simultaneous or sequential variables to trigger: Tag ID and Name. My question is, would then Automagic allow me to access both?
Thank you for all of your help and prompt replies, this is very much appreciated.
Eduardo
I need to be able to bring the Tag ID into Automagic, even if it is triggered by the Name. This is a problem now because If I write all my tags with the same Name I have found that the variable {nfc_tag_ids} appears to be null at the time to read.
I have thought of a possible solution, which would be to initiate a process using two simultaneous or sequential variables to trigger: Tag ID and Name. My question is, would then Automagic allow me to access both?
Thank you for all of your help and prompt replies, this is very much appreciated.
Eduardo
Re: Trigger a process from reading of any NFC tag
Hi Eduardo,
Maybe I still don't understand. The trigger should supply the tag id in variable nfc_tag_ids. For example, when triggering on tag with ID TAG_123, the variable should also contain TAG_123 when the flow is executed by the NFC trigger. The variable will not be set when you execute the flow manually (menu->Execute).
Why don't you write a distinct value to each NFC tag and use a separate trigger for each tag (or one trigger with * and a condition Expression: nfc_tag_ids=="TAG_123")?
Could you please share the flow you have built so far so I can have a look?
Regards,
Martin
Maybe I still don't understand. The trigger should supply the tag id in variable nfc_tag_ids. For example, when triggering on tag with ID TAG_123, the variable should also contain TAG_123 when the flow is executed by the NFC trigger. The variable will not be set when you execute the flow manually (menu->Execute).
Why don't you write a distinct value to each NFC tag and use a separate trigger for each tag (or one trigger with * and a condition Expression: nfc_tag_ids=="TAG_123")?
Could you please share the flow you have built so far so I can have a look?
Regards,
Martin
Re: Trigger a process from reading of any NFC tag
Digging up an old post...(as prove that i read throught he forum...LOL).
I have a similar problem as above.
I've created a flow which reads an NFC tag and then depending on the status of a variable, either turn BlueTooth on or off and setting or resetting that variable.
When i execute the flow, it works fine, variable sets fine etc... so no problems there.
But the problem starts in the beginning because the flow is never triggered when the NFC tag is scanned.
To get the TAG id, i did read it with the Existing TAG ID option, wrote the number down and then changed to Automatic TAG ID and entered that same number in the TAG list (only one number there).
I also tried with Existing TAG ID and then that number in the TAG ID list but it will never work.
The trigger never turns red.
The TAG itself was originaly written with NFC-Tools and works nice with Tasker.
But with AutoMagic i can't get it to work (trigger the flow).
It does not return an error, nor is there anything written in the log when i read the TAG (it just makes a sound that the TAG is read).
Flow (don't know if the first condition must be there or not, i guess not but i added it as a test, with it included i can't execute it since the codition is never met).
Flow is never triggered when the TAG is read. Somehow i'm missing something...

Side question:
Is there another possibility to set a variable then the ones i'm using in the above flow?
Now i'm using a script command to do so, i have found no other way since there is no such thing is "set variable" as Tasker has...(or i may be overlooking it...)
I have a similar problem as above.
I've created a flow which reads an NFC tag and then depending on the status of a variable, either turn BlueTooth on or off and setting or resetting that variable.
When i execute the flow, it works fine, variable sets fine etc... so no problems there.
But the problem starts in the beginning because the flow is never triggered when the NFC tag is scanned.
To get the TAG id, i did read it with the Existing TAG ID option, wrote the number down and then changed to Automatic TAG ID and entered that same number in the TAG list (only one number there).
I also tried with Existing TAG ID and then that number in the TAG ID list but it will never work.
The trigger never turns red.
The TAG itself was originaly written with NFC-Tools and works nice with Tasker.
But with AutoMagic i can't get it to work (trigger the flow).
It does not return an error, nor is there anything written in the log when i read the TAG (it just makes a sound that the TAG is read).
Flow (don't know if the first condition must be there or not, i guess not but i added it as a test, with it included i can't execute it since the codition is never met).
Flow is never triggered when the TAG is read. Somehow i'm missing something...

Side question:
Is there another possibility to set a variable then the ones i'm using in the above flow?
Now i'm using a script command to do so, i have found no other way since there is no such thing is "set variable" as Tasker has...(or i may be overlooking it...)
Re: Trigger a process from reading of any NFC tag
Hi,
Please ensure that option Handle existing NFC tags is enabled in the preferences of Automagic. Please also enable Debug Log, scan the tag and see if there's something written in the log of Automagic.
The first condition is not required since the trigger already checks that the ID matches.
Action Script is the proper way to set a variable.
Regards,
Martin
Please ensure that option Handle existing NFC tags is enabled in the preferences of Automagic. Please also enable Debug Log, scan the tag and see if there's something written in the log of Automagic.
The first condition is not required since the trigger already checks that the ID matches.
Action Script is the proper way to set a variable.
Regards,
Martin
Re: Trigger a process from reading of any NFC tag
The option Handle existing NFC tags was already enabled. There's nothing extra written in the log when the tag is read.
So i'm still no further...
I tried a new tag and wrote it with the AutoMagic write option which it did.
Then i did read it back and it reads it but instead of triggering the flow, it opens a weblink to automagic4android.com with a 404 error (page doesn't exist).
Automagic writes the tag because when read it opens the automagic4android link instead of original Samsung link (the Tag is a Samsung tag)
Now how do i get the reading of the NFC tag to trigger the flow instead of opening the link? Again when checking the log, nothing is written to it when the tag is read.
and, how do i get the correct data (in fact from the one i wanted to read in the first place) into this new tag?
So i'm still no further...
I tried a new tag and wrote it with the AutoMagic write option which it did.
Then i did read it back and it reads it but instead of triggering the flow, it opens a weblink to automagic4android.com with a 404 error (page doesn't exist).
Automagic writes the tag because when read it opens the automagic4android link instead of original Samsung link (the Tag is a Samsung tag)
Now how do i get the reading of the NFC tag to trigger the flow instead of opening the link? Again when checking the log, nothing is written to it when the tag is read.
and, how do i get the correct data (in fact from the one i wanted to read in the first place) into this new tag?
Re: Trigger a process from reading of any NFC tag
Update: got it working.
Enabled both the Write alternate tag information and Include Android application record and then it works.
Enabled both the Write alternate tag information and Include Android application record and then it works.
Re: Trigger a process from reading of any NFC tag
...but only with a newly written tag. My prevoiusly written tag (same brand, from the same strip even) which was not written by AutoMagic does not trigger.
It reads the ID alright and then when i put the ID in the trigger, it still does nothing.
So it seems that the tags have to be written by AutoMagic to work.
So how do i write extra info in these tags with Automagic?
The original tag contains also a Tasker task to be executed by Tasker when read and when Tasker is alive.
I don't want 2 tags on the same place for doing the same thing with either Tasker or AutoMagic.
So if it's needed to write the tag with AutoMagic so it can be read by AutoMagic and activates the trigger, how do i write the extra name for the Tasker task into that tag when i write the tag with AutoMagic?
It reads the ID alright and then when i put the ID in the trigger, it still does nothing.
So it seems that the tags have to be written by AutoMagic to work.
So how do i write extra info in these tags with Automagic?
The original tag contains also a Tasker task to be executed by Tasker when read and when Tasker is alive.
I don't want 2 tags on the same place for doing the same thing with either Tasker or AutoMagic.
So if it's needed to write the tag with AutoMagic so it can be read by AutoMagic and activates the trigger, how do i write the extra name for the Tasker task into that tag when i write the tag with AutoMagic?
Re: Trigger a process from reading of any NFC tag
Reading the ID of a tag in the user interface of Automagic has highest priority so other apps can not interfere.
When the tag is scanned, Android usually sends the tag information just to the first registered app that handles the tag, which might be Tasker in your case. Triggering both Automagic and Tasker with the same tag will probably not be possible. However, you could detect the tag in Tasker and send a broadcast intent to Automagic to execute a flow or vice versa. The action in Tasker is probably named Send Intent, configure to send a broadcast. You can receive the intent in Automagic with trigger General Broadcast. The action in the broadcast has to be the exact same value in Tasker/Automagic. Use action Send Broadcast in Automagic and event Intent Received in Tasker for the other direction.
To invoke Tasker from Automagic, you could probably also use action Launch Shortcut if Tasker supports launching tasks via shortcuts.
Regards,
Martin
When the tag is scanned, Android usually sends the tag information just to the first registered app that handles the tag, which might be Tasker in your case. Triggering both Automagic and Tasker with the same tag will probably not be possible. However, you could detect the tag in Tasker and send a broadcast intent to Automagic to execute a flow or vice versa. The action in Tasker is probably named Send Intent, configure to send a broadcast. You can receive the intent in Automagic with trigger General Broadcast. The action in the broadcast has to be the exact same value in Tasker/Automagic. Use action Send Broadcast in Automagic and event Intent Received in Tasker for the other direction.
To invoke Tasker from Automagic, you could probably also use action Launch Shortcut if Tasker supports launching tasks via shortcuts.
Regards,
Martin