Hello. I’m new to InfluxDB. I’m using it with OpenHAB for data persistence of my home devices along with Grafana to plot some of the values. Specifically, I’m trying to make a graph of my living room lights, which are a dimmer. OpenHAB only saves the state of the switch when it changes. How can I write a query that propagates the latest value to the current time?
I don’t want to calculate values in-between either because it doesn’t make sense; Meaning a value of 100% at 3:30 and value of 10% at 4:00 should not generate a point of 55% at 3:45 because at 3:45, the lights were still at 100%.
Looking at this screenshot, you can see the line does not extend all the way to the right (ie: “now”). I know absolutely nothing about Flux language. I slapped this query from the example provided by Grafana and a tiny bit of exploring in the Influx UI.
from(bucket: "home_metrics")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "LivingroomLights_Dimmer" and r._field == "value")
Any help here would be appreciated! Thanks!