NFC reader fails to read anything

Hi all,

I’ve built the NFC reader as described on https://github.com/adonno/tagreader. I’ve copied the Tagreader.yaml from there, filled in my wifi details and flashed the thing trough espflasher. All fine and dandy: Home Assistant recognized a new device with four entities (tag reader buzzer enabled, tag reader led enabled, tag reader led and tag reader status). I can control the light from Lovelace and sound the buzzer after calling on a specific service.

However: no tags are recognized. I’ve written them with the iOS app and my phone recognizes all of them instantly and performs the connected automation. The reader however does nothing with none of the cards or NFC dongles. No blinking led, no sound from the buzzer, no indication whatsoever anywhere that it’s listening for tags or that it found one. I’m wondering: do I have a faulty PN532 board or am I missing something else? (Yes, the switches on the board are on (1) and off (2).)

My yaml:

# Insert your SSID and Your PWD after inital setup
wifi:
  networks:
    - ssid: XXX          # Uncomment this line (remove # at beginning of line) and enter your details in secrets.yaml file!
      password: XXX  # 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"
    - light.turn_on:
        id: activity_led
        brightness: 100%
        red: 0%
        green: 0%
        blue: 100%
        flash_length: 500ms

# 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:
  # level: VERY_VERBOSE
  # level: VERBOSE

# 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:

i2c:
  scan: False
  frequency: 400kHz

pn532_i2c:
  id: pn532_board
  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: D7
  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: D8
  default_transition_length: 10ms
  num_leds: 1
  rgb_order: GRB
  id: activity_led
  name: "${friendly_name} LED"
  restore_mode: ALWAYS_OFF

HI
i have the same problem

I am just about to try this but I am not sure how to use that .yaml file. I did clone the ESPHome github into my VSCode with Platform IO, but the directions just say “Point ESPHome at this YAML” but I am not sure how that is done?

If you can clue me in on how that happens, I can join you in the testing :smiley:

Wait… I might be over doing things… Looks like what I needed to do is install the ESPHome Add-On, and let my HA running on my Pi 4 do the compiling with that YAML… I totally missed that connection.

[17:12:00][D][pn532:159]: Found new tag '59-29-4D-B2'
[17:12:27][D][pn532:159]: Found new tag 'E7-F1-D0-C6'

OK, so it reads tags :smiley:

  1. Add the ESPHome dev git branch to the Add-Ons Repository so I see the ESPHome-DEV train.
  2. Install the ESPHome-Dev module. Then Start it.
  3. Copy the secrets.yaml content to the SECRETS editor using the 3 dots menu in the upper right hand of the ESPHome UI.
  4. Copy the tagreader.yaml to the /config/esphome directory, and uncomment the referent to the secrets file (two lines at the head of the file)
  5. Exit the ESPHome UI and return to it, it now sees the module TagReader.
  6. Validate the YAML by clicking the “Validate” button. Goes through with no issues.
  7. Build the code on the module using the 3 dots menu in upper right “Compile”, it throws a few yellow warnings only, and build the ELF Binary.
  8. As I have an RPI for HA, I choose to Download the Binary to my PC for burning with NODEMCU Flasher.
  9. Reboot the D1Mini, and watch the module in ESPHome go green on the top border.
  10. Select Logs on the module card, and see my module get an IP address and a slew of other boot messages.
  11. Pass my sample Card and Fob near the reader and get the output above.

Hope this helps someone having issues.

I’ve elaborated my findings in an issue on Github. Long story short: I get the same ‘found new tag’ message in the logs but this does not trigger the correct automation. The automation works if I scan the tag through my phone, so automation.yaml is correct.

Probably you should put the “substitutions” part on top in your .yaml file above the “wifi” part
as described in: