NFC Tag as Trigger to Toggle Switch

Hi guys

This is my first post and I come from a non - tech background so kindly bear with me. I am not even sure if this would be possible.

I am using the Tinxy 4 Switch Node. I have been looking for ways such that I could use an NFC tag as a trigger to toggle the light switch on and off. Based on my limited understanding, what I could find was that I need to use Tasker to set the NFC tag as a trigger. Further I need to integrate it with IFTTT which could toggle the light on and off. Now IFTTT integrations are available for popular brands like Philips etc. I could not find one for Tinxy.

Am I missing something? If not, is there an alternative solution possible? All I want to do is tap my phone on an NFC tag so that it switches off the light. Opening the app and manually switching off is too cumbersome.

Also, just in case if it helps, I have added Tinxy in the Google Home app (just the app, I do not own a Google Home device). So I have Tinxy integrated over there. If there is any way to use this Google Home integration to achieve my resolution, I am open to that too.

Any help is appreciated. Thanks!

Yes you can integrate ifttt with Tinxy.

Just use our APIs . You can add any custom url to a IFTTT action I believe.

  1. Get your api token from the app
  2. Use api to get device ID
  3. Use that device I’d to build the toggle url
  4. Add that url and authorization header to IFTTT custom action

Api documentation API Documentation - #2 by itsmesid

Thank you for the reply Mohit

Actually I am not from a tech background. So I don’t know how to work with APIs or any coding for that matter. Is there any other way out or is there a pre written code available which I could use

Hello,

If you are comfortable with tasker, there is paid plugin named autovoice (From the maker of tasker)

The idea is to trigger alexa routine from tasker having tinxy switch actions. The trigger is set to nfc tag read.

  1. Define a virtual device in autovoice plugin
  2. use the device as on/off trigger to create routine in alexa
  3. bind this task with nfc tag

There is still considerable learing curve but it does not require tinkering with api calls and query syntax.

You can refer to this guide to get started

Hi,

I read through the responses and all of them seem very useful. I think because you are new to this, I’ll try to explain it as simple as I can on how I would do it.

There are mainly two parts to your problem:

  1. Trigger IFTTT by scanning NFC Tag
  2. Trigger Tinxy from IFTTT

Solution for 1st Problem
For tackling the 1st problem, as you suggested you can use Tasker, or even Automate, which is a free alternative available on android which works similar to tasker. You can use either of them to scan NFC Tag. Next, you can send a request to IFTTT via webhook. You can refer to this video link to see how to create a webhook. Eg: https://maker.ifttt.com/trigger/TRIGGER_NAME/with/key/YOUR_KEY, need to replace TRIGGER_NAME and YOUR_KEY.

Now your workflow will be like: Android Phone → NFC Scan → Trigger Webhook

Solution for 2nd Problem
As for tackling the 2nd problem, you can make use of IFTT webhooks (make a web request). Firstly you need to find out your tinxy device’s id, this can be done with the help of APIs provided by tinxy. You can download the json from this link and import it in Postman.
NOTE: API Token can be retrieved from Tinxy app (open app → click on top-left → click on API Token → get token) and should be used in the Authorization header.

You can make use of Devices with userID API to find ids for all your devices.

Now with the help of Device Toggle API, you can toggle the state of the device by creating a webhook in IFTTT. Eg:
Method: POST
Content Type: Application/Json
Url: https://backend.tinxy.in/v2/devices/YOUR_DEVICE_ID/toggle
Header: Authorization: Bearer *YOUR_API_TOKEN*
Payload:

{
	"request": {
		"state": 1,
        "brightness": 0
	},
    "deviceNumber": 1
}

Finally your IFTT applet will look like:

The complete flow will look like: Android Phone → NFC Scan → Trigger Webhook(receive a web request) → Webhook (make web request to tinxy) → toggle switch on/off

I hope this will help solve your problem.

Cheers.

Hey, this is very useful. Thanks for sharing this! :slight_smile:

You have been so patient listing out the whole process, thank you so much for this!

Just a little doubt. Does this toggle the switch or turn it to a particular state (on/off)?

EDIT - Does this require for the phone to be unlocked?

It doesn’t toggle, it turns the switch to a particular state.
Yes, it does require the phone to be unlocked, I believe it is a security feature.

Quick question here. Would any phone with NFC be able to switch on/off?
I am trying to work with NFC tag with the lock?