
Titel: Fingerprint R503 & NFC Tag Reader PN532 – Verkabelung & Einrichtung in ESPHome & Home Assistant
Möchtest du den Fingerprint-Sensor R503 und den NFC Tag Reader PN532 in dein Smart Home integrieren? In unserem neuesten YouTube-Video zeigen wir dir Schritt für Schritt, wie du die Geräte verkabelst und in ESPHome sowie Home Assistant einrichtest.
Was dich im Video erwartet:
✅ Detaillierte Verkabelungsanleitung für R503 & PN532
✅ Einrichtung in ESPHome mit den passenden YAML-Codes
✅ Integration in Home Assistant für eine einfache Nutzung
Hier der YAML-Code:
substitutions:
name: fingerprint_tagreader
friendly_name: Fingerprint TagReader
esp32:
board: esp32doit-devkit-v1
framework:
type: arduino
esphome:
name: $name
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
- switch.turn_on: buzzer_enabled
- switch.turn_on: led_enabled
wifi:
networks:
- ssid: "Fritz!Box 7590"
password: "XXXXXXX"
power_save_mode: none
output_power: 20dB
manual_ip:
static_ip: 192.168.178.17
gateway: 192.168.178.1
subnet: 255.255.255.0
ap:
ssid: "FingerprintEingang"
password: "muckel18"
captive_portal:
logger:
level: DEBUG
# Enable Web server
web_server:
port: 80
ota:
platform: esphome
uart:
rx_pin: GPIO16 # Gelb
tx_pin: GPIO17 # Violett
baud_rate: 57600
api:
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
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:
fingerprint_grow:
sensing_pin: GPIO5 # Blau
password: 0x00000000
on_finger_scan_matched:
- logger.log: "scan matched"
- text_sensor.template.publish:
id: fingerprint_state
state: "Autorisierter Fingerabdruck"
- delay: 1s
- text_sensor.template.publish:
id: fingerprint_state
state: "Warte"
- fingerprint_grow.aura_led_control:
state: BREATHING
speed: 200
color: BLUE
count: 1
- light.turn_on:
id: activity_led
brightness: 100%
red: 0%
green: 100%
blue: 0%
- switch.turn_on: buzzer_enabled
- rtttl.play: "success:d=24,o=5,b=100:c,g,b" # Warnton Erfolgreich (kann angepasst werden)
- delay: 2s # Warte einige Sekunden, um die Erfolgsanzeige anzuzeigen
- light.turn_off: # LED ausschalten nach dem Erfolg
id: activity_led
- switch.turn_off: # Buzzer ausschalten nach dem Erfolg
id: buzzer_enabled
on_finger_scan_unmatched:
- logger.log: "scan unmatched"
- text_sensor.template.publish:
id: fingerprint_state
state: "Unautorisierter Fingerabdruck"
- fingerprint_grow.aura_led_control:
state: FLASHING
speed: 25
color: RED
count: 2 # LED blinkt rot, um einen Fehler anzuzeigen
- light.turn_on: # LED rot leuchten bei negativer Erkennung
id: activity_led
brightness: 100%
red: 100%
green: 0%
blue: 0%
- switch.turn_on: buzzer_enabled # Buzzer einschalten für den Warnton
- rtttl.play: "failure:d=24,o=5,b=100:c,d,e,f" # Warnton (kann angepasst werden)
- delay: 3s # Warnton für 3 Sekunden abspielen
- light.turn_off: # LED ausschalten nach dem Warnton
id: activity_led
- switch.turn_off: # Buzzer ausschalten nach dem Warnton
id: buzzer_enabled
- delay: 1s
- text_sensor.template.publish:
id: fingerprint_state
state: "Warte"
on_enrollment_scan:
- text_sensor.template.publish:
id: fingerprint_state
state: "Fingerabdruck erfasst"
- fingerprint_grow.aura_led_control:
state: FLASHING
speed: 25
color: BLUE
count: 2
- fingerprint_grow.aura_led_control:
state: ALWAYS_ON
speed: 0
color: GREEN
count: 0
on_enrollment_failed:
- text_sensor.template.publish:
id: fingerprint_state
state: "Erfassung des Fingerabdrucks fehlgeschlagen"
- fingerprint_grow.aura_led_control:
state: FLASHING
speed: 25
color: RED
count: 4
# Optionaler Vorlagentextsensor für visuelles Feedback
text_sensor:
- platform: template
id: fingerprint_state
name: "Fingerabdruck Status"
- platform: version
hide_timestamp: true
name: "${friendly_name} ESPHome Version"
entity_category: diagnostic
- platform: wifi_info
ip_address:
name: "${friendly_name} IP Address"
icon: mdi:wifi
entity_category: diagnostic
ssid:
name: "${friendly_name} Connected SSID"
icon: mdi:wifi-strength-2
entity_category: diagnostic
binary_sensor:
- platform: fingerprint_grow
id: fingerprint_enrolling
name: "Fingerabdruck erfassen"
- platform: status
name: "${friendly_name} Status"
entity_category: diagnostic
- platform: pn532
uid: "6B-D8-B4-19"
name: "Luis-Tag"
- platform: pn532
uid: "04-49-5B-42-F8-61-80"
name: "Felix-Tag"
- platform: pn532
uid: "DB-6F-03-3D"
name: "Suse-Tag"
sensor:
- platform: fingerprint_grow
fingerprint_count:
name: "Fingerabdruck Zähler"
id: fingerprint_count
last_finger_id:
name: "Letzte Fingerabdruck ID"
last_confidence:
name: "Zuverlässigkeit des letzten Fingerabdrucks"
status:
name: "Fingerabdruckstatus"
capacity:
name: "Abdruckkapazität"
security_level:
name: "Sicherheitsstufe"
switch:
- platform: template
name: "${friendly_name} Buzzer Enabled"
id: buzzer_enabled
icon: mdi:volume-high
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
entity_category: config
- platform: template
name: "${friendly_name} LED enabled"
id: led_enabled
icon: mdi:alarm-light-outline
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
entity_category: config
button:
- platform: restart
name: "${friendly_name} Restart"
entity_category: config
#NFC PN532
i2c:
sda: GPIO21 # Orange
scl: GPIO22 # Gelb
scan: true
id: bus_a
frequency: 400kHz
# PN532 Tag Reader ## Lambda LED leuchtet Rot bei unbekannten Tag
pn532_i2c:
id: pn532_board
on_tag:
then:
- lambda: |-
std::string known_tags[] = {"6B-D8-B4-19", "04-49-5B-42-F8-61-80", "DB-6F-03-3D"};
bool known = false;
for (auto &tag : known_tags) {
if (tag == x) {
known = true;
break;
}
}
if (known) {
ESP_LOGD("tagreader", "Bekannter Tag erkannt");
id(rtttl_buzzer).play("hallo:d=24,o=5,b=100:c,e,g");
auto call = id(activity_led).turn_on();
call.set_rgb(0, 1, 0);
call.perform();
} else {
ESP_LOGD("tagreader", "Unbekannter Tag erkannt");
id(rtttl_buzzer).play("failure:d=24,o=5,b=100:c,d,e,f");
delay(2000);
auto call = id(activity_led).turn_on();
call.set_rgb(1, 0, 0);
call.perform();
}
- delay: 2s
- light.turn_off:
id: activity_led
output:
- platform: ledc
pin: GPIO26
id: buzzer_output
rtttl:
id: rtttl_buzzer
output: buzzer_output
# Configure LED
light:
- platform: neopixelbus
variant: WS2812
pin: GPIO19
num_leds: 1
id: activity_led
flash_transition_length: 500ms
type: GRB
name: "${friendly_name} LED"
restore_mode: ALWAYS_OFF
Template:
{% set personid = states('sensor.letzte_fingerabdruck_id') | int(default=-1) %}
{% if personid == 0 or personid == 1 or personid == 2 or personid == 3 %}
Felix
{% elif personid == 4 or personid == 5 or personid == 6 or personid == 7 %}
Suse
{% elif personid == 8 or personid == 9 or personid == 10 or personid == 11 %}
Luis
{% else %}
Unknown
{% endif %}
Automatisierung
alias: Klingel + NFC + Fingerprint
description: ""
triggers:
- entity_id:
- binary_sensor.haustuer_klingel_visitor
from: "off"
to: "on"
id: klingel_gedrückt
trigger: state
- entity_id:
- sensor.fingerabdruck_status
to: Autorisierter Fingerabdruck
id: fingerprint_registriert
trigger: state
from: Warte
- entity_id:
- binary_sensor.luis_tag
- binary_sensor.felix_tag
- binary_sensor.suse_tag
to: "on"
id: nfc_tag_gescannt
trigger: state
from: "off"
conditions: []
actions:
- choose:
- conditions:
- condition: trigger
id: klingel_gedrückt
sequence:
- parallel:
- choose:
- conditions:
- condition: state
entity_id: sun.sun
state: below_horizon
sequence:
- target:
entity_id: light.haustur_licht
data: {}
action: light.turn_on
- delay:
seconds: 60
- target:
entity_id: light.haustur_licht
data: {}
action: light.turn_off
enabled: true
- sequence:
- target:
entity_id: camera.haustuer_klingel_sub
data:
filename: >-
/config/www/doorbell/camera.haustuer_klingel_{{zeitpunkt}}.jpg
action: camera.snapshot
- data:
message: Jemand steht vor der Tür - {{zeitpunkt}}
title: Es hat geklingelt
data:
image: >-
https://haXXXXX.shys-XXXXX.de/local/doorbell/camera.haustuer_klingel_{{zeitpunkt}}.jpg
ttl: 0
priority: high
action: notify.mobile_app_pixel_8_pro
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- target:
entity_id: media_player.wohnzimmer
data:
entity: camera.haustuer_klingel_sub
force: true
action: webrtc.dash_cast
- target:
entity_id: media_player.kuche
data:
entity: camera.haustuer_klingel_sub
force: true
action: webrtc.dash_cast
- target:
entity_id: media_player.esszimmer
data:
entity: camera.haustuer_klingel_sub
force: true
action: webrtc.dash_cast
- target:
entity_id: media_player.badezimmer_oben
data:
entity: camera.haustuer_klingel_sub
force: true
action: webrtc.dash_cast
- target:
entity_id: media_player.schlafzimmer
data:
entity: camera.haustuer_klingel_sub
force: true
action: webrtc.dash_cast
- delay:
seconds: 45
- target:
entity_id: media_player.media_gruppe
action: media_player.turn_off
data: {}
- conditions:
- condition: trigger
id: nfc_tag_gescannt
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{{ trigger.entity_id in ['binary_sensor.luis_tag',
'binary_sensor.felix_tag', 'binary_sensor.suse_tag'] }}
sequence:
- action: lock.open
target:
entity_id: lock.haustur
data: {}
- choose:
- conditions:
- condition: state
entity_id: sun.sun
state: below_horizon
sequence:
- target:
entity_id: light.haustur_licht
action: light.turn_on
data: {}
- delay:
seconds: 60
- target:
entity_id: light.haustur_licht
action: light.turn_off
data: {}
- choose:
- conditions:
- condition: template
value_template: >
{{ trigger.entity_id == 'binary_sensor.luis_tag'
and (is_state('person.felix', 'not_home') and
is_state('person.susan', 'not_home')) }}
sequence:
- data:
title: Luis hat die Tür geöffnet
message: Luis hat mit seinem NFC-Tag die Tür geöffnet.
action: notify.notify
- conditions:
- condition: template
value_template: >-
{{ trigger.event.data.tag_id not in ['Luis-Tag',
'Suse-Tag', 'Felix-Tag'] }}
sequence:
- data:
message: >-
Unbekannter NFC-Tag erkannt: {{
trigger.event.data.tag_id }}
title: Sicherheitswarnung
action: notify.mobile_app_pixel_8_pro
- conditions:
- condition: trigger
id: fingerprint_registriert
- condition: template
value_template: >-
{{ states('sensor.letzter_fingerabdruck_name') in ['Felix',
'Suse', 'Luis'] }}
sequence:
- action: lock.open
target:
entity_id: lock.haustur
data: {}
- choose:
- conditions:
- condition: state
entity_id: sun.sun
state: below_horizon
sequence:
- target:
entity_id: light.haustur_licht
action: light.turn_on
data: {}
- delay:
seconds: 60
- target:
entity_id: light.haustur_licht
action: light.turn_off
data: {}
- choose:
- conditions:
- condition: template
value_template: >-
{{ states('sensor.letzter_fingerabdruck_name') == 'Luis'
and (is_state('person.felix', 'not_home') and
is_state('person.susan', 'not_home')) }}
sequence:
- data:
title: Luis hat die Tür geöffnet
message: >-
Luis hat seinen Fingerabdruck registriert und die Tür
geöffnet.
action: notify.notify
mode: parallel
variables:
zeitpunkt: "{{ now().strftime(\"%H_%M_%S\") }}"
Pinbelegung
Dieser Code zeigt die Grundkonfiguration für die Anbindung der Geräte in ESPHome. Im Video gehen wir detailliert auf jede Zeile ein und erklären die Funktion der einzelnen Komponenten.
🔗 Schau dir das Video an und richte dein Smart Home noch smarter ein: Fingerprint R503 + PN532
Hast du Fragen oder Anregungen? Schreib uns gerne in die Kommentare! 😊