Quantcast
Channel: InfluxDB - Grafana Labs Community Forums
Viewing all articles
Browse latest Browse all 199

Openhab, Grafana & InfluxDB2 - State Timeline & Status History for Simple motion sensors

$
0
0

Openhab, Grafana & InfluxDB2 - State Timeline & Status History for Simple motion sensors

Hi i was hoping someone could help a newbie out.

Im playing around with Grafana trying to make a “graph” that looks like the following:


Link to this here

For example the query i have is the following:

from(bucket: "openhabdb")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["item"] == "Room1Eye" or r["item"] == "Room2Eye")
  |> filter(fn: (r) => r["_field"] == "value")
  |> map(fn: (r) => ({
      _time: r._time,
      _value: if r._value == 1 then "Detected" else if r._value == 0 then "Not Detected" else "Unknown",
      item: r.item
    }))

Its pulling the necessary data and all seems ok, i can see it, like so:

But i cannot make the visualization the same as in the example above! I try for many hours and i cannot get the blocks to be wide like that, i dont want those thin lines, even though the sensors catch for 4second movements.

I know there was a way to do it with the Discrete Panel, but its discontinued.
I have more sensors to add later, but im trying 2 for now. Also if the one sensor gets no movement for the 6hr chart, the whole sensor disappears from the chart until there is movement.

If anyone can offer a more efficient way of my query as well, that would be great.

Please someone can help me? I appreciate it

5 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 199

Trending Articles