ToU by Flux Query (and why it is is a really, really bad idea). #225
Replies: 4 comments 5 replies
-
Setup step 1: Add a new datasource for the query. Goto grafana settings and add a new "InfluxDB data source". This is in addition to the InfluxDB you will already have for Powerwall-Dashboard, and is required to get flux working. Note: There is also a Flux datasource available - it only works with an https server - which is not the Powerwall-Dashboard default, so I haven't tried this. The changes I made to get things working were:
Setup step 2: Add the new dashboard by importing the following json. ToU Dashboard JSON
The heavy lifting is done by the Flux query supporting the first plot. Next post for an outline of the key elements and stuff that needs changing to localise for different utilities and timezones. |
Beta Was this translation helpful? Give feedback.
-
Flux query
Dumping this for now - more detail later today or tomorrow after I've had some downtime. |
Beta Was this translation helpful? Give feedback.
-
OK last round going through the query and the problems with doing it this way. TLDR: Flux is hard to use for moderately complicated queries and not at all flexible for parameterising and/or implementing alternative code paths (a problem given how many different tariff types there are). It is also hideously incomplete and internally inconsistent for InfluxDB 1.8, and agonising to debug. Some of these limitations will go with a transition to a newer version of InfluxDB, but not all. So while this post demonstrates it is possible to build a ToU system in flux, each tariff type would need a custom implementation, and even then it will probably need a fair bit of manual intervention to keep up with changes in rates and seasons. I've started work on an alternative approach using a python agent that will implement the same functionality, but in way that allows implementation of flexible tariff families and simple(-ish) configuration from a JSON file. However, it will take a bit of time to pull the new agent together. So, if you want to build up your own flux ToU in the meantime, the elements of the query are as follows (I'm happy to help/provide pointers): The main data filter starts from the line:
This filter works pretty well and is easy to understand. The rest of the file provides implementation elements. Working through these from the top:
|
Beta Was this translation helpful? Give feedback.
-
@BuongiornoTexas said:
I've picked up multiple programming languages without any formal training, at least to the point where I can muddle through modifying some existing code to make it do something else, but Flux has me FLUmmoXed! I just don't have any desire to try to figure it out. It's like SQL, javascript, PHP, and Python are Italian, Spanish, Portuguese and French, and you can use the basic word roots and grammar to speak a few words in each, but Flux is a minor dialect spoken on the third moon of the yet-undiscovered Planet X by a race of silicon-based insects that make sounds by rubbing their wings together 😄 |
Beta Was this translation helpful? Give feedback.
-
Hi All,
Passing on that I have managed to build a ToU system using a flux query. The following screenshot is for our utility (Aurora in Tasmania). I'll share how to build it in following posts and provide a bit of detail on why it's a bad idea to use this approach. On the upside, I'm pretty sure I can do a variation on the approach that will do the job in more flexible way.
We have 2 x peak and 2 x off peak periods on weekdays, and the weekend is completely offpeak. You can switch usage type between $ and kWh using the drop down at the top of the plot. It all runs perfectly cheerfully (if somewhat slowly) and will happily deal with large time ranges - I've tested it on a 5 month range, and the output is in line with actual metering data from the utility (I think errors are from a combo of influxdb integration errors and tesla hackiness).
The rules I've applied for self consumption are:
Exported power is credited per the utility FiT.
I don't account for recorded solar or battery production, as this only has value as either export or household consumption.
More details to follow over the next few days.
Beta Was this translation helpful? Give feedback.
All reactions