I am trying to get some data from influxdb (Working) but I am not able to create sensible graphs of the data and would like some help
I currently have a sensor setup on my electrical power meter that is measuring flashes of an LED. Every time there is a flash I insert a “1” into influxdb. Every 500 flashes is 1 kwh. I have a table of 0s and 1s.
I can get this data into Grafana no problem, but the graphs it creates just don’t make any sense Im not able to work out how to count this data and output it in a way that gives me the usage for the given time period I select.
If every 500 flashes is 1 kWh, perhaps it is easier to rather insert 1/500 = 0.002 for every flash and timestamp that - or even better every flash is 2 Wh.
Saving it in either 0.002 kWh or 2 Wh makes it easier to aggregate in whichever method you like (e.g. summing per hour, per day, etc).
It also makes it easier to apply a tariff (if this is where you are going) by multiplying the kWh by the rate depending on your tariff rules.
I don’t have experience in influxDb (we use Informix Timeseries) so I can’t help with the query - but I’ve built electricity dashboards for our business so I can help with the theory behind it.
@xbalayer thanks for the info and to be honest I didn’t even think of doing that, as you said it makes it a lot easier. Ive set it to log “2” wh every flash and 0 for everything else.
However I’m sure I haven’t got the aggregate part right and I’m a little stuck with this.
What I would like to do is calculate the tariff, but first off id like to just see my usage for the last hour, so should I set the aggregate for 1h? or does setting the time period in grafana give me the usage for that time period selected?