I’m attempting to set up a raspberry Pi with an rc522 RFID reader to track physical items with RFID tags attached to them. The only problem is that node.js and rc522 - npm can only read the permanent RFID serial number at this time. Airtable API only allows the update function to find an existing entry by it’s record id. I can put the RFID serial number in a field for each item, but I am unaware of any way to query that field. So, I need to find a way to change the record ID to the permanent RFID serial number or update without the record id.
What I want to write:
var rc522 = require(“rc522”);
var Airtable = require(‘airtable’);
var base = new Airtable({apiKey: ‘my api key’}).base(‘my app id’);
rc522(function(rfidSerialNumber){
console.log(rfidSerialNumber);
base(‘base name’).replace(’(rfidSerialNumber)’,{
“field name”: “the thing that I’m changing”,
}, {typecast: true}, function (err, record) {
if (err) { console.error(err): return; }
})
});
I know the (rfidSerialNumber) works with the API as a variable because I can put it in as a field and it gets put into the base correctly, but I need it to be the unique id. Ideally, I would just change the record ID to match the serial number of the RFID tag. Maybe that’s really easy? Or I can create a view that has all of the items listed and fetch the record id that has the RFID’s serial in a field associated with it? (like: fetch record id containing “(rfidSerialNumber)”) All I’m trying to do is set up a system to click an item on an rfid scanner to change it’s location to that scanners location. If there’s a scanner in the safe for example, we click an item on that scanner and Airtable updates to say “in safe” in the location field for that item. Any help would be appreciated.