adonno / tagreader

Simple to build/use NFC tag reader, specially created for Home Assistant
https://adonno.com
GNU General Public License v3.0
1.13k stars 175 forks source link

disable automatic tag addition #221

Open tempod opened 1 year ago

tempod commented 1 year ago

related to this issue (#189) I have an update. Only now I was able to do some tests but now if I don't activate the switch to add tags it doesn't read anything

adonno commented 1 year ago

indeed, that is the case based on your script. i am not sure how one could disable automatic tag addition, that is a thing managed by HA

36grad commented 1 year ago

Adding tags is done by home assistant's tag component. To work around this, I have installed the tag component as a custom component and then commented out the line that adds the tag to home assistant. It can be found in the file __init__.py in the function async_scan_tag which is located almost at the end of the file. Here you need to comment out the else part (for me that's line 128 and 129).

if tag_id in helper.data:
    await helper.async_update_item(tag_id, {LAST_SCANNED: dt_util.utcnow()})
#else:
    #await helper.async_create_item({TAG_ID: tag_id, LAST_SCANNED: dt_util.utcnow()})