User Tools

Site Tools


homeautomatisation:influxdb:examples_influxdb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
homeautomatisation:influxdb:examples_influxdb [2022/03/10 22:04] – created illuhomeautomatisation:influxdb:examples_influxdb [2022/03/11 22:24] (current) illu
Line 1: Line 1:
 +
 +====== Last value for snapshot ======
 +
 get only the last value from iobroker shelly power, if its none in range, fill with previous value. get only the last value from iobroker shelly power, if its none in range, fill with previous value.
-<code sql>+<code>
 from(bucket: "iobroker") from(bucket: "iobroker")
   |> range(start:0)   |> range(start:0)
Line 7: Line 10:
   |> fill(usePrevious: true)   |> fill(usePrevious: true)
   |> last()   |> last()
 +</code>
  
 +integration in grafana
 +
 +{{:homeautomatisation:influxdb:grafana_last_watt.jpg?400|}}
 +
 +
 +====== Integral for Watt hours / from W to Wh ======
 +
 +<code>
 +from(bucket: "iobroker")
 +  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
 +  |> filter(fn: (r) => r["_measurement"] == "0_userdata.0.Wattzähler.Arbeitszimmer.Watt_Aktuell")
 +  |> filter(fn: (r) => r["_field"] == "value")
 +  |> integral(unit:1h)
 </code> </code>
 +
 +{{:homeautomatisation:influxdb:grafana_watth.jpg?400|}}
 +  
homeautomatisation/influxdb/examples_influxdb.1646946249.txt.gz · Last modified: 2022/03/10 22:04 by illu