====== Last value for snapshot ======
get only the last value from iobroker shelly power, if its none in range, fill with previous value.
from(bucket: "iobroker")
|> range(start:0)
|> filter(fn: (r) => r["_measurement"] == "shelly.0.SHPLG-S#1C032F#1.Relay0.Power")
|> filter(fn: (r) => r["_field"] == "value")
|> fill(usePrevious: true)
|> last()
integration in grafana
{{:homeautomatisation:influxdb:grafana_last_watt.jpg?400|}}
====== Integral for Watt hours / from W to Wh ======
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)
{{:homeautomatisation:influxdb:grafana_watth.jpg?400|}}