Last active
November 1, 2022 18:24
-
-
Save wujku/50caef4bcf8b8024243690d4b1204fb5 to your computer and use it in GitHub Desktop.
InfluxDB – Power consumption
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from(bucket: "home_assistant") | |
|> range(start: -30d) | |
|> filter(fn: (r) => r._measurement == "imp" and r._field == "value") | |
|> aggregateWindow(every: 1d, fn: spread, createEmpty: false) | |
|> map(fn: (r) => ({r with _value: r._value / 1000.0 })) | |
|> yield(name: "daily total") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from(bucket: "home_assistant") | |
|> range(start: -60d) | |
|> filter(fn: (r) => r._measurement == "imp" and r._field == "value") | |
|> aggregateWindow(every: 1w, fn: spread, createEmpty: false) | |
|> map(fn: (r) => ({r with _value: r._value / 1000.0 })) | |
|> yield(name: "weekly total") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment