Home Assistant Tags

Adonno’s creation is an NFC reader that triggers the new scan_tag home assistant event. It basically works equivlent to a cell phone for reading. (Except currently it only reads the card id, rather than the data, while the phone apps use the data rather than the id).

You should be able to make something similar for 125kHz RFID badges using the RDM6300 reader, slightly different wireing between the two components, and a slightly different esphome yaml file, although Adonno’s 3d printed cases might not be compatible with such a creation.

Once again, that would also be limited to reading the card id, not the data. (This is just a limitation of the ESPHome components. It would be entirely possible to read and send the data with a custom component if one wants to put in the effort to write a custom component.)

  1. Adonno’s ESPHome configuration currently does not yet support reading the content of the card, only the read-only id number from the header. This is a limitation of the card reader component in ESPHome. Android/IOS use an tag number encoded in the data.

    In the mean time, one possible work around is to first scan the card with the ESPHome device. Then use the Android or IOS to write that same card ID back to the body of the card. In theory that should make both recognize it as the same card.

  2. NFC is deliberately restricted by android when locked or screen off, such that apps cannot receive NCF intents while locked. It might be possible to bypass this while rooting the phone, but not in unmodified Android.

1 Like

Does anyone know if it’s possible to make a custom tag reader that does not rely on the ESPHome API? Taking a look at the code it does not seem possible to execute the scan_tag event oustide the esphome / companion api

In order for scanning a tag with a phone to work you need all of the following to be true:

  1. The phone has the home-assistant companion app installed.
  2. The companion app is connected to your home assistant installation (which requires signing in to your home assistant instance.)
  3. You need some sort of automation set up. The automation gets to know both the card ID, and the device_id. The device_id is determined by the integration that triggers the scan event. For the mobile_app integration, this is a unique value stored on the phone itself.

All that is stored on the card is a url that identifies that it is a home assistant tag, and includes the tag id.

Those are indeed the only two integrations that currently support tag scanning. For anything else, you would need to create a custom integration as of right now. I suppose you can always trigger the event manually from an automation, but that would not cause the last scanned time to be updated in the tag list.

Tags are super.
Does someone have a simple automation to toggle a light
I don’t know what the trigger is of a tag

There’s an example in the first post.

You can algo go in Configuration > Tags and click the Automation button, it’ll fill up all you need for the trigger.

Here you go, this is my test automation

alias: "Tag1 Scanned"
initial_state: True
mode: single
trigger:
  platform: event
  event_type: tag_scanned
  event_data:
    device_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    tag_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
action:
 - service: homeassistant.toggle
   entity_id: switch.bedroom_fan_switch
2 Likes

I just built mine! I had the D1 Mini, Buzzer, and WS2812 laying around, but picked up the NFC reader from Amazon (the HiLetGo PN532 kit) for $10. Totally blown away by the coolness of this project. And it was so easy! Except for one thing - getting the project to fit in the case. :smile:

I’m probably going to have to disassemble and re-solder with shorter pieces of wire, as I couldn’t get the case lid on with the first try.

But having everything work on the first try, with the LED, the buzzer, and the automation - so thrilled at how well this was implemented!

Thanks!!!

The tag implementation seems to rely exclusively on ESPHome based on the examples. To make this truly useful, there needs to be a way to feed tag data into it from any source. For example, MQTT. I have RFID readers at several entry points which publish to MQTT when a tag is scanned ( room/rfid/ = tagID ). Unfortunately not usable with the Tags integration.

3 Likes

I plan on doing the same but having a hard understanding how this project would be useful. Care to share how you plan on using it? I am now using NFC tags to trigger automations (one by the door to enable alarm etc.)

I have 3 kids, with the youngest being 2 years old. Since they don’t have phones, and have trouble communicating with Alexa or Siri, I plan on building lots of cards with pictures on them to play particular videos on the Chromecast (from Youtube or Plex) or their favorite music on the Sonos, or set their nightlight scenes with deCONZ lights and such. Also, we have a Roborock vacuum, so different cards that send it a particular room for sweeping (once they have their floors picked up). It’s really mainly going to be a computerless interface for anything and everything I have hooked up that gives kids easy access.

1 Like

You can also use your phone as a tag reader. That is what I am currently playing with. I just need some ideas for what to control by sticking tags around the place…

Does this need constant power in order to work? Or does it just need to be programmed. I would like to omit the led and buzzer.

edit: I get it now. The tags are low/no power. This device can scan multiple tags and phones.

edit2: can this work with an apple watch too?

Seems to me an automation to fire a tag scanned event on receipt of an mqtt message should be doable https://www.home-assistant.io/integrations/tag/#tag-scanned-events

I just conducted a wee experiment.

You can use a mqtt automation to trigger a tag_scanned event and trigger whatever.

There does not seem to be a service to actually trigger the Tag read event. Looks like you would have to post a RestFul command to the the home assistant API when triggered by an MQTT topic:

REST API | Home Assistant Developer Docs

How did you trigger the tag event?

Well I did it in developer-tools, but you can fire an event in an automation, in pseudo code

[trigger] when an mqtt message is received on the tag topic, [action] fire an event

This is the bit I can’t find a service for.