How to correctly calculate cost of power consumption

Hi, I’m pretty new to Grafana and I’m trying to figure out a method to view the cost of my power consumption as a graph. I have found a way that kinda works but I’m not satisfied. One problem I have is that if there’s no power data within a set time it will view the consupmtion prize instead of zero.

The abowe example displays the consumpion prize enstead of zero because ther’s no usage data within the timeframe.

Any idea how to solve this?

For the queries which involve more complex operations - such as transformations - I have migrated to flux in stead of influxql. If you have some experience scripting/coding it should be fairly straight forward. I usually explain flux as a “hybrid sql and programming language”.

I sat up a test enironment for testing flux and my conclusion was, I’m not a coder :rofl:
I’m kinda able to copy-modify-paste code and sometimes get it to work, but in the case of flux I’m lost, specially because I could not find any good way of browsing my InfluxDB -database when coding.

There are indeed some improvements needed on the front end for flux in grafana. For the more complex stuff I often end up on the CLI massaging flux until there is a output grafana can make use of. Turns out a lot of my problems are table formating.

I tried to reproduce the results from you screenshot above using influxql and transformations. And a data set which also drops to zero once in a while. I did not have the same behavior. The product dropped to zero. Little help to provide since I can’t reproduce.

I’ve found some more information on this problem. This is only happening if the complete time frame have no data at all. In that case it completely disregards anything in the query and in the calculation mutiplies NOK.mean to nothing.
To get around this problem my idea was to add like 0.0001 to kWh.difference, but I cannot get it to work :neutral_face:

How are you collecting and calculating the usage? If your energy monitoring supports it, you can ingest the Total Delivered and Total Received. This may be one approach to solving your issue.

This topic was automatically closed after 365 days. New replies are no longer allowed.