Issues with an increasing template sensor

Hi,
I’m trying to get a template sensor working for my oekofen pellet heater to convert my pellet usage into gas for the energy meter.

The state template I use:
{{ states(‘sensor.pellet_usage_today’) | float(default=0.0) | multiply(4.8) | round(1) }}

it works okay BUT the sensor keeps reporting wrong values that mess my whole energy calcualtion up:

I tried to fix it by limiting the value of the template sensor which is kinda pointless because I would need to limit the increase of a single step not the daily usage.
My stupid attempt to fix it:
{% set x = (states(‘sensor.pellet_usage_today’) | float(default=0.0) | multiply(4.8) | round(1)) %}
{{ ([0, x, 100]|sort)[1] }}

So does anybody have an idea how to filter those errors out?

Thanks a lot

Cheers

Nana

Hi nanashikun,

Availability sensors or filters will take flyers like that out.

Why an availability template is important for energy template sensors.

This “only” fixes wrong values when the sensor becomes unavailable, right?
How would I fix an error when the sensor returns a really high value? The pellematic condens returns 32000something while calibrating.