NFC Check In System + Wifi

Greetings all,

I’m still new here and you’ll be happy to know that I just ordered my Smartthings Hub v2 :D. Really excited. So I’ve been doing some reading and from what I found is that there have been problems with inconsistency in regards to the presence sensor. Not sure if most of what I found was in regards to v1 hubs, but it seemed that the results for the fob were middle of the road to favorable in regards to reliability, while phone presence sensors have been middle to not at all usable. I’ve seen some cases where the check in with the fob has been so erratic, that shut down procedures occur in the middle of the night, while others have said that their garage door randomly opened because the hub thought the fob was arriving (or something to that extent).

The other problem I saw was with multiple phones as a presence sensor without giving other users direct access to the account to change things. I’ve seen mixed results with this too where people will say, “My wife’s iPhone will work, but my Android wont register at all. It actually will see me teleported across the state”.

So more than likely, I won’t be using the presence sensor as is, but I was thinking, might there be another way I might be able to use presence tracking, without a physical presence sensor? I then thought about using NFC discs and stickers.

To preface, I have not yet exposed myself to the SmartThings mobile or development platform. That said, I have no idea if my logic is correct or even doable. I do have some coding experience and from the looks of what I found on a code level, it doesn’t seem THAT bad, but I could be wrong. So I’m now sure which part would have to be a custom app (if that’s a thing) or whatever. In short, please excuse my ignorance.

My goal is to create a solution that my “non-techy” users can use and learn without having to deal or mess up the nuts and bolts of the system. For them, it should just work while I deal with everything. I guess that’s my WAF lol. Lastly, I do have Tasker Pro and SharpTools installed. I also have the packager just in case I need to make an app and “install” on my “non-techy” user’s phones.

So here we go:
Optimal Case
Two NFC disc cards will be set on the outside door and on the inside door. SmartThings will have a scheduled check on work days to check for a Wifi condition and the last presence state.
While user is leaving, user presses phone against inside door NFC card to activate a SmartThings procedure to check them out.
User leaves the WIFI as well. Since user checked out at the door, SmartThings can go ahead and check out the user (not sure if the phone would still need to be registered as a presence device, or can be faked with a “virtual presence device???”
When user is headed home, scan another NFC card in the car (perhaps a key fob NFC) to indicate that the user is headed home and start preparing the house. Of course I won’t be able to turn on the lights when close, but I don’t mind scheduling the lights to come on at a specific time anyway on a separate schedule.
User scans NFC card at door way, door unlocks (I have a Kwikset lock already), door opens and checks in user.
If user uses keypad instead, SmartThings will ping the device to see if it’s a registered presence device. If true, check that device in.

Contingent Case 1
If user leaves without scanning the phone at the door (rushing to go to work), at a specific time (10-11AM), SmartThings will check to see if the registered presence devices are in the Wifi.
If the devices pinged are within the Wifi, then SmartThings assumes the user is still on the premises (the case if someone didn’t go to work today).
If the devices pinged aren’t within the Wifi, then SmartThings sends a notification to the devices asking if they’ve left the house.
If Yes or No Response: Then SmartThings registers that device as checked out.
If No: Then SmartThings will assume the device is checked in and cancels the “all away case”.
Continue from above step 4 down

As a note, I saw someone past a (script?) that checks for device in Wifi area + cellular + GPS (if you use another android app), so not sure how well that will implement into this.

Anyway, not sure if there are few or many cases I’m missing here or how much work this would be. Any advice, suggestions, changes, more contingent cases you can think of would be helpful. Pretty sure this might be an app, but who know.

Thanks in advance :smiley:

Just for what it’s worth… without having have read too much of your situation there…

I’ve found GREAT success with the presence sensors after I did two things:

1.) Put a device in my garage that is a Zigbee Repeater.
2.) Put a device in a window facing the road that is a Zigbee Repeater.

The presence sensors use a very low power radio in order to preserve battery life as much as possible. Because of this they don’t always keep and hold a reliable connection with the Hub. But if you can put a device that acts as a Zigbee repeater (Gen 1 motion sensor when plugged in, Gen 2 Smart Outlet) in the garage, this helps the sensors stay in solid contact with the hub in your house when the cars are in the garage.

Likewise, a sensor in a window facing the street helps the sensors “acquire” the hub when coming home. My sensors will sometimes trigger actions when I’m three or four houses away even though my hub is in the den at the back of my house.

Finally, a comment on NFC: I had high hopes of using NFC with my phone to be able to trigger certain things, but what I found was that the NFC sticker tags just never worked well for my phone. It was never a quick swipe and trigger. It was always multiple swipes before it would trigger, sometimes just holding it for 4 or 5 seconds over the tag.

This could entirely be because of my phone (Galaxy S5 with 3rd part Qi charger which might partially block the NFC antenna) or the cheap sensor tags I bought online, but if you’re not getting reliable quick NFC triggers, your non-tech people will stop using it or trying it quickly.

Ambitious! I wish you luck with it, it’s always good to have more options. Just as an example, I’m an edge case because I’m quadriparetic, so NFC never works well for me. I can’t hold the phone to begin with, let alone position it appropriately. But again more choices is always better. :tada:

Most of the logic that you described cannot be run on the SmartThings platform. It just doesn’t do that kind of stacked conditional logic well. It also has very limited persistent state variables.

But what some people do, and some have very sophisticated systems, is to run a separate server, anything from a Mac to raspberry pi, do all the stacked conditional logic there, and then just issue the device control requests to SmartThings. Most of the projects using various Wi-Fi presence were using separate servers.

The Reboot Problem

I personally don’t tend to design occupancy around Wi-Fi on phones because then whenever someone reboots their phone you get a departure and arrival event. And people reboot their phones a lot, even if they say they don’t. That’s the advantage of a device like an IBeacon or the Zigbee arrival sensor: they really never get rebooted except when the batteries are changed once or twice a year.

The SmartThings Zigbee Arrival Sensor

I am unfortunately one of those for whom The Zigbee arrival sensor just doesn’t work well. I worked as a network engineer, so I have a pretty good understanding of the various issues, and support worked with me for several months. It didn’t help. There’s just some local interference, probably from my neighbors boosted Wi-Fi, that causes my arrival sensor to continually lose contact with the hub. So it goes. There are other people for whom it works great.

A Two Device Approach

The following topic describes how I ended up approaching the occupancy issue using two separate devices to address the arrival sensor’s flakiness. I’m now using Ibeacons in the mix, and I’m really happy with it. But the receiving station app isn’t on my phone. Instead, the IBeacon is attached to my wheelchair, and the receiving station app is on a tablet at home that is always plugged in and serves as my home automation command center.

So again, different things work for different people. :sunglasses:

2 Likes

Thanks everyone for the responses thus far!

@chrisb , I will definitely consider signal repeating. I did read that the v1 motion sensors had a repeating capability when plugged in, but didn’t know the plugs function the same way. :smiley: The NFC reliability is a legitimate concern, so I’d probably want to limit it to a secondary entry point rather than a presence.

@JDRoberts , I remember reading a lot of posts from you (HAT TRICK!). Thanks for clarifying what was possible at the SmartThings level with the above logic. I’m still learning networking and haven’t messed with micro server solutions like the Raspberry Pi, but I guess as my needs change, I may look into it (though I wonder if at that point, would Smartthings still be worth it or moving to a platform like OpenHAB. Still, beyond me atm).

OpenHAB has potential but you can also hit a wall pretty fast. It’s really good for some people.

I think if it was me and I was still in my coding days I would look more at something like HAM bridge. This was written by a community member here, and is a software-only option that you run on a Mac. Very powerful, very cool, and lets you leverage the SmartThings device controller capabilities while offloading the more complex logic.

But some people like building their own stuff from the ground up as well. So there are a lot of different directions you can take. :sunglasses:

My wifi based presence has a 4 minute lag to account for devices dropping off the network and then reappearing.

NFC will work, but you’re talking about a lot of custom code

  • app for phone to read NFC tag and pass tag ID to smart things app you write with a rest interface
  • your st app then decides if the NFC tag is valid, and if so what action it should perform on ST devices
  • you need another app to “register” tags and users with the above ST app. Honestly ST apps have very basic persistence data, not a real database, so this might get messy, or might be better handled by an actual web app running somewhere that then talks to your ST rest endpoint only to do the HA control

I’ve done these types of things for the day job. They get complex fast, NFC isn’t as seamless/reliable as you’d like, and there a multiple failure points. I’m not saying don’t attempt it, I’m saying be prepared for a lot of trial and error before it gets “reasonably” correct - and forget about it working 100% of the time.

3 Likes

It sounds like what you are trying to accomplish in each of your scenarios can be done with Tasker + SharpTools. You may also need the 3rd party app Trigger to run Tasker tasks based on your NFC tags.

I’m the developer of SharpTools and while I don’t recommend a complex routine for presence, I’m happy to provide more information if that’s the approach you want. :slight_smile: You noted a contingent case, so it sounds like you are thinking about some of the challenges and how complex this can get when you build a custom solution.

The approach I’m going to go through does not require any custom code or third party servers, but all of the logic will reside on the phone in Tasker which can take quite a bit of effort to setup.

Following your ‘Optimal Case’ – each of your steps are in bold with the Tasker approach below it.

Two NFC disc cards will be set on the outside door and on the inside door. SmartThings will have a scheduled check on work days to check for a Wifi condition and the last presence state.
To simplify things, you might consider running the WiFi condition / presence checks directly in Tasker… it sounds like you’ve already seen the other thread showing how to use WiFi along with SharpTools as a form of presence detection, but here’s a link if not:

  1. While user is leaving, user presses phone against inside door NFC card to activate a SmartThings procedure to check them out.
    Use the app Trigger to react to the NFC tag and run a Tasker task. Based on your description, it sounds like you want the NFC tag to be a precondition and the WiFi disconnection to be the actual condition that triggers the departure. Use the built-in Tasker Variable Set action to set a variable like %PHONEAWAY to true

  2. User leaves the WIFI as well. Since user checked out at the door, SmartThings can go ahead and check out the user (not sure if the phone would still need to be registered as a presence device, or can be faked with a “virtual presence device???”
    Create a new profile in Tasker using a State context. Use the ‘WiFi Near’ context and select your SSID. Check the ‘Invert Task’ option so it will trigger when you are not near your WiFi access point. For the task, use an IF conditional to check if %PHONEAWAY ~ true and if so, trigger a SharpTools ‘A Thing’ task to set your Virtual Presence Device to departed like in the linked example above.
    Note: the Else condition here is where you could run your contingent check that puts up a notification prompting the user if they are home or not.

  3. When user is headed home, scan another NFC card in the car (perhaps a key fob NFC) to indicate that the user is headed home and start preparing the house. Of course I won’t be able to turn on the lights when close, but I don’t mind scheduling the lights to come on at a specific time anyway on a separate schedule.
    If you just want this to run a routine or change your mode, then you can use Trigger to run a Tasker task that calls ‘A Phrase’ (aka. Routine) or ‘A Mode’ using SharpTools.

  4. User scans NFC card at door way, door unlocks (I have a Kwikset lock already), door opens and checks in user.
    Use Trigger to react to the second NFC tag and run a Tasker task that:

  • Tell the SharpTools ‘A Thing’ plugin to unlock your door
  • Change the %PHONEAWAY variable to false using Variable Set
  • Runs a SharpTools ‘A Thing’ plugin with arrived on the Virtual Presence Device
  1. If user uses keypad instead, SmartThings will ping the device to see if it’s a registered presence device. If true, check that device in.
    I would probably just do this based on a ‘WiFi Near’ trigger. If you really wanted to do this based on the door unlocking, you could also subscribe to the door ‘lock’ attribute and use a Tasker profile using Event > SharpTools > Thing State. Here’s a link to more information on using ‘Thing State’ as a trigger in Tasker:
    http://sharptools.boshdirect.com/examples/event-thing-state
4 Likes

Wow these are some great suggestions and considerations! My hub arrives tomorrow so I’ll be hard at work in putting this thing together step by step.

If I do decide to go with the NFC rout (or a less complicated utilization of for simplicity sake), I do have one more important quandary that I’m trying to figure out. While the majority of the household is on Android, I have one user on iPhone. As far as I can think of right now, the only way to account for him would be a presence sensor. Motion wouldn’t be entirely accurate especially if the user is asleep in the room for a long period of time (yeah of course if I cover the rooms, but that’s out of my range atm. Only considering dominate traffic areas). Then there’s the problem of users (guests) who have neither Android or iPhone aka relatives from out of town.

Maybe there’s a creative use for a sensor (possibly maybe even similar to @JDRoberts box/hat idea) that I’m not thinking about, or something similar to the state cube that I could utilize?

I highly recommend Life360 app as the easiest method for presence. The worst I can say about it is that it uses Geofence capabilities of your phone and requires a data connection (same as ST native, but way more reliable).

Also the fobs have been rock solid for me, false negative maybe once in the past nine months, they work best for those without a smart phone, and are a bit more quick to respond to changes than the Geofence methods.

I just got some NFC tags today, and I was successfully able to integrate them to perform some SmartThings tasks (specifically locking and unlocking my front door) using the Tasker and Trigger appa on Android.

Everything worked great, but if didn’t occur to me that NFC only works if your phone is unlocked (a safety/security feature). That’s not a huge deal, but I just hadn’t thought of it before I tried it. Just something to keep in mind that you’ll have to unlock your phone first.

1 Like

There are ways to get NFC to work when your phone is off. I forget how off the top of my head, but when I was looking at using NFC tags more I found some program out there that allowed my phone to do NFC stuff when the screen was off.

There are definitely ways around it, but for security reasons, I think it’s a very good feature. I wouldn’t want to open up a security hole that would make you susceptible to some kind of theft. It just adds an extra step in this case.