Hello everyone.
I’m trying to make a sort of attendance system based on NFC tags. The idea would be to give each card a name and use that as its user’s ID. And because tags don’t have entities, I was considering writing the tag_scanned event to a file and process its data afterwards.
However, I can’t seem to find a way to do that. I’ve considered templates but I don’t know what to call for this, and even if there is something, it’s not a persistent state so I’m not sure it would even be possible.
I’ve also considered fetching the data from logs in the HA’s database but as far as I can tell they don’t contain the “data” part of the event, only the context.
Any help at all on this would be greatly appreciated.
I’m already using the File integration, my issue now is getting the right data written on it. Where you have sensors for various things, I’m trying to find an equivalent for tags. I’d need it to record the tag ID and time of scan (timestamp: true takes care of this).
I’ll try to explain the logic I need better:
trigger: event tag_scanned is detected with device_id=XXX
action: write data from the event that served as trigger to a file, in this case I only need tag_id
I don’t use tags but I would assume there is something generated as an event to trigger an automation so you should be able to extract the trigger event data and write that to the file in the actions.
Creating a group/array of variables with attributes and then searching it for the attribute data we want works perfectly as a condition.
attendance_logger is a yaml file I created to store these logs. With “timestamp=true” it has everything I need it to have (for now, at least).
The “tagreader” variable group is just so I can swap between those two devices and can be ignored.
Next I gotta figure out how to group the “tags” variables to use in different automations without editing each one when that group changes. Thank you for the help @finity