LowPowerLab Forum

Software support => Pi Gateway => Topic started by: HeneryH on February 18, 2019, 10:42:35 AM

Title: RFID - card access control
Post by: HeneryH on February 18, 2019, 10:42:35 AM
I'm revisiting this old topic that I got started on a long time ago but had set aside.

Back then I had the Motes reading the key cards and sending the card id to the gateway just fine.  The Mote pretty easily interacts with RFID shields using I2C, reads cards and sends the data to the gateway.

The problem I had back then was figuring out how to get the gateway to properly react to the various card IDs.  I was hacking away at metrics files but it never seemed like a great fit for the job.

Hence, I set the project aside.

Now I am revisiting it again..  for another project I had created a sms_gateway side-app that would interact with SMS messages through Twilio and let users send sms commands to the gateway for actioning.  It was basically a side-loaded app that made socket connections to the real gateway and listened for metrics and sometimes send commands through the socket.

This scenario is very similar.  I could quickly replicate the side-loaded app that listens for RFID metrics.  I could use this side-load app to have a nedb database of valid card IDs and do a quick lookup.  Depending on the result I can send a command back to the gateway to open the door or not.  I could also use one of the quick web-ui for the database file to add or delete card ids to manage which cards are enabled.

I'll post the results here shortly.

Plan -
Title: Re: RFID - card access control
Post by: HeneryH on February 19, 2019, 02:09:52 PM
Working on the UI for the nedb database that contains Users/RFIDs that the system will authenticate.  Finding an easy web UI front-end to nedb isn't going as well as I hoped.
Title: Re: RFID - card access control
Post by: HeneryH on February 20, 2019, 06:16:44 PM
Got a nedb backed data store with an express based web ui running.

I now have a side-loaded app that connects to the gateway.js through a socket.  It then listens for metric updates from specified ID with a specified metric of "RFID:0x.......".

The side app then looks that RFID up in the nedb to see if it is enabled.  If enabled it then sends a command (through the socket) to another Mote to open the door.
Title: Re: RFID - card access control
Post by: Felix on February 20, 2019, 08:34:40 PM
Interesting, I'm watching this space, keep posting ;)
Title: Re: RFID - card access control
Post by: HeneryH on February 20, 2019, 09:40:51 PM
The side apps basically offload some custom processing that doesn't fit well within the standard gateway.js architecture.

There were two use-cases where this side-apps were useful to me and they both simply:

My two use-cases are:

I'll get the code cleaned up and post it here and also post a video of the results in action.

For both of these side-apps, I glued various sample code snippets together.  I glued together the following snippets