I have the following setup:
- Wemos D1 Mini
- 0.98 TFT display
- R503 Fingerprint reader (brown wire)
I am using this device to disarm the alarm system and to see the lock status. It worked earlier with Dfrobot’s reader, but the aura control was not working completely with it.
This combination works in the beginning, but quite soon the device becomes unresponsive. I cannot see the web portal nor I can connect to see the logs. The aura keeps breathing.
I have also tried to use ESP32 WROOM, but it had the same problems. I have also tried to use different pins, but since the display uses D1 and D2, to my understanding D5, D6 and D7 are the only usable ones.
Any ideas?
esphome:
name: fprint
friendly_name: fprint
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
globals:
- id: fp_status
type: int
restore_value: yes
initial_value: "0"
# 0: Ready
# 1: Recognized
# 2: Unknown
# 3: Enrollment scan
# 4: Enrollment finished
# 5: Enrollment error
- id: fp_id
type: int
- id: fp_scan
type: int
ota:
password: "(highly secret)"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.0.110
gateway: 192.168.0.1
subnet: 255.255.255.0
dns1: 192.168.0.1
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Fprint Fallback Hotspot"
password: "(verysecret)"
web_server:
port: 80
captive_portal:
uart:
rx_pin: GPIO16
tx_pin: GPIO17
baud_rate: 57600
i2c:
sda: GPIO21
scl: GPIO22
# frequency: 800kHz
font:
- file: "gfonts://Roboto"
id: roboto
size: 20
- file: 'fonts/materialdesignicons-webfont.ttf'
id: icon_font
size: 40
glyphs:
- "\U000F0FC6" # lock open
- "\U000F033E" # lock closed
- "\U000F012C" # check
- "\U000F0028" # error
- "\U000F0237" # fingerprint
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
flip_x: false
flip_y: false
id: oled
lambda: |-
switch (id(fp_status)) {
case 0:
it.print(0, 0, id(roboto), "Ready");
if (id(alarm_enabled).state) {
it.print(0, 35, id(roboto), "ARMED");
} else {
it.print(0, 35, id(roboto), "DISARMED");
}
if (strcmp(id(door_locked).state.c_str(), "locked")) {
it.print(90, 0, id(icon_font), TextAlign::TOP_LEFT, "\U000F0FC6");
} else {
it.print(90, 0, id(icon_font), TextAlign::TOP_LEFT, "\U000F033E");
}
break;
case 1:
it.print(0, 0, id(roboto), "Welcome");
it.print(90, 0, id(icon_font), TextAlign::TOP_LEFT, "\U000F012C");
it.print(0, 35, id(roboto), "Ville");
break;
case 2:
it.print(0, 0, id(roboto), "Go away");
it.print(90, 0, id(icon_font), TextAlign::TOP_LEFT, "\U000F0028");
it.print(0, 35, id(roboto), "Stranger");
break;
case 3:
it.print(0, 0, id(roboto), "Enroll");
it.printf(0, 35, id(roboto), "Round %d", id(fp_scan));
it.print(90, 0, id(icon_font), TextAlign::TOP_LEFT, "\U000F0237");
break;
case 4:
it.print(0, 0, id(roboto), "Enroll");
it.print(0, 35, id(roboto), "Finished");
it.print(90, 0, id(icon_font), TextAlign::TOP_LEFT, "\U000F0237");
break;
case 5:
it.print(0, 0, id(roboto), "Enroll");
it.print(0, 35, id(roboto), "Failed");
it.print(90, 0, id(icon_font), TextAlign::TOP_LEFT, "\U000F0028");
break;
}
fingerprint_grow:
sensing_pin: GPIO4
on_finger_scan_start:
- fingerprint_grow.aura_led_control:
state: BREATHING
speed: 200
color: BLUE
count: 0
on_finger_scan_matched:
- fingerprint_grow.aura_led_control:
state: FLASHING
speed: 50
color: GREEN
count: 4
- homeassistant.event:
event: esphome.fpdoor_finger_scan_matched
data:
finger_id: !lambda 'return finger_id;'
confidence: !lambda 'return confidence;'
- lambda: id(fp_status) = 1;
- lambda: id(fp_id) = finger_id;
- homeassistant.service:
service: input_boolean.turn_off
data:
entity_id: input_boolean.alarm_enabled
- delay: 1000 ms
- lambda: id(fp_status) = 0;
- fingerprint_grow.aura_led_control:
state: BREATHING
speed: 200
color: BLUE
count: 0
on_finger_scan_unmatched:
- fingerprint_grow.aura_led_control:
state: FLASHING
speed: 25
color: RED
count: 4
- lambda: id(fp_status) = 2;
- homeassistant.event:
event: esphome.fpdoor_finger_scan_unmatched
- delay: 1000 ms
- lambda: id(fp_status) = 0;
- fingerprint_grow.aura_led_control:
state: BREATHING
speed: 200
color: BLUE
count: 0
on_enrollment_scan:
- lambda: id(fp_status) = 3;
- lambda: id(fp_scan) = scan_num;
- homeassistant.event:
event: esphome.fpdoor_enrollment_scan
data:
finger_id: !lambda 'return finger_id;'
scan_num: !lambda 'return scan_num;'
on_enrollment_done:
- lambda: id(fp_status) = 4;
- homeassistant.event:
event: esphome.fpdoor_enrollment_done
data:
finger_id: !lambda 'return finger_id;'
- delay: 2000 ms
- lambda: id(fp_status) = 0;
on_enrollment_failed:
- lambda: id(fp_status) = 5;
- homeassistant.event:
event: esphome.fpdoor_enrollment_failed
data:
finger_id: !lambda 'return finger_id;'
- delay: 2000 ms
- lambda: id(fp_status) = 0;
sensor:
- platform: fingerprint_grow
status:
name: "Status"
last_finger_id:
name: "Last fingerprint"
last_confidence:
name: "Last confidence"
text_sensor:
- platform: homeassistant
id: savervars
entity_id: saver.saver
attribute: variables
- platform: homeassistant
id: fpname
entity_id: input_text.fingerprint_learning_name
- platform: homeassistant
id: door_locked
entity_id: lock.lock_frontyard
binary_sensor:
- platform: homeassistant
id: alarm_enabled
entity_id: input_boolean.alarm_enabled
# Enable Home Assistant API
api:
encryption:
key: "(evenmoresecret)"
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: