Can't pass an integer from input_number to an action

i’m doing a fingerprint sensor based on R503 sensor + ESPHome. In test mode everything works. The issue appeared when i wanted to make a dashboard for final integration.

There are some actions that require providing some parameters. Let’s take Enroll action, to add new fingerprints. This requires integer finger_id and num_scans.

If i manually trigger tha action in DevTools and use it’s input boxes for params - everything works.
If i hardcode the values in dashboard button - everything works again.

        cards:
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: perform-action
              perform_action: esphome.esphome_door_enroll
              data:
                finger_id: 6
                num_scans: 2
              target: {}
            name: Enroll
            icon: mdi:fingerprint

but i need an 'input" element where i can type the finger_it i want to add or delete. Here i have issues i cannot yet solve.
image

when finger_id is assigned any values from input elements, i get this error:
“Failed to perform the action esphome/esphome_door_enroll. expected int for dictionary value @ data[‘finger_id’]”

        cards:
          - show_name: true
            show_icon: true
            type: button
            tap_action:
              action: perform-action
              perform_action: esphome.esphome_door_enroll
              data:
                finger_id: {{  states('input_number.finger_id_input') | int }}
                num_scans: 2
              target: {}
            name: Enroll
            icon: mdi:fingerprint

this is ESPHome config:

# Enable Home Assistant API
api:

  actions:
  - action: enroll
    variables:
      finger_id: int
      num_scans: int
    then:
      - fingerprint_grow.aura_led_control:
          state: ALWAYS_ON
          color: YELLOW
          speed: 0
          count: 0
      - fingerprint_grow.enroll:
          finger_id: !lambda 'return finger_id;'
          num_scans: !lambda 'return num_scans;'

it’s been weeks since i try to get it through myself, but i need help.

You probably need quotes:

finger_id: "{{  states('input_number.finger_id_input') | int }}"

but if that doesn’t work try and make it a script and have the dashboard run the script

1 Like

@Hellis81 thanks. A separate script runs the same Lambda without issues. :fist_right: :fist_left: