Count cycles on tank level

All,

How would one count each time a certain level% in a tank is reached (see below for graph of sensor output). The challenge I see is that I only want the counter to count once when a pre-programmed threshold is exceeded (for example count only once when level exceeds 70%). ?

There are two ways that I might accomplish this - and others might have better ideas, but this is more how I would do it.

One way is to use SQL queries against the data to find where it peaked. While this isn’t terribly difficult to do, it will require you learn SQL and set it up. This would be more if you really need to know now what the history has been and haven’t been tracking it any other way so far.

Perhaps along the lines of this untested spitball query:

“SELECT * FROM states WHERE entity_id = ‘sensor.sump_level_sensor’ where state > 70;”

The easier way, in my opinion, would be to set up a helper entity and use automation to increment that number each time you reach your threshold. That’s very simple to do in just a few minutes.

It just depends on if you want it now for the past or from now on which might be more useful.

1 Like