I am monitoring my electricity usage using a set of Wifi plugs with Tasmota wired to ioBroker which all gets stored in an InfluxDB database.
I also have several devices in my house of which I know the current consumption so I cannot justify purchasing a measurement device just to retrieve a value I already know.
To make my data analysis easier, I would like to create “dummy” measurements in InfluxDB which always return this value, regardless of timespec. I could of course create and fill these using a cronjob, and I’m already doing this for daily summaries, but I hesitate doing this for series which may be queried every ten seconds.
Is there a way to create fake measurements in InfluxDB which don’t really exist on disk, so don’t occupy any space, but simply return a constant value (or row with constant fields) whenever queried?
This works, almost.
I can generate a dataset, but I cannot stack it on top of an already existing query result (in Grafana).
Granted, this may also be a Grafana question, but just in case: can I merge those queries?
Thank you!
I tried union(), but this wasn’t actually the problem.
The problem is I need to get my timestamps from another table to generate this table.
So I have an InfluxDB Flux query that retrieves data, and I want to use array.from() to generated fixed-value dummy data at the same timestamps of the real data. “fill()” doesnt help here because I don’t even have null values to fill.
Currently I have this:
value = 45
realdata = from(bucket: "home") |> range(...) |> filter(...)
dummydata = /* a table with _time column from realdata + constant value of 45 for every timestamp */
I played with array.from() and generate() but couldn’t get anything to work.
Do you have an idea?
This at least displays correctly in Grafana - but only because I know the real data is recorded every 10 seconds.
How about irregularly occuring timestamps?