OH3 Smoothing trend in state of an item - advise please

Hi All

I am looking for some advise/suggestions.

I use rrd4j for persistence and also a Shelly UNI device to monitor the battery of my UPS/Inverter.

I am trying to find a way to find the trend of the state of the VDC on the UNI to determine what the UPS is currently doing.

This is an example of the chart of the state of the VDC:

As you can see it fluctuates quite a lot.

What I am looking for is a way to determine what the trend is over time to allow me to work out what the current UPS/Inverter mode is: - Trickle Charge, Idle, Discharging, CHarging, etc

I have tried using the avergaeSince for 1, 2, 5 and 10 minutes, this seems to give a smoother result, but wonder if there is a better way to achieve this?

Currently I count the number of counts in specific direction and try infer the status from that - which works mostly, but is quite a complex way to achieve this.

Would appreciate any suggestions.


Use the 1st derivative of your time series, see Math experts wanted: analyse humidity curve and distinguish between bath and shower - #18 by Ap15e.

Sorry about the delay is responding. I got involved with easier options, but have not come back to this :slight_smile:

So what I have from persistence is:

  • a set of data with a time and a voltage
  • the times and voltages fluctuate (time is not regular)

I have spent some time trying to figure out:

  • how to calculate the 1st derivative is JS (will most likely want to do this with Blockly, but will have to use an inline script block I guess?
  • how to calculate the 1st derivative of a set of data (not a function)
  • would like the trend of the data for the last x minutes (EDIT: or the last x datapoints)

Do you have any further help you could share?

EDIT 2: Also saw the Evolution Rate Block in blockly - but that only uses 2 data points, so not really going to help with a trend on fluctuating data.

Do yourself a favor and take equi-distant measurements.

Edit #1:
While it is an interesting exercise to infer the health of a UPS from external measurements, it might be much easier/cheaper to buy a UPS that is supported by the NUT binding - but I do understand your idea of monitoring your UPS by means external to your UPS.