ESP32+RFID+Losant

Hello, I haven’t seen much in this forum relating to RFID on the Losant platform. I’m using an ESP32 with an RC522 and I am able to read cards just fine, and I have the ESP32 connected to Losant and the ESP32 is programmed with Arduino. I want to be able to read an RFID tag and generate an action based on what RFID tag is read. How can I pass the card ID into Losant to generate an action? Specifically I’m looking for what code is necessary on the Arduino side that interacts with Losant.
Thanks for your help,
Steve

Hi @Steve_Ermish!

Just a couple of questions to help me better assist you with your use case. You say you want to generate an action based on RFID, would this action occur in the Losant platform? You mentioned you are connected to Losant, have you successfully reported state to Losant?

There currently exists a walkthrough for the ESP32, are you referencing it while programming your device?

Thanks,
Julia

Hi, thanks for your reply. I was able to figure it out and send the RFID tag ID to Losant using sendState.

Also, note the tutorials reference ArduinoJson 5 and are different for ArduinoJson 6. Below are code examples of the syntax changes.

ArduinoJson 5
StaticJsonBuffer<200> jsonBuffer;
JsonObject& root = jsonBuffer.createObject();

ArduinoJson 6
StaticJsonDocument<200> jsonBuffer;
JsonObject state = jsonBuffer.to();