Monthly electricity cost calculation in Spain

Hello dear Grafana users. I’m not quite sure where my question fits in, so I’ll put it here.

In Spain, electricity prices vary every hour. I download prices for the following day from the internet and dump the information in a text file. I then select the price from the corresponding text file line number according the the time of day, and pass it on to influxdb. I can then see the current price from a grafana dashboard.

I want to calculate the the cost of the electricity I use from the power grid. I of course have the grid power consumption measured and put into influxdb at 1 second intervals.

I have succesfully got grafana to show the past accumulated consumption for a 1 month period.

To calculate the price of the electricity I have used, the quickest solution would be to calculate the average electricity price and multiply by the accumulated consumption, but that wouldn’t be very accurate. I’m having trouble figuring out how to calculate the (more or less) accurate consumption with the data I have.

I hope I have explained myself well enough. I apologize if not.

Thank you very much.

1 Like

Welcome

Are you using flux or influxql query language?

Good question, I don’t know. I am using a raspberry pi 4, node-red and grafana. Following tutorials here and there getting things done as I can. I am a new grafana and node red user.

Can you show us the query you used for this or other parts of grafana

Does this answer your question?

looks like influxql not flux

Is there anything wrong with that? Should I do it some other way better?