Emoncms local install advice

Yay. Recieved my IotaWatt kit yesterday. One downside: I had to pay £63 customs duty ;(.
Still, it’s in and running. I am still setting things up but please with the way it’s going do far.
I have tried several ways to get influxdb/grafana running on my NAS. I tried following a few on YouTube and I tried using your docker compose as a template @khaney but non worked. I couldn’t access anything from the browser.
I have gone back to the one I posted above and, although it’s running version 1.8.2 of influxdb, it is working and pulling data from my iotawatt.
I may have a look at getting 2.4 working at some point but I’ll stick with this while I get everything set up as I want on the IotaWatt.
Thanks for all the help.

I now have influxdb 2.4.0 up and running on the nas. It is also getting data from my IotaWatt.
I was having so much trouble trying to get both influxdb and grafana running using docker-compose that I decided to try just getting influxdb running alone using docker run. It worked :smile:
So, now I’m trying to do the same with grafana but getting all sorts of problems. I am tweaking the command line but I either have trouble getting the container to run, or stay running. Or, if I get it running I can’t access the Web GUI. Looking at the log file it shows various access errors on files/folders. So, I chmod 777 every file and folder in the docker folder but still no go.
Is there a file or folder somewhere that need permissions that I’m missing?

I now have infuxdb 2.4 and grafana 9.1.6 running in docker on my nas. Not 100% sure how I “fixed” it but the nas has updated and rebooted in the meantime?
Anyway I am now pumping data into influxdb from my iotawatt. My issue now is I’m struggling to set up my queries using flux.
I’m specifically struggling with reporting energy (kWh). I think I have managed the straight power reporting OK but I can’t get accurate reporting of my energy use, import and export figures over time (today, yesterday, This week, this year etc.)
Any experts in flux able to point me in the right direction? I have seen loads using influxql but very little on flux.

I don’t think there is a simple way to get import and export from Watts using Flux. You would need to upload the negative (export) and positive (import) values separately and integrate those with Flux.

Take a look at setting up an integrator in the IoTaWatt and uploading the import and export Wh to influx.

1 Like

if flux language is what grafana uses, I’m doing something like this to calculate the kWh
image

I’m actually wondering now why I used mean here, but the numbers I get are pretty close to what the power company is reporting each month. Maybe that was the only good choice for the aggregate method. Once you have the queries for each component using the v.timeRangeStart and v.timeRangeStop, it’s just a matter of changing the values on your report for the range you want to see, and the query will use that range.

To get cost, I have a variable with the current kWh price and multiply by that

units being uploaded are Watts

1 Like

I also have a report that shows me usage for each component and for the total for the current billing cycle. My cycle starts on the 22nd of the month. Took a bit of fiddling to get this to work, but seems to be working for me. note to use the time functions I had to set a timezone. I may just need to set it correctly in the server, but this worked too.

import “date”
import “timezone”
option location = timezone.location(name: “America/New_York”)
_lastmonth = date.truncate(t:date.add(d: -1mo, to: today()), unit:1mo)
_thismonth = date.truncate(t:today(), unit:1mo)
_first = if date.monthDay(t: today()) <= 22 then date.add(d: 21d, to: _lastmonth) else date.add(d: 21d, to: _thismonth)

_last = now()

from(bucket: “iotawatt”)
|> range(start: _first, stop: _last)
|> filter(fn: (r) =>
r._measurement == “total_main”
)
|> aggregateWindow(every: 1h, fn: mean, createEmpty: true)
|> map(fn: (r) => ({ r with cost: (r._value / 1000.0) * ${kWhPrice} }))
|> keep(columns: ["_time", “cost”])

1 Like

I have rebuilt my database as it was getting cluttered with old dat where I have been messing with settings in IotaWatt.
I now have a clean setup which is up to date. I can explore my data fine.
I decided to try out both methods of calculating kWh:
I’m trying to produce a report for “yesterday” as a starting point because that is easy to see on my solar dashboard and in IotaWatt for comparison.

  1. From the Watts metric generaged by IoaWatt
  2. From the Wh metric generated by integrators in IotaWatt

Neither seem to produce stats that match what my solar/smart meter are showing.

Questions:
I am attaching screenshots of my IotaWatt setup. Are my inegrators set up correctly?
Am I right in saying that they produce a Wh figure for the same 10s period as the standard W output?
Is a 10s post interval a resonable compromise for accuracy and efficiency?

@khaney Thanks for sharing you queries. As far as I can see Grafana uses whatever query language your database uses. So yes, certainly simple flux queries work.
I have tried running your 1st query against my watt data but it seems to have an issue with the createEmpty argument. i’ll need to read up on that to see what it doesn’t like.

Does the data that you are getting from influx/grafana match the data from IoTaWatt query or Graph+? Can you show those kWh numbers for the past few days?

Your status indicates that your Solar, Grid and Loads have integrity. Total_Power ~= Grid + Solar (254 vs 255). So, I think it would be better to define Total_Power = Grid + Solar and Consumption = Grid + Solar. That way, consumption measured correctly regardless of any subsequent changes to you panel loads.

They are correct but you don’t need integrators for Solar or Consumed_Energy. They are monotonically increasing values. I would delete them.

Looking at your influx setup, I see:
export_power Watts = Grid.neg abs
Grid is an input, not an integrator. Is this something left over from when you might have had an integrator named Grid? Not sure what happens when invoking the .neg method for an input. I suspect it’s not good. Should be:
export_power Watts = Grid_Energy.neg abs

1 Like

Reporting power consumed for yesterday (23 Oct 22) from Graph+, InfluxDB Explorer and My Growatt Inverster Dash Panel.
The figures are pretty close. Still working on Wh/kWh.

Can you explain your reasoning for this change please? My thoughts are/were it calculates the total power useage by the house from my dist panel via the CT’s, regardless of input from solar/grid/battery etc. I can see that, in theory, they both arrive at the same result but why is your resoning better than mine (Not arguing but want to be clear in my mind :wink:

I was obviously confused when I created these.

You are exactly right. I renamed the grid integrator to avoid confusion with the grid input. It obvously didn’t work in my case :wink:

Thanks for all your help on this. Sorry if I’m being a bit dim. It must be my age :wink:

I was looking for a comparison of the day’s total kWh from your various sources. The plot of Watts doesn’t show the big picture. With Graph+, you can click the statistics tab at the bottom, and it will show the integrated Wh for a Watts plot. You can also plot Wh and the statistics tab will show the sum.

This is the first time you have mentioned battery, so that may change my advice. But in general, most installations do not put CTs on every load, especially in North America where we may have 30 breakers in a load center. We generally measure all of the significant loads, and then create a “misc” output that is the difference between the mains and the measured loads. So, the convention is to produce the major measurements of solar, import, export and consumption as functions of the mains and solar CTs only.

If you want to add a breaker to your service, you will need to add a CT and change any outputs that use the sum of the loads for consumption. Using just the main(s) and Solar there is no such issue.

A more subtle problem with computing using the loads is has to do with the way the IoTaWatt saves history and accesses it. Outputs are computed using the script every time they are needed. They can be computed for any time interval from 5 seconds to all-time. They reference inputs by input number, not name. As you may reconfigure loads down the road, the historical integrity of outputs derived from changed inputs may not work as otherwise expected. Generally speaking, Mains and Solar do not change so it is a more reliable source.

Thanks for that, makes a lot of sense.

Brilliantg. I’m learning how to drive IotaWatt as well as InfluxDB and Grafana.
So here is my Graph+ plot of Total Consumed power for yesterday.

And here is a plot from my Growatt dashboard.

If I compare the two, the total kWh figures for the day are:
Growatt: 8.7kWh
Graph+: 6.55kWh

I know they are unlikely to be identical because of sample rates/times etc. but is a ~25% difference to be expected?

I think they should be the same. The question is which is correct. Can you also show the IoTaWatt kWh for Solar, Import, Export, and Grid? Do you have a smart meter that shows any data for that day as well?

What is the model of your Growatt and does it have a battery attached?

These are the Graph+ Plots for the 24th Oct.

The Only reading on my “smart” meter that I can find for one day shows 2.63kWh for the 24th Oct.
This roughly equates to IotaWatts Total_Power + Grid (3.84-1.42=2.42).
So:
My grid figure is showing that I made a net export of 1.42kWh ?
My Total_Power is showing a total consumption of 3.84kWh
These, if I am right in my assumptions, are there, or there abouts.
But they do not tally with the Growatt server figures of:
Load Consumption: 9.7kWh
Made up of:
Self Consumption: 5.8kWh +
Imported from grid: 2.9kWh
Also, Import_power and Export_power metrics don’t seem to be gathering data?

My Solar install consists of:
|Item|Model|

|16 x PV Panels|410w Hyundai Black Mono Panel|
|Growatt 6kw Hybrid Inverter|SPH 6000TL BL-UP|
|6.5kw Storage Battery|GBLI6532|
|Data Logger|ShineWiFi-X|

Are my uploader measurement setting good now, specifically the export and import ones?
I had the import_power set to Watts=Grid.pos. I have changed it to Grid_Energy.pos but not sure that is right? My mind is frazzled at the moment :slight_smile:

Edit:
Import_Power and Export_Power Putputs are definitely not working.
My current status shows Grid as -565 Watts wich should equate to an export of the same figure?

So is mine. You are changing things and I don’t have visibility into that. Import_Power and Export_Power were measurements in your influx setup. Have you created outputs by those same names? Why not just use Import and Export as originally defined as Grid.neg abs and Grid.pos respectively? Then plot those as I ask in the quote above?

Also, can you post your outputs and integrators as currently defined?

Then the plot as requested in the quote above?

I have to look into the Growatt model with battery to see what impact that has on these measurements. I don’t think you are going to be able to get daily solar production, only the contribution of the Growatt+battery as a black box.

Look at the timeframe. It’s not an even day, so probably not the 24th.

Looking at this inverter now. Is your normal mode:
1 - Load First
2 - Battery First
3 - Grid First

Yes but one is capitalised, the other isn’t.

Sorry, not sure how that happened. Here is the right one, I think…



You are right. Where I have the Solar CT fitted is on the output from the Hybrid Inverter. Which will be the sum of whatever the PV’s are producing + or - the charging or discharging power from the battery.
The growatt server gives me sight of the battery status and PV generation but I can’t get it out easily and it’s not updated very frequently (every 5 mins I think).
My plan, once I get Iotawatt up and running is to also intercept the feed from my inverter to server.growatt.com using grott as a proxy so I can feed the data directly into another bucket on my InfluxDB instance. But that is way down the to do list until I get my mind in gear with iotaWatt.

image
How are you even creating this? Grid is an Input, not an integrator. Should this not be Grid_Energy.neg abs and Grid_Energy?

We are going around in circles. This was pointed out yesterday. I see that you are still using the sum of the loads for consumption. I’m losing interest here as this isn’t very productive.

Ahha, I changed the integrator to Grid_Energy and the uploader to match. Forgot all about the Output. Sorry, I think I was assuming that because I wanted power (W) in the output I couldn’t use the Grid_Energy integrator because I have set that to units=Wh?
It’s the demarcation between the Power (W) and Energy (Wh) metrics in IotaWatt that I am struggling with.
So, if I change the Export_Power and Import_Power Outputs to the Grid_Energy integrator with the units set to Watts That will work?

I think I may need to do a reset and start again in that is the case. I was _Power to denote (W) and _Energy to denote (wH) but that demarcation is getting blurred now. I ne3ed to rethink and rename things so that I can better understand each input and output better.

I took from your reply that this only matters if I, a) add another circuit to my panel or b) don’t have enough CT’s for every circuit. Neither of which apply in my circumstance. Plus, I may at a later date want to report data on individual circuits.
If it’s imperative that I make this change please let me know?

I’m sorry you feel that way.
If you could just answer my questions above that would be most helpful I’ll then try to sort my issues out and not bother you further.
Thanks for your help so far it is much appreciated…

Define work? I thought you wanted to reconcile the IoTaWatt data with your meter and what you are getting from the inverter. I can’t say this will do that, right now I’ve been trying to get you to stick to the established conventions of names and definitions as described in the docs and reconcile those to your electric meter. I can’t rule out some other error until I see things properly setup and compare to the electric meter.

It would make it immensely simpler for me to look at these posts and put them in context if you were using the conventional names and definitions as in:

Setup two CTs:

  • Main
  • Solar

Define an integrator:

  • Grid = Main

Define three outputs:

  • Import = Grid.pos
  • Export = Grid.neg abs
  • Consumption = Main + Solar

You can argue with this, but the mains are not always the grid. It depends where the solar feeds in. Consumption is not always the sum of the loads. Some battery systems use grid power to charge over the same connection as the inverter feed, so the “solar” CT can be positive or negative. These conventions and terms help me to help you and others reading this forum to understand.