Trend Binary Sensor help - does not reset to off

Hey im using this trend sensor in order to know when i have water consumption or not (and in order to create automations and alerts when it’s on for long periods.

Here is my code:

  - platform: trend
    sensors:
      water_meter_running:
        entity_id: sensor.water_meter
        device_class: moisture
        max_samples: 2
        sample_duration: 30
        min_gradient: 0.01

Teleperiod is set to 10s on the tasmota, so the sensor.water_meter refreshes every 10 sec.
The trend sensor does detect water flow, but does not turn off when the flow is off.

What am i missing?

edit: added min_gradient: 0.01 still not returning to off state :frowning:

Thanks in advance.
k.

did you ever figure this out? I’m in the same boat…

Nope gave up :slight_smile:
Will get back on it at some point though, I’ll report back if I figure it out.

I just started using trend sensors, and ran into the same issue.

My incoming data comes from a homegrown restful sensor. Setting THAT sensor to include “force_update: true” seems to have fixed it for me.

I think that all that was happening is that if the inbound sensor didn’t change across subsequent tests (e.g. no water flowing), it didn’t update. With force_update you’re forcing an update with the unchanged value, causing the trend sensor to recalculate and turn off.

$0.02

Edit to add: and “min_gradient: 0.00001” in the trend sensor seems to help squelch some oddities which I’m guessing could be float conversion issues. I’m seeing e-18 sized numbers triggering the trend sensor to on, which resolved themselves with this addition.