Passing attribute and call service - Fingerprint R503

Hi everyone
I configured my GROW R503 sensor with esphome:

uart:
  rx_pin: GPIO13
  tx_pin: GPIO14
  baud_rate: 57600

fingerprint_grow:
  sensing_pin: GPIO12
  on_finger_scan_matched:
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Impronta autorizzata"
    - delay: 3000ms
    - lambda: |-
        if (finger_id == 0) {
          id(fingerprint_username).publish_state("Fred");
        } else if (finger_id == 1) {
          id(fingerprint_username).publish_state("Gianni");
        } else {
          id(fingerprint_username).publish_state("Unknown");
        };
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Attesa"
    - fingerprint_grow.aura_led_control:
        state: BREATHING
        speed: 200
        color: BLUE
        count: 1
  on_finger_scan_unmatched:
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Impronta non autorizzata"
    - fingerprint_grow.aura_led_control:
        state: FLASHING
        speed: 25
        color: RED
        count: 2
  on_enrollment_scan:
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Impronta acquisita"
    - text_sensor.template.publish:
        id: fingerprint_state
        state: "Impronta acquisita"
    - 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: "Acquisizione impronta fallita"
    - fingerprint_grow.aura_led_control:
        state: FLASHING
        speed: 25
        color: RED
        count: 4

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:

# Optional template text sensor for visual feedback
text_sensor:
  - platform: template
    id: fingerprint_state
    name: "Stato impronta"

  - platform: template
    id:       fingerprint_username
    name:     "Ultima scansione"
    update_interval: 30s

# Optional sensors
binary_sensor:
  - platform: fingerprint_grow
    id: fingerprint_enrolling
    name: "Acquisendo impronta"

sensor:
  - platform: fingerprint_grow
    fingerprint_count:
      name: "Conta impronte"
    last_finger_id:
      name: "Ultimo ID impronta"
    last_confidence:
      name: "Affidabilità ultima impronta"
    status:
      name: "Stato impronta"
    capacity:
      name: "Capacità impronta"
    security_level:
      name: "Livello di sicurezza"

i want pass to service call esphome.esphome_fingerprint_ingresso_enroll, finger_id the value of input_number_id_impronta for adding a new fingerprint.

I write the value

image

this is lovelace card

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: esphome.esphome_fingerprint_ingresso_enroll
  target: {}
  data:
    finger_id: '{{ states(''input_number.id_impronta'') }}'
    num_scans: 2
name: Registra Impronta
icon: mdi:fingerprint
icon_height: 50px

help please…
Thank you :slight_smile:

1 Like

This thread has the best info on the R503.

1 Like