I have an openHAB setup that will checks if a particular appliance is turned on or off. openHAB will store an entry in the appropriate time series each time that the value changes, rather than constantly hitting the database with a new value every N seconds. So the time series looks like a series of timestamps with alternating values between 1 and 0.
My goal is to be able to create graphs which show how long the appliance was on for each hour of the day. Unfortunately, when the series is graphed, Grafana simply strings the datapoints together and ties them together with lines. I attempted to use an integral over each hour to calculate the ON time, but it ends up calculating the integral under the triangle which connects the ON and OFF datapoints, rather than the ON time between datapoints.
Can anyone tell me how I can accomplish my goal with grafana?
In the example image below, the green line are the ON/OFF data points (data only exits at each vertex, and grafana draws line between them) and the orange line is the ON/OFF integral of the green line, but it is supposed to be grouped in 1 hour increments. It is clearly incorrect - for example, the green data is OFF from 21:44 to almost 08:46, but the integral is increasing in that time because grafana is integrating the line connection those two data points.