Call Service with input_number / float from input_number needed

Hi,
I want to configure my Energymeter(esphome) from Lovelace UI with an input_number helper.
I added this service call to my esphome yaml und testet the service call. It is working fine

# Set pulse counter total from home assistant using this service call:
api:
  services:
    - service: set_pulse_total
      variables:
        new_pulse_total: float
      then:
        - pulse_counter.set_total_pulses:
            id: pulse_counter_id
            value: !lambda 'return new_pulse_total;'

I am now trying to activate this call from a Button in the UI and getting the value from the input helper.

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: esphome.energymeter_set_energy_total_og
  target: {}
  data:
    new_energy_total: '{{ states(''input_number.energy_total_og'') | float }}' 

But I always get the following message:

Can anyone help me with that issue?
How do I get the float value from the input_number?

Maybe try:

show_name: true
show_icon: true
type: button
tap_action:
  action: call-service
  service: esphome.energymeter_set_energy_total_og
  target: {}
  data_template:
    new_energy_total: "{{ states('input_number.energy_total_og') | float }}"

Sadly not working

Found the solution.

I dont know why, but somehow this is not working in combination with the tap_action.
Instead it is working with a script. This script can be called by a tap_action.
Found the solution here:

alias: Energie_OG_Calibrate
sequence:
  - service: esphome.energymeter_set_energy_total_og
    data:
      new_energy_total: "{{ states( 'input_number.energy_total_og' ) }}"
mode: single