With node red sequence:
[{"id":"907645a9.63a318","type":"file in","z":"ebaa69a9.649708","name":"","filename":"/config/.storage/tag","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":370,"y":2240,"wires":[["8d13f7ee.92c858"]]},{"id":"ea6a6141.d6cb6","type":"inject","z":"ebaa69a9.649708","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":2240,"wires":[["907645a9.63a318"]]},{"id":"8d13f7ee.92c858","type":"json","z":"ebaa69a9.649708","name":"","property":"payload","action":"","pretty":false,"x":550,"y":2240,"wires":[["3c8f4821.07a408"]]},{"id":"3c8f4821.07a408","type":"function","z":"ebaa69a9.649708","name":"","func":"var arr = {};\n\nfor (let value of msg.payload.data.items) {\n arr[value.tag_id] = value.name;\n}\nmsg.arr = arr;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":700,"y":2240,"wires":[["c165a8fa.6281c8","87225d05cb08334e"]]},{"id":"c165a8fa.6281c8","type":"debug","z":"ebaa69a9.649708","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":910,"y":2300,"wires":[]},{"id":"87225d05cb08334e","type":"ha-entity","z":"ebaa69a9.649708","name":"","server":"4bbca37b.1700ec","version":2,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"RFID tags"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""},{"property":"last_reset","value":""}],"state":"","stateType":"date","attributes":[{"property":"tags","value":"arr","valueType":"msg"}],"resend":true,"outputLocation":"payload","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"","outputPayloadType":"str","x":890,"y":2220,"wires":[[]]},{"id":"4bbca37b.1700ec","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]
I can get an entity in HA with all the tags:
Now in an automation I can use a template to get the name of the scanned tag.
alias: New Automation
description: ''
mode: single
trigger:
- platform: event
event_type: tag_scanned
condition: []
action:
- service: notify.mobile_app_YOUR_PHONE
data:
message: '{{ state_attr(''sensor.rfid_tags'', ''tags'')[trigger.event.data.tag_id] }}'
The node red sequence does not run by itself, it would need to be either initiated by a file watcher that looks for changes on the file or something else, or just manual as it is now.