Create an NFC Tag State (not Event) 2019-11-15

This state will be active for as long as the NFC tag is present and will be inactive otherwise

  1. joaomgcd
    This is a demo of what it'll look like when it's done.


    STEP 1 - ON SCAN SET GLOBAL VARIABLE


    • Create a new profile in Tasker with the NFC Tag event
    • Accept it as it is or restrict to a certain tag if you want
    • In the Task use the Variable Set action to set %NfcPresent to 1


    STEP 2 - CHECK IF NFC TAG IS STILL PRESENT


    • Add an NFC Tag action to the task
    • Add an If action and set the condition to %nfc_present matches true
    • Add an End If action to close the If


    STEP 3 - KEEP SCANNING IF STILL PRESENT


    • Add a 1 Second Wait action inside the If
    • Set a Label on the NFC Tag action above: scan
    • Add a Goto action inside the If and make it go to the Action Label scan


    STEP 4 - CLEAR GLOBAL VARIABLE IF NO LONGER PRESENT


    • At the end of the Task add a Variable Clear action and clear the %NfcPresent variable
    • Back out of the task and apply your settings with the tick icon on the top right


    STEP 5 - TEST VARIABLE


    • If you now go to the VARS tab and scan a card, you'll see that the %NfcPresent variable changes to 1. If you remove the card it'll change to not being set.


    STEP 6 - EXAMPLE PROFILE WITH THE NFC PRESENT STATE


    • Create a new Profile with the Variable Value state
    • Set the condition to %NfcPresent Is Set
    • In the task do whatever you want to happen when the NFC tag is near your phone. In this example I created a notification
    • Add an exit task and also do whatever you like there. In this example I cancelled the notification.


    Now, when an NFC tag is near phone the notification will come up and when the tag goes away, the notification will also go away :cool:.