TOF10120 range sensor, wrong reading every 5-6 times

I have a TOF10120, that no matter what i do keeps making a wrong valve every 5-6 reading.

i tried the different filters: median, maximum quantile. But i still a wrong reading every 5-6 times.

Do anyone have an idea to how i can remove them?

I have a sensor which from time to time give a large negative value by error. Not as often as your sensor, however enough to make my graphs look wrong.
I have solved it by a template. If above 0, then use the value. If below 0, then set it to 0.

You could do the same, looking for numbers above 30 and assume they are false.

    asensor_power_corrected:
      value_template: >
        {%- if states('sensor.asensor_bb280037_electrical_measurement')|float(0) >= 0 -%}
        {{(states('sensor.asensor_bb280037_electrical_measurement'))}}
        {%- else -%}
        0
        {%- endif -%}
      unit_of_measurement: "W"
      friendly_name: "A Sensor Power Corrected for minus"

I believe this topic has some points you can use.
ESPHome filtering/lambda help - ESPHome - Home Assistant Community (home-assistant.io)

What I mean is make the TOF internal sensor and use the template sensor to remove unwanted values:

  - platform: template
    id: "NEW TOF"
    lambda: |-
      if (id(TOF).state > 0 && id(TOF).state < 20) {
        return id(TOF).state; 
      } else {
        return {};
      }

I’m having the same problem with this sensor.
Any update on this ?