How to use utility meter based on a counter

I have a counter that every tick represents one 1L off consumed water. I’d like to use utility meters in order to count dalty, weekly, etc. consumption. But utility meter requires a sensor which a counter is not. Is there a way to do that?
Should’nt a counter be considered as a sensor as well?
Herebelow is the automation code to increment the counter at every tick

- id: 532445d2-a9a1-4a1d-9b6d-e7c14b82a666
  alias: Shelly Uni IN2
  description: ''
  - platform: state
    - binary_sensor.shelly_uni_channel_2_input
    from: "on"
    to : "off"
  condition: []
    service: counter.increment
      entity_id: counter.eau
  mode: queued

Try to use sensor template and add it to meter media.

Thank you for the hint

I have exact the same problem…

Can you give me your example code for sensor and automation…

Thank you…

I set up afterwards a template sensor as such:

  - sensor:
      - name: eau
        unit_of_measurement: m³
        device_class: water
        state_class: total_increasing
        state: "{{states('compteur_eau') | multiply(0.001) }}

Then this new sensor can be added to the energy panel. Go to settings/dashboard

This was my solution…

Thank you anyway…

Hi @damu I see I had exactly the same question this weekend
Being still pretty new to HA I do not understand your answer. Can you elaborate a bit?