🚘 Garage Fingerprint Sensor


I ordered another esp on amazon tomorrow it should arrive and I’ll try again, if it doesn’t work then I’d like to understand why
 stay tuned :slight_smile:

Thank you for your sharing! I’m currently working on my own fingerprint sensor project and still have a few questions. How can I trigger different things with different fingers? It’s not entirely clear to me how to differentiate this in HA. A small example would definitely help me.
How can I set a minimum confidence so that fingerscans will only be accepted if the scan is better than 50? Does that make sense or does it have no impact on the safety of false positives?

The ESPHome docs have an example with the confidence and different things for each finger id. I would start from there and learn how ESPHome actions and triggers work

I’m not using a confidence threshold myself

Just received my fingerprint reader in the mail today, looking forward to setting this up!

1 Like

Hello, I have rebuilt the fingerprint sensor and it works quite well so far. I only have one small problem. Coupled with the sensor is an esp relay, which opens my garage door when the status goes to “wait”. Unfortunately, the relay switches sporadically without anyone touching the sensor, sometimes in the middle of the night. Could it be an error in the yaml configuration?

esphome:
  name: fingerprint
  friendly_name: fingerprint

esp8266:
  board: nodemcuv2

# Enable logging
logger:

ota:
  password: "80fa74e686b7d383a0aab1e785db6318"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Fingerprint Fallback Hotspot"
    password: "GX6Dj0GlKkJZ"

captive_portal:

uart:
  rx_pin: D1
  tx_pin: D0
  baud_rate: 57600
    
fingerprint_grow:
  sensing_pin: D2
  password: 0x00000000
  on_finger_scan_matched:
    - logger.log: "scan matched"
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Autorisierter Fingerabdruck"
    - delay: 3000ms
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Warten"
    - fingerprint_grow.aura_led_control:
        state: BREATHING
        speed: 200
        color: BLUE
        count: 1
  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
  on_enrollment_scan:
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Fingerabdruck erfasst"
    - 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: PURPLE
        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

api:
  encryption:
    key: "8hRDQQIOxwgssyZzLYfdeULLFtl40s+Qmdld68sNXSQ="
  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: 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: 
# Optionaler Vorlagentextsensor fĂŒr visuelles Feedback
text_sensor:
  - platform: template
    id: fingerprint_state
    name: "Fingerabdruck Status"

# Optionaler Vorlagentextsensor fĂŒr visuelles Feedback
binary_sensor:
  - platform: fingerprint_grow
    id: fingerprint_enrolling
    name: "Fingerabdruck erfassen"

  - platform: gpio
    name: "Binary Sensor"
    pin:
      number: D4  # Replace with the GPIO pin connected to the sensor
      mode: INPUT_PULLUP      # Change this if your sensor requires a different mode
    filters:
      - delayed_on: 20ms       # Replace X with the desired delay in milliseconds  

sensor:
  - platform: fingerprint_grow
    fingerprint_count:
      name: "Fingerabdruck ZĂ€hler"
    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"

  
    
  esphome:
  name: garage-relais
  friendly_name: Garage Relais

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "qdTicwlOkzsjby1dvOEZTD3M3VbQQv3wAV9W+ciMsdc="

ota:
  password: "ad433b7d877c9d258e1c7c36806c227c"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Garage-Relais Fallback Hotspot"
    password: "SQSB6ecpsUYY"

captive_portal:

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO2
      mode: INPUT_PULLUP
    name: "Garagentor Reed Kontakt 1"
    device_class: garage_door
    filters:
       - delayed_on_off: 500ms  

switch:
  - platform: gpio
    id: garage_switch
    pin: GPIO0
    name: "Garage switch"
    inverted: true
    restore_mode: ALWAYS_OFF
    on_turn_on:
    - delay: 2s
    - switch.turn_off: garage_switch


  # The following can be omitted
  - platform: restart
    name: restart

sensor:
  - platform: wifi_signal
    name: wifi signal
    update_interval: 600s

  # human readable uptime sensor output to the text sensor above
  - platform: uptime
    name: Uptime in Days
    id: uptime_sensor_days
    update_interval: 60s
    on_raw_value:
      then:
        - text_sensor.template.publish:
            id: uptime_human
            state: !lambda |-
              int seconds = round(id(uptime_sensor_days).raw_state);
              int days = seconds / (24 * 3600);
              seconds = seconds % (24 * 3600);
              int hours = seconds / 3600;
              seconds = seconds % 3600;
              int minutes = seconds /  60;
              seconds = seconds % 60;
              return (
                (days ? String(days) + "d " : "") +
                (hours ? String(hours) + "h " : "") +
                (minutes ? String(minutes) + "m " : "") +
                (String(seconds) + "s")
              ).c_str();

time:
  - platform: homeassistant
    id: homeassistant_time

# Text sensors with general information.
text_sensor:
  # Expose ESPHome version as sensor.
  - platform: version
    name: Version
  # Expose WiFi information as sensors.
  - platform: wifi_info
    ip_address:
      name: IP
    bssid:
      name: BSSID

  # human readable update text sensor from sensor:uptime
  - platform: template
    name: Uptime Human Readable
    id: uptime_human
    icon: mdi:clock-start
    

Maybe someone has a similar behavior

How do you trigger the switch with id garage_switch? Do you do that from Home Assistant?

The switch is triggered via an automation in homeassistant

alias: Garage öffnen
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.fingerprint_fingerabdruck_status
    to: Warten
condition: []
action:
  - type: turn_on
    device_id: 36078f83bd0da445dfb84772864a5e89
    entity_id: faa69e5f93cbef178fa953d31b1d7db4
    domain: switch
mode: single

Is there a reason you do it in Home Assistant? Because if you add the following to the ESP it will also be triggered and you can remove the automation from HA.

on_finger_scan_matched:
    - switch.turn_on: garage_switch

Doing it like that means that it will still work even when wifi is not available or your Home Assistant is down.

Thanks for the hint, but when I enter it like this, an error message comes up, it does not recognize the switch, even if I try it with the ID from the automation, it is recognized as if the switch does not exist, but it works via the automation.

Strange because in the switch itself you also got this piece of code which works fine I guess?

- switch.turn_off: garage_switch

But anyways, for the random triggering of your switch, it’s either coming from Home Assistant, or the relay itself is doing it. Is it wired correctly?

Ok, after a long search I’ve got it right. I have read that ESPHome nodes are separate entities, and they cannot directly reference components from other nodes. I have now done it via the service call

on_finger_scan_matched:
  - homeassistant.service:
      service: switch.turn_on
      data:
        entity_id: switch.garage_switch

Thanks again parrel

Oh, I thought the fingerprint scanner and the garage relay were on the same ESP, my bad! In that case, it’s fine to do it in Home Assistant itself, but that also works!

Hey,
How do you make a service for led control on the fingerscanner

  • service: led_control
    variables:
    status: string
    speed_id: int
    color_id: string
    count_id: int
    then:
    • fingerprint_grow.aura_led_control:
      state: !lambda ‘return status;’
      speed: !lambda ‘return speed_id;’
      color: !lambda ‘return color_id;’
      count: !lambda ‘return count_id;’

The error for this code is
/config/esphome/scan.yaml:59:14: error: cannot convert ‘std::__cxx11::string’ {aka ‘std::__cxx11::basic_string’} to ‘uint8_t’ {aka ‘unsigned char’} in return
state: !lambda ‘return status;’
^~~~~~
/config/esphome/scan.yaml: In lambda function:
/config/esphome/scan.yaml:61:14: error: cannot convert ‘std::__cxx11::string’ {aka ‘std::__cxx11::basic_string’} to ‘uint8_t’ {aka ‘unsigned char’} in return
color: !lambda ‘return color_id;’

I found this message in my esphome log, has anyone encountered such a problem, please provide a solution:
[16:57:44][W][component:214]: Component fingerprint_grow took a long time for an operation (0.98 s).
[16:57:44][W][component:215]: Components should block for at most 20-30ms.

and the fingerprint sensor is often unavailable,

Yes mine keeps disconnecting for about a minute or so. Then reconnects tried to reprogram code to see if that helps but still same. It was fine on ESPhome 2023.10.

i am using Firmware: 2023.11.6 (Dec 9 2023, 16:52:18),I don’t know what the cause is, but it’s annoying, I am using esp32s. Thank you for the information, but have you encountered a message like that?

For ESP32:

  • Red and white: 3V
  • Black: GND
  • Yellow: GPIO16
  • Green: GPIO17
  • Blue: GPIO05
    this shema not work for me, i change to :
    rx_pin: GPIO19
    tx_pin: GPIO21
    sensing_pin: GPIO4