I’m adding one data point to an InfluxDB2 database whenever the power state of a device changes:
...
power state=low 1712104703000000000
power state=high 1712104920000000000
power state=off 1712104980000000000
power state=high 1712105200000000000
...
I would like to get a histogram of how long the device stayed in each power state, so in this case three numbers, for example:
off: 220 s
low: 217 s
high: 60 s
There can be other states in the database, not only these three.
The boundary entries can be lost, that doesn’t bother me.