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