Home Assistant Tags

Thanks vbflo, you are correct double, triple checked and found a dodgy DuPont cable with intermittent O/C.

Replaced it and am up and running again.

Now my pack of printable NFC cards arrived.

But I still canā€™t read the long tag id on a NFC card with the tag reader. It only displays (in the esphome tagreader log and in the ā€œmanage tagsā€ section in HA) a short 4 bytes tag id", e.g. "27-BC-D3-C7.

My phone instead reads a log tag id from the card and is able to write a long tag id on the card, and this is also added as a tag in the ā€œmanage tagsā€ section in HA, e.g. ā€œ077f2a8a-f6e1-4b40-9a68-9e5b3e147bd2ā€.

Is perhaps my understanding wrong? Canā€™t I read the tags on my tag reader which are written by my phone and vice versa? Any other experiences?

Oops, didnā€™t read former messages in this thread close enough, as the answer is in message #42. Sorry.

My tag reader project is coming together one piece at a time. I got the PN532 figured out finally (ugh). I had it set up on the nodemcu hardware spi bus (pins D5, D6, D7, and D8) but the damn thing would not boot up. I ended up trying pins D0/1/2/3 instead and that works great.

Iā€™m installing this at a main entry point in my driveway; I already have a gate and a powered latch with a keypad entry there. The keypad has a dry contact that when closed also opens the gate, so i will use the relay to control entry that way.

Iā€™ll have a motion sensor on each side of the gate to help with automations (open gate from the inside when we leave out the back door, open gate from the outside when I arrive home). Iā€™ll also have a button on the inside that can be used to manually open the gate if needed.

The card reader will be the main point of access control, and I plan on giving family members tag stickers for inside phone cases (while preparing for this project, I realized we all always have our phones with us, so that seemed like the logical place for a tag).

Still waiting on my buzzer and LEDā€™s that way I can provide some feedback. Iā€™m also thinking Iā€™ll use the buzzer to send out a warning tone when an unknown tag gets scanned. I have a camera pointed at the spot too, so Iā€™m also planning on capturing a snapshot each time the gate is opened. This is going to be so cool! My wife is like uhhhhhh ok, I guess that will be cool?

I hope someone can help out:
what am I missing - I already (ā€œupā€ graded to the dev version)
[v1.16.0-dev ]
component_not_found


pn532_i2c: [source /config/esphome/tagreader01.yaml:137]
  
  Component not found: pn532_i2c.

yaml in use tagreader.yaml

how/where to get this pn532_i2c component files?

Thank you

Kind Regards,
Dieter

Is there a pn532_i2c component in esphome?

All I found was spi. https://esphome.io/components/binary_sensor/pn532.html#nfc-rfid-tag

Use this code, i think the I2c is experimental for now.

# Insert your SSID and Your PWD after inital setup
wifi:
  networks:
#    - ssid: !secret wifi_ssid          # Uncomment this line (remove # at beginning of line) and enter your details in secrets.yaml file!
#      password: !secret wifi_password  # Uncomment this line (remove # at beginning of line) and enter your details in secrets.yaml file!
  ap:
    ssid: ${devicename}

# Enable the captive portal for inital WiFi setup
captive_portal:

substitutions:
  devicename: tagreader
  friendly_name: TagReader

esphome:
  name: $devicename
  platform: ESP8266
  board: d1_mini

# If buzzer is enabled, notify on api connection success
  on_boot:
    priority: -10
    then:
    - wait_until:
        api.connected:
    - logger.log: API is connected!
    - rtttl.play: "success:d=24,o=5,b=100:c,g,b"

# Define switches to control LED and buzzer from HA
switch:
- platform: template
  name: "${friendly_name} Buzzer Enabled"
  id: buzzer_enabled
  icon: mdi:volume-high
  optimistic: true
- platform: template
  name: "${friendly_name} LED enabled"
  id: led_enabled
  icon: mdi:alarm-light-outline
  optimistic: true

# Enable logging
logger:

# Enable Home Assistant API
api:
  services:
  - service: rfidreader_tag_ok
    then:
    - rtttl.play: "beep:d=16,o=5,b=100:b"

  - service: rfidreader_tag_ko
    then:
    - rtttl.play: "beep:d=8,o=5,b=100:b"

  - service: play_rtttl
    variables:
      song_str: string
    then:
    - rtttl.play: !lambda 'return song_str;'

# Enable OTA upgrade
ota:

# Enable SPI interface
spi:
  clk_pin: D0
  miso_pin: D1
  mosi_pin: D2

# Configure the PN532 module
pn532:
  cs_pin: D3
  update_interval: 2s

  # What happens when a tag is read
  on_tag:
    then:
    - homeassistant.tag_scanned: !lambda 'return x;'
    - if:
        condition:
          switch.is_on: buzzer_enabled
        then:
        - rtttl.play: "success:d=24,o=5,b=100:c,g,b"
    - if:
        condition:
          switch.is_on: led_enabled
        then:
        - light.turn_on:
            id: activity_led
            brightness: 100%
            red: 0%
            green: 100%
            blue: 0%
            flash_length: 500ms

# Define the buzzer output
output:
- platform: esp8266_pwm
  pin: D8
  id: buzzer

binary_sensor:
  - platform: status
    name: "${friendly_name} Status"

# Define buzzer as output for RTTTL
rtttl:
  output: buzzer

# Configure LED
light:
- platform: fastled_clockless
  chipset: WS2812
  pin: D7
  default_transition_length: 10ms
  num_leds: 1
  rgb_order: GRB
  id: activity_led
  name: "${friendly_name} LED"
  restore_mode: ALWAYS_OFF

Hi all,
first of all really thank you for your quick replies.
But I did order the ā€œall readyā€ tag reader from adonno :wink:
it has a really nice 3d printed case and even I thought the price was/is very high I ordered one because this time I didnt want to ā€œbuild/solderā€ it myself.
But when I connected it nothing happened. Iā€™m already in contact with adonno and was already offered a new one - but Iā€™m really interested in whats wrong and obviously the code in use is different as it is using i2c instead of spi which you can also see here have a look at the wireing ->


vs

From what I understand - I would need to resolder the entire thing - and add wires if I want to use spi correct?
I really would like the i2c route - any help is really appriciated.

Sorry for my english.

have a nice day to all

and
Kind Regards,
Dieter

could you try to flash this bin https://github.com/adonno/tagreader/files/5362204/tagreader-i2c.zip ?

that is currently on a dev branch of ESPHome.

working

now it is working. it booted into captive portal and connection to homeassistant went fine- but if I now want to update it via esphome- what yaml should I use and which version and so on?

Thank you!

Hi adonno,
even after deleting everything within the esphome folder and fresh install the dev addon - it still complains about pn532_i2c.
I still dont get it how I can compile it via esphome myself. What do I need to to?
thank you.

2020-10-15_16-12-43

Hi dawass,

So it looks like you are using the yaml from my PR, but not altering your esphome install to get the pn532_i2c component. The instructions are in the PR description. https://github.com/adonno/tagreader/pull/52

The devices being sent out do have an I2C version, but do not have the NDEF code as they are being flashed with an earlier version that is known to work as the NDEF version still has a few bugs which can cause device reboots on bad reads and writes which I am still working on.
They are using the ESPHome branch from this pr: https://github.com/esphome/esphome/pull/1302

Thanks
Jesse

1 Like

thx will check tomorrow and update :wink: have a great evening!

Why is everyone going for i2c over spi?

In my case, Iā€™ve asked @jesserockz to try and get it working with I2C since it will provide fewer wires for soldering.

Also At the very beginning, we were having a lot of issues with the SPI connection and the NDEF library. I thought that might be related to the antenna of the PN532 interfering with the D1.

Jesse is working to get SPI & I2C available but as he already said itā€™s a work in progress. Have a look at the issue for further information and the history https://github.com/adonno/tagreader/issues/44

1 Like

Hey jesse,

thank you. it works flawlessly!

2 Likes

Hi,

I made the prototype and test it. everything is ok but after a few minutes i hear the buzzer and then no more scan can be done.
Like if it shutdown ou hibernateā€¦

I have to launch the show logs on esphome flasher to wake up ā€¦ else nothing works

If i plug it directly into the wall plug, here is my log :

[D][switch:029]: 'TagReader Buzzer Enabled' Toggling ON.e
[D][switch:045]: 'TagReader Buzzer Enabled': Sending state ONe
[D][switch:029]: 'TagReader LED enabled' Toggling ON.e
[D][switch:045]: 'TagReader LED enabled': Sending state ONe
[D][light:264]: 'TagReader LED' Setting:e
[D][light:273]:   State: ONe
[D][light:303]:   Transition Length: 0.0se
[D][light:264]: 'TagReader LED' Setting:e
[D][light:273]:   State: OFFe
[D][light:303]:   Transition Length: 0.0se
[D][main:117]: API is connected!e
[D][rtttl:037]: Playing song successe
[D][binary_sensor:036]: 'TagReader Status': Sending state ONe
[D][rtttl:093]: Playback finishede
[D][api.connection:604]: Client 'Home Assistant 0.116.4 (192.168.100.245)' connected successfully!e
[I][ota:046]: Boot seems successful, resetting boot loop counter.e

seems to be good but no scan is possible, the pn532 doesnā€™t buz or react in log

@MarkB1 Wake Up command failed! was due to the cable ? because i saw that in my log

Could you help ?

i got it wok with node red :wink:

So I treated myself to a new, and cheaper since the 12 release, iPhone 11 and gave my iPhone 7 to the wife :grinning:

It is much easier and quicker to set up Tags using the built in shortcuts App and to use HomeKit to toggle things like lights etc on/off. I did have a Tag as a test with my old phone but do not see a reason to use it via HA when shortcuts is quicker and a lot easier to get working.

I have deleted the old Tag in HA but when I scan it the Shortcuts App will run first then HA will still open up even though it is not configured and the automation deleted. Seems as if they stay resident even after deletion. I have restarted HA and took a dig around .storage but could see nothing there that would cause it to be remembered.

See here

Image

Doh! - Issue is solved. I had formatted the card with a HomeAssistant URL using the NXP Writer App. Formatting the TAG has stopped the HA App from opening now :joy:

Any updates on shipping? I ordered one on September 25th.