I'm struggling on the best way to trend the rate at which something happens with sensor data. I am often using python (or circuitpython) to take an individual sensor reading and then I log that data. But I want to find insights from that data and often real time notifications. Here is an example....
I take point measurements using a python script to measure the height of the water in my sump pump. This is great as I can see when the pump fails but I also want to know the cycling rate of the pump. I can trend the data visually from the log files (example attached).
To know the cycling rate of the pump I guess I could take a few approaches:
Directly in the Python/circuipython script. This is difficult because it is not like there is a specific height that I can say triggers the cycle and since the script logs at an interval it's not like it knows the previous value, unless I pulled those from the log.
I could write a script to analyze the log files, pull maxs and mins, determine a cycle rate and then log/alert of that rate. Don't even really know where to start here.
I guess I could build some script to follow the log file and somehow look for that big drop in numerical values...
Struggling to get started here. Any suggestions?
Really - I'm looking for guidance on an approach....