How to make a button reset a counter (lovelace)

Hi all

I have an automation that increments a counter everytime the mailbox is opened so I can see if I got mail, but I stuggling to get a rest to work.

what I want is to have a button in lovelace, that resets the counter, this is my current card setup:

type: horizontal-stack
cards:

  • type: entity
    entity: counter.mailcounter
    icon: ‘mdi:mailbox-up-outline’
    name: Post Tæller
  • type: button
    tap_action:
    action: call-service
    service: counter.reset
    hold_action:
    action: more-info
    show_icon: true
    show_name: true
    entity: counter.mailcounter
    name: Reset Post

when I press the button it should call the service "counter reset on the entity: counter.mailcounter
but i just get an error message telling me that i need to include an entity id. but i cant see where to put that and how.
I have read the counter help on homeassistants wiki but it didnt help on that part.
hope you can help

Please format your text as code. Use three backticks ( ``` ) above and below the code.

Regardless, adding

service_data:
  entity_id: xxx

is what you need. See here

i have read that part but i cant understand where to put that particulat line of code, it doesnt matter where i put it, it just tells me “no”

this i what i have, the “null” is put there by homeassistant:

type: button
tap_action:
  action: call-service
  service: counter.reset
hold_action:
  action: more-info
show_icon: true
show_name: true
entity: counter.mailcounter
service_data: null
entity_id: counter.mailcounter
name: Reset Post

It goes under tap_action:, indented two spaces

thank you that did it