Set counter value equals to other counter in automation

What suppous to be super simple action it just does not work for me.
I want to clone the value of a counter from an other one in an action on automation.
the code is

service: counter.configure
data_template:
  value: '{{states('counter.aux_ac_pieza')}}'
target:
  entity_id: counter.aux_ac_pieza_cambio

It just does not work!

value: '{{states(''counter.aux_ac_pieza'')}}'

I cant make it working in latest HA version from the UI, e.g:

      - show_name: true
        show_icon: false
        type: button
        tap_action:
          action: call-service
          service: counter.configure
          data:
            value: '{{ states(''input_number.new_value'')}}'
          target:
            entity_id: counter.my_counter
        name: Reset
      - type: entities
        entities:
          - entity: input_number.new_value
            name: To
        show_header_toggle: true

Error message:

Failed to call service counter/configure. expected int for dictionary value @ data['value']

What could be wrong?

Same action can be executed from Developper tools succesfully.

Home Assistant’s standard set of cards don’t support templates (except for the Markdown card).

Make your Button card call a script containing your service call.

1 Like