Querying historical values (for definite integral)

Hello, I’d like to compute for how long was a sensor on for last 24h. At the moment:

  1. I’ve a numerical value of it (0 for off, 1 for on).
  2. I compute indefinite integral for the value.

I am missing:

  1. Compute definite integral for last 24h

I’ve tried to create a simple template that calculates current_value - value_before_24h, but I can’t find how to get the value_before_24h. (Additionally, there is an additional drawback: the integral is updated only when the integrated value is updated. I think I can make a workaround for this.)

Non-solutions:

  • Use utility meter. I want to compute if for last 24h, not since the beginning of the day…
1 Like

Thank you! This solves my issue and simplifies my configuration.