原帖https://bbs.hassbian.com/thread-15904-1-1.html
主要是我太笨了,没有弄成,所以用esphome搞了。
用ch9329模块,CFGO加跳帽,发送数据用ASCII码,用十六进制 比如0x0D是回车键
switch:
- platform: uart
id: switch1
uart_id: uart_2
name: "UART"
data: [0x78,0x32]
- platform: uart
id: switch2
uart_id: uart_2
name: "UART"
data: [0x0D]
uart:
- id: uart_1
rx_pin: GPIO3
tx_pin: GPIO1
baud_rate: 9600
- id: uart_2
tx_pin: GPIO2
baud_rate: 9600
# Declare Grow Fingerprint Reader
fingerprint_grow:
uart_id: uart_1
sensing_pin: GPIO5
on_finger_scan_matched:
- text_sensor.template.publish:
id: fingerprint_state
state: "Authorized finger"
- switch.turn_on: switch2
- delay: 2s
- switch.turn_on: switch1
on_finger_scan_unmatched:
- text_sensor.template.publish:
id: fingerprint_state
state: "Unauthorized finger"
on_enrollment_scan:
- text_sensor.template.publish:
id: fingerprint_state
state: "Finger scanned"
on_enrollment_done:
- text_sensor.template.publish:
id: fingerprint_state
state: "Enrolled fingerprint"
on_enrollment_failed:
- text_sensor.template.publish:
id: fingerprint_state
state: "Failed to enroll fingerprint"
# Optional template text sensor for visual feedback
text_sensor:
- platform: template
id: fingerprint_state
name: "Fingerprint State"
binary_sensor:
- platform: fingerprint_grow
id: fingerprint_enrolling
name: "Fingerprint Enrolling"
sensor:
- platform: fingerprint_grow
fingerprint_count:
name: "Fingerprint Count"
last_finger_id:
name: "Fingerprint Last Finger ID"
last_confidence:
name: "Fingerprint Last Confidence"
status:
name: "Fingerprint Status"
capacity:
name: "Fingerprint Capacity"
security_level:
name: "Fingerprint Security Level"
#hass服务调用,用于注册新指纹。
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: 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:
|