Hi,
I have an ESPHOME project ongoing for my garage control using a NFC Reader and Fingerprint reader (a rotary encoder for reading the garage doorsw position and some other digital IOs)
Generically it works, but I have response issues with the NFC and Fingerprint reader and the publishing of the NFC text sensor to HA
NFC Reader PN532 connected via I2C
- it seems sometimes to not recognize the NFC tag (If I hold the NFC tag in front of the reader every 3 seconds it only recognizes sometime only one Tag)
- Message “Component pn532 took a long time for an operation (68 ms).”
- although the log shows detecting a NFC reader with the ID - the corresponing text sensor in HA is not always updated (sometimes not within 5 minutes)
Fingerprint Reader R307 connected via serial
- repeated message: “Component fingerprint_grow took a long time for an operation (324 ms).”
I don’t know if this is a too complex setup, but the from memory perspective is seems OK.
#RAM: [= ] 7.8% (used 41472 bytes from 532480 bytes)
#Flash: [===== ] 54.5% (used 1000705 bytes from 1835008 bytes)
Has someone an suggestion what to do to debug further?
Many thanks,
Rainer
YAML ---------------------------
#ESPHOME Garagentorsteuerung
#Stand 01.04.2025
# Konfiguration:
# Digital Input 2x
# - Reed Relay
# GPIO34
# GPIO35
# - Rotary Encoder
# GPIO13 # cable white
# GPIO14 # cable green
# Digital Output 2x
# - Relay
# GPIO26
# GPIO27
# - LED
# GPIO25 #Status Alive LED
# I2C
# sda: GPIO21
# scl: GPIO22
# - devices
# Luminescent sensor bh1750 0x23
# NFC Reader PN532-Mod #adresse 0x24
# Uart:
# tx_pin: GPIO17 #cable green
# rx_pin: GPIO16 #cabe yellow
# -devices
# Fingerprint Reader R307
esphome:
name: garagentorsteuerung
friendly_name: Garagentorsteuerung
on_boot:
priority: -100
then:
- output.turn_on: StatusLED_slow_blink
- output.set_level:
id: StatusLED_slow_blink
level: "50%"
esp32:
# https://registry.platformio.org/platforms/platformio/espressif32/boards?version=5.3.0
board: az-delivery-devkit-v4
framework:
type: arduino
# Enable logging
logger:
level: debug # keep empty otherwise
# Enable Home Assistant API
api:
encryption:
key: !secret GS_api_key
services:
- service: enroll
variables:
finger_id: int
num_scans: int
then:
- fingerprint_grow.enroll:
finger_id: !lambda 'return finger_id;'
num_scans: !lambda 'return num_scans;'
- service: enroll_next # Idea by Ralf Klüber (thanks!)
variables:
num_scans: int
then:
- fingerprint_grow.enroll:
finger_id: !lambda 'return id(fingerprint_count).state;'
num_scans: !lambda 'return num_scans;'
- service: cancel_enroll
then:
- fingerprint_grow.cancel_enroll:
- service: delete
variables:
finger_id: int
then:
- fingerprint_grow.delete:
finger_id: !lambda 'return finger_id;'
- service: delete_all
then:
- fingerprint_grow.delete_all:
ota:
- platform: esphome
password: !secret GS_ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "GSFallbackHotspot"
password: !secret GS_ap_password
captive_portal:
# https://esphome.io/components/i2c
# https://lastminuteengineers.com/esp32-pinout-reference/
i2c:
- id: i2c0
sda: GPIO21
scl: GPIO22
scan: true
frequency: 400kHz # 10 kHz Minimale Frequenz möglich-------------------------------
# https://github.com/esphome/esphome-docs/blob/59eaa4f9ff7a9c84b30aaadd9f40f3fd3defeeb2/components/sensor/sht4x.rst
# Address 0x70
# https://esphome.io/components/sensor/bh1750
# Address 0x23
# https://esphome.io/components/sensor/tof10120.html
# Address: 0x52
# Outputs
# https://esphome.io/components/switch/gpio.html
# Inputs
# https://esphome.io/components/binary_sensor/gpio.html#
# -------------------------------
# https://esphome.io/components/binary_sensor/pn532.html
pn532_i2c:
update_interval: 1s
on_tag:
then:
- text_sensor.template.publish:
id: rfid_tag
state: !lambda 'return x;'
# -------------------------------
#--------------------------------
# https://community.home-assistant.io/t/garage-fingerprint-sensor/312977
# https://esphome.io/components/fingerprint_grow.html
uart:
tx_pin: GPIO17 #green
rx_pin: GPIO16 # yellow
baud_rate: 57600
fingerprint_grow:
sensing_pin: GPIO5 # blue
update_interval: 0.5s #https://github.com/esphome/issues/issues/5608
sensor_power_pin:
number: GPIO18 # white
inverted: true
idle_period_to_sleep: 5s
on_finger_scan_matched:
- switch.turn_on: GS_Ouput_GPIO27
- fingerprint_grow.aura_led_control:
state: BREATHING
speed: 200
color: BLUE
count: 1
- text_sensor.template.publish:
id: fingerprint_state
state: "Authorized finger"
- delay: 1s
- switch.turn_off: GS_Ouput_GPIO27
on_finger_scan_unmatched:
- fingerprint_grow.aura_led_control:
state: FLASHING
speed: 25
color: BLUE #RED
count: 2
- text_sensor.template.publish:
id: fingerprint_state
state: "Unauthorized finger"
on_enrollment_scan:
- fingerprint_grow.aura_led_control:
state: FLASHING
speed: 25
color: BLUE
count: 2
- fingerprint_grow.aura_led_control:
state: ALWAYS_ON
speed: 0
color: PURPLE
count: 0
- text_sensor.template.publish:
id: fingerprint_state
state: "Finger scanned"
on_enrollment_done:
- fingerprint_grow.aura_led_control:
state: BREATHING
speed: 100
color: BLUE
count: 2
- text_sensor.template.publish:
id: fingerprint_state
state: "Enrolled fingerprint"
on_enrollment_failed:
- fingerprint_grow.aura_led_control:
state: FLASHING
speed: 25
color: RED
count: 4
- text_sensor.template.publish:
id: fingerprint_state
state: "Failed to enroll fingerprint"
text_sensor:
- platform: template
id: fingerprint_state
name: "Garage Fingerprint State"
- platform: template
name: "RFID Tag"
id: rfid_tag
#--------------------------------------------------
# Output
# https://lastminuteengineers.com/esp32-pinout-reference/
output:
- platform: gpio
pin: GPIO27
id: 'GPIO027'
- platform: gpio
pin: GPIO26
id: 'GPIO026'
- platform: slow_pwm
pin: GPIO25
id: StatusLED_slow_blink
period: 2s
switch:
- platform: output
name: "GS Ouput GPIO27"
id: GS_Ouput_GPIO27
output: 'GPIO027'
- platform: output
name: "GS Output GPIO26"
id: GS_Ouput_GPIO26
output: 'GPIO026'
# Inputs
binary_sensor:
- platform: gpio
pin: GPIO34
name: "GS Input DPIO34"
id: GS_Input_GPIO34
device_class: door
on_release: # change from logic 1 to 0, "on_press" is 0 to 1
then:
- sensor.rotary_encoder.set_value:
id: GS_Rotary_Encoder
value: 0
# - below: 0.5 # or reset below bottom end stop
# then:
# - sensor.rotary_encoder.set_value:
# id: GS_Rotary_Encoder
# value: 0
- platform: gpio
pin: GPIO35
name: "GS Input DPIO35"
id: GS_Input_GPIO35
device_class: door
sensor:
- platform: rotary_encoder
name: "GS Rotary Encoder"
id: GS_Rotary_Encoder
pin_a: GPIO13 # white
pin_b: GPIO14 # green
on_clockwise:
- logger.log: "Turned Clockwise"
on_anticlockwise:
- logger.log: "Turned Anticlockwise"
filters:
- or:
- throttle: 30s
- delta: 10
- platform: bh1750
name: "BH1750 Illuminance"
id: GS_I2C_BH1750_Illuminance
address: 0x23
update_interval: 60s
#sensor:
- platform: fingerprint_grow
fingerprint_count:
name: "Garage Fingerprint Count"
id: fingerprint_count
last_finger_id:
name: "Garage Fingerprint Last Finger ID"
last_confidence:
name: "Garage Fingerprint Last Confidence"
status:
name: "Garage Fingerprint Status"
capacity:
name: "Garage Fingerprint Capacity"
security_level:
name: "Garage Fingerprint Security Level"
Debugger LOG output ---------------------------
INFO ESPHome 2025.3.3
INFO Reading configuration /config/esphome/garagentorsteuerung.yaml...
WARNING GPIO5 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Starting log output from 192.168.1.181 using esphome API
INFO Successfully connected to garagentorsteuerung @ 192.168.1.181 in 0.049s
INFO Successful handshake with garagentorsteuerung @ 192.168.1.181 in 0.091s
[10:07:52][I][app:100]: ESPHome version 2025.3.3 compiled on Apr 1 2025, 09:33:21
[10:07:52][C][wifi:600]: WiFi:
[10:07:52][C][wifi:428]: Local MAC: D8:BC:38:E4:6C:C8
[10:07:52][C][wifi:433]: SSID: '217x205'[redacted]
[10:07:52][C][wifi:436]: IP Address: 192.168.1.181
[10:07:52][C][wifi:440]: BSSID: 44:4E:6D:14:E2:24[redacted]
[10:07:52][C][wifi:441]: Hostname: 'garagentorsteuerung'
[10:07:52][C][wifi:443]: Signal strength: -28 dB ▂▄▆█
[10:07:52][C][wifi:447]: Channel: 6
[10:07:52][C][wifi:448]: Subnet: 255.255.255.0
[10:07:52][C][wifi:449]: Gateway: 192.168.1.1
[10:07:52][C][wifi:450]: DNS1: 192.168.1.1
[10:07:52][C][wifi:451]: DNS2: 0.0.0.0
[10:07:52][C][logger:177]: Logger:
[10:07:52][C][logger:178]: Max Level: DEBUG
[10:07:52][C][logger:179]: Initial Level: DEBUG
[10:07:52][C][logger:181]: Log Baud Rate: 115200
[10:07:52][C][logger:182]: Hardware UART: UART0
[10:07:52][C][i2c.arduino:071]: I2C Bus:
[10:07:52][C][i2c.arduino:072]: SDA Pin: GPIO21
[10:07:52][C][i2c.arduino:073]: SCL Pin: GPIO22
[10:07:52][C][i2c.arduino:074]: Frequency: 400000 Hz
[10:07:52][C][i2c.arduino:086]: Recovery: bus successfully recovered
[10:07:52][I][i2c.arduino:096]: Results from i2c bus scan:
[10:07:52][I][i2c.arduino:102]: Found i2c device at address 0x23
[10:07:52][I][i2c.arduino:102]: Found i2c device at address 0x24
[10:07:52][C][uart.arduino_esp32:151]: UART Bus 1:
[10:07:52][C][uart.arduino_esp32:152]: TX Pin: GPIO17
[10:07:52][C][uart.arduino_esp32:153]: RX Pin: GPIO16
[10:07:52][C][uart.arduino_esp32:155]: RX Buffer Size: 256
[10:07:52][C][uart.arduino_esp32:157]: Baud Rate: 57600 baud
[10:07:52][C][uart.arduino_esp32:158]: Data Bits: 8
[10:07:52][C][uart.arduino_esp32:159]: Parity: NONE
[10:07:52][C][uart.arduino_esp32:160]: Stop bits: 1
[10:07:52][C][template.text_sensor:020]: Template Sensor 'Garage Fingerprint State'
[10:07:52][C][template.text_sensor:020]: Template Sensor 'RFID Tag'
[10:07:52][C][gpio.output:010]: GPIO Binary Output:
[10:07:52][C][gpio.output:011]: Pin: GPIO27
[10:07:52][C][gpio.output:010]: GPIO Binary Output:
[10:07:52][C][gpio.output:011]: Pin: GPIO26
[10:07:52][C][output.slow_pwm:054]: Slow PWM Output:
[10:07:52][C][output.slow_pwm:055]: Pin: GPIO25
[10:07:52][C][output.slow_pwm:065]: Period: 2000 ms
[10:07:52][C][output.slow_pwm:066]: Restart cycle on state change: NO
[10:07:52][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'GS Input DPIO35'
[10:07:52][C][gpio.binary_sensor:015]: Device Class: 'door'
[10:07:52][C][gpio.binary_sensor:016]: Pin: GPIO35
[10:07:52][C][gpio.binary_sensor:015]: GPIO Binary Sensor 'GS Input DPIO34'
[10:07:52][C][gpio.binary_sensor:015]: Device Class: 'door'
[10:07:52][C][gpio.binary_sensor:016]: Pin: GPIO34
[10:07:52][C][output.switch:068]: Output Switch 'GS Ouput GPIO27'
[10:07:52][C][output.switch:091]: Restore Mode: always OFF
[10:07:52][C][output.switch:068]: Output Switch 'GS Output GPIO26'
[10:07:52][C][output.switch:091]: Restore Mode: always OFF
[10:07:52][C][pn532:431]: PN532:
[10:07:52][C][pn532:443]: Update Interval: 1.0s
[10:07:52][C][pn532_i2c:125]: Address: 0x24
[10:07:52][C][fingerprint_grow:537]: GROW_FINGERPRINT_READER:
[10:07:52][C][fingerprint_grow:538]: System Identifier Code: 0x0200
[10:07:52][C][fingerprint_grow:540]: Touch Sensing Pin: GPIO5
[10:07:52][C][fingerprint_grow:542]: Sensor Power Pin: GPIO18
[10:07:52][C][fingerprint_grow:544]: Idle Period to Sleep: 5000 ms
[10:07:52][C][fingerprint_grow:548]: Update Interval: 0.5s
[10:07:52][C][fingerprint_grow:550]: Fingerprint Count 'Garage Fingerprint Count'
[10:07:52][C][fingerprint_grow:550]: State Class: ''
[10:07:52][C][fingerprint_grow:550]: Unit of Measurement: ''
[10:07:52][C][fingerprint_grow:550]: Accuracy Decimals: 0
[10:07:52][C][fingerprint_grow:550]: Icon: 'mdi:fingerprint'
[10:07:52][C][fingerprint_grow:551]: Current Value: 1
[10:07:52][C][fingerprint_grow:554]: Status 'Garage Fingerprint Status'
[10:07:52][C][fingerprint_grow:554]: State Class: ''
[10:07:52][C][fingerprint_grow:554]: Unit of Measurement: ''
[10:07:52][C][fingerprint_grow:554]: Accuracy Decimals: 0
[10:07:52][C][fingerprint_grow:555]: Current Value: 2
[10:07:52][C][fingerprint_grow:558]: Capacity 'Garage Fingerprint Capacity'
[10:07:52][C][fingerprint_grow:558]: State Class: ''
[10:07:52][C][fingerprint_grow:558]: Unit of Measurement: ''
[10:07:52][C][fingerprint_grow:558]: Accuracy Decimals: 0
[10:07:52][C][fingerprint_grow:558]: Icon: 'mdi:database'
[10:07:52][C][fingerprint_grow:559]: Current Value: 1000
[10:07:52][C][fingerprint_grow:562]: Security Level 'Garage Fingerprint Security Level'
[10:07:52][C][fingerprint_grow:562]: State Class: ''
[10:07:52][C][fingerprint_grow:562]: Unit of Measurement: ''
[10:07:52][C][fingerprint_grow:562]: Accuracy Decimals: 0
[10:07:52][C][fingerprint_grow:562]: Icon: 'mdi:security'
[10:07:52][C][fingerprint_grow:563]: Current Value: 3
[10:07:52][C][fingerprint_grow:566]: Last Finger ID 'Garage Fingerprint Last Finger ID'
[10:07:52][C][fingerprint_grow:566]: State Class: ''
[10:07:52][C][fingerprint_grow:566]: Unit of Measurement: ''
[10:07:52][C][fingerprint_grow:566]: Accuracy Decimals: 0
[10:07:52][C][fingerprint_grow:566]: Icon: 'mdi:account'
[10:07:52][C][fingerprint_grow:567]: Current Value: 4294967295
[10:07:52][C][fingerprint_grow:570]: Last Confidence 'Garage Fingerprint Last Confidence'
[10:07:52][C][fingerprint_grow:570]: State Class: ''
[10:07:52][C][fingerprint_grow:570]: Unit of Measurement: ''
[10:07:52][C][fingerprint_grow:570]: Accuracy Decimals: 0
[10:07:52][C][fingerprint_grow:570]: Icon: 'mdi:account-check'
[10:07:52][C][fingerprint_grow:571]: Current Value: 4294967295
[10:07:52][C][rotary_encoder:164]: Rotary Encoder 'GS Rotary Encoder'
[10:07:52][C][rotary_encoder:164]: State Class: ''
[10:07:52][C][rotary_encoder:164]: Unit of Measurement: 'steps'
[10:07:52][C][rotary_encoder:164]: Accuracy Decimals: 0
[10:07:52][C][rotary_encoder:164]: Icon: 'mdi:rotate-right'
[10:07:52][C][rotary_encoder:165]: Pin A: GPIO13
[10:07:52][C][rotary_encoder:166]: Pin B: GPIO14
[10:07:52][C][rotary_encoder:180]: Restore Mode: Restore (Defaults to zero)
[10:07:52][C][rotary_encoder:184]: Resolution: 1 Pulse Per Cycle
[10:07:52][C][bh1750.sensor:118]: BH1750 'BH1750 Illuminance'
[10:07:52][C][bh1750.sensor:118]: Device Class: 'illuminance'
[10:07:52][C][bh1750.sensor:118]: State Class: 'measurement'
[10:07:52][C][bh1750.sensor:118]: Unit of Measurement: 'lx'
[10:07:52][C][bh1750.sensor:118]: Accuracy Decimals: 1
[10:07:52][C][bh1750.sensor:119]: Address: 0x23
[10:07:52][C][bh1750.sensor:124]: Update Interval: 60.0s
[10:07:52][C][captive_portal:089]: Captive Portal:
[10:07:52][C][mdns:116]: mDNS:
[10:07:52][C][mdns:117]: Hostname: garagentorsteuerung
[10:07:52][C][esphome.ota:073]: Over-The-Air updates:
[10:07:52][C][esphome.ota:074]: Address: garagentorsteuerung.local:3232
[10:07:52][C][esphome.ota:075]: Version: 2
[10:07:52][C][esphome.ota:078]: Password configured
[10:07:52][C][safe_mode:018]: Safe Mode:
[10:07:52][C][safe_mode:020]: Boot considered successful after 60 seconds
[10:07:53][C][safe_mode:021]: Invoke after 10 boot attempts
[10:07:53][C][safe_mode:023]: Remain in safe mode for 300 seconds
[10:07:53][C][api:140]: API Server:
[10:07:53][C][api:141]: Address: garagentorsteuerung.local:6053
[10:07:53][C][api:143]: Using noise encryption: YES
[10:07:56][D][fingerprint_grow:533]: Fingerprint sensor is now in sleep mode.
[10:07:57][D][fingerprint_grow:125]: Scan and match
[10:07:57][D][fingerprint_grow:156]: Getting image 1
[10:07:58][E][fingerprint_grow:509]: Timed out waiting for sensor wake-up
[10:07:58][D][fingerprint_grow:168]: Finger Misplaced
[10:07:58][W][component:237]: Component fingerprint_grow took a long time for an operation (320 ms).
[10:07:58][W][component:238]: Components should block for at most 30 ms.
[10:08:03][D][fingerprint_grow:533]: Fingerprint sensor is now in sleep mode.
[10:08:04][D][fingerprint_grow:125]: Scan and match
[10:08:04][D][fingerprint_grow:156]: Getting image 1
[10:08:04][E][fingerprint_grow:509]: Timed out waiting for sensor wake-up
[10:08:04][D][fingerprint_grow:168]: Finger Misplaced
[10:08:04][W][component:237]: Component fingerprint_grow took a long time for an operation (383 ms).
[10:08:04][W][component:238]: Components should block for at most 30 ms.
[10:08:09][D][pn532:364]: Mifare classic
[10:08:09][E][pn532.mifare_classic:101]: Authentication failed - Block 0x04
[10:08:09][D][text_sensor:064]: 'RFID Tag': Sending state 'FE-4C-FD-EC'
[10:08:09][D][pn532:200]: Found new tag 'FE-4C-FD-EC'
[10:08:09][D][pn532:379]: Waiting to read next tag
[10:08:09][W][component:237]: Component pn532 took a long time for an operation (121 ms).
[10:08:09][W][component:238]: Components should block for at most 30 ms.
[10:08:09][D][fingerprint_grow:533]: Fingerprint sensor is now in sleep mode.
[10:08:10][D][fingerprint_grow:125]: Scan and match
[10:08:10][D][fingerprint_grow:156]: Getting image 1
[10:08:11][E][fingerprint_grow:509]: Timed out waiting for sensor wake-up
[10:08:11][D][fingerprint_grow:168]: Finger Misplaced
[10:08:11][W][component:237]: Component fingerprint_grow took a long time for an operation (323 ms).
[10:08:11][W][component:238]: Components should block for at most 30 ms.
[10:08:13][D][pn532:364]: Mifare classic
[10:08:13][E][pn532.mifare_classic:101]: Authentication failed - Block 0x04
[10:08:13][D][text_sensor:064]: 'RFID Tag': Sending state 'FE-4C-FD-EC'
[10:08:13][D][pn532:200]: Found new tag 'FE-4C-FD-EC'
[10:08:13][D][pn532:379]: Waiting to read next tag
[10:08:13][W][component:237]: Component pn532 took a long time for an operation (110 ms).
[10:08:13][W][component:238]: Components should block for at most 30 ms.
[10:08:16][D][fingerprint_grow:533]: Fingerprint sensor is now in sleep mode.
[10:08:17][D][fingerprint_grow:125]: Scan and match
[10:08:17][D][fingerprint_grow:156]: Getting image 1
[10:08:17][E][fingerprint_grow:509]: Timed out waiting for sensor wake-up
[10:08:17][D][fingerprint_grow:168]: Finger Misplaced
[10:08:17][W][component:237]: Component fingerprint_grow took a long time for an operation (383 ms).
[10:08:17][W][component:238]: Components should block for at most 30 ms.
[10:08:22][D][fingerprint_grow:533]: Fingerprint sensor is now in sleep mode.
[10:08:23][D][fingerprint_grow:125]: Scan and match
[10:08:23][D][fingerprint_grow:156]: Getting image 1
[10:08:24][E][fingerprint_grow:509]: Timed out waiting for sensor wake-up
[10:08:24][D][fingerprint_grow:168]: Finger Misplaced
[10:08:24][W][component:237]: Component fingerprint_grow took a long time for an operation (324 ms).
[10:08:24][W][component:238]: Components should block for at most 30 ms.
[10:08:29][D][fingerprint_grow:533]: Fingerprint sensor is now in sleep mode.
[10:08:30][D][fingerprint_grow:125]: Scan and match
[10:08:30][D][fingerprint_grow:156]: Getting image 1
[10:08:30][E][fingerprint_grow:509]: Timed out waiting for sensor wake-up
[10:08:30][D][fingerprint_grow:168]: Finger Misplaced
[10:08:30][W][component:237]: Component fingerprint_grow took a long time for an operation (383 ms).
[10:08:30][W][component:238]: Components should block for at most 30 ms.
[10:08:35][D][bh1750.sensor:159]: 'BH1750 Illuminance': Got illuminance=151.4lx
[10:08:35][D][sensor:094]: 'BH1750 Illuminance': Sending state 151.44684 lx with 1 decimals of accuracy