Dishwasher pod counter at restart

Hello. I have a Haier dishwasher integrated in Home Assistant whose app counts the pods but they are not integrated as entity.

I created a counter and an automation:

alias: Pastillas lavavajillas -> Restar
description: ""
trigger:
  - type: value
    platform: device
    device_id: 6bbb4534cfcde563428e59165c66c41d
    entity_id: 14224a4d9dc0fa8b88b5f7d62eb0816f
    domain: sensor
    below: 1
condition: []
action:
  - service: input_number.decrement
    data: {}
    target:
      entity_id: input_number.pastillas_lavavajillas
mode: single

It just waits until the dishwasher is about to end and it substract one. It works fine but I don’t know why, when HA restarts, the counter goes to 79.

Any help?

It’s solved. I didn’t see I set an “initial” tag in the counter. Removed and now I have no problem.