Helper 'drops' sometimes to 0?

I’ve created a helper to change a shelly UNI Plus counter towards a water class (L) to be used in the energy board. Now, sometimes, this counter drops to 0, what gives a huge amount of water usuage. Any idea what I’m doing wrong?

The counter itself:

The helper:

The result in the energyboard:
image

This is my template:

{{ states('sensor.waterpomp3000l_counter_value') | float(0) }}

Why are you using a helper at all?

All you are doing is copying the state value.

If you do have a reason then this is the bit you need to remove to prevent the drops to 0:

|float(0)
1 Like

I´ve made the helper to convert the shelly sensor (sensor.waterpomp3000l_counter_value) to a water class. So I can use that on the energy board.

You don’t need a template sensor to add a device class. Just do this:

configuration.yaml

homeassistant:
# there may be other stuff here, but add the following (noting the indentation):
  customize: !include customize.yaml

Then in customize.yaml

sensor.waterpomp3000l_counter_value:
  device_class: water
  state_class: total

# other entities to customize can be added to this file.

See: https://www.home-assistant.io/integrations/homeassistant/#manual-customization

1 Like

Just for my understanding.
Any pro/cons between the customer.yaml or helper method?

Guess with the helper method, I’m having an entity extra?

Yeah basically that’s it, no unneeded duplication.

1 Like