Ok so how are you using this then? Can you pull the accumulated energy value straight from Iotawatt?
Look again at my example and the name of the values i pulled vs what you are doing.
Export
is power
Export.wh
is energy
If your query of an outpu or input and the name doesnât end with .wh you are retrieving the power (in W) rather than energy (in Wh)
Ah thanks that makes sense. I will fix that up now (I thought you had just named your sensors that!). Did I understand correctly above that you said the sensors will reset annually? If so, how does HA handle that given that expects a total_increasing stateâŚor does it not matter?
it has a reset date. HA will handle the roll-over automatically (or so they say, in my experience you get crazy energy graph on that day).
HAâs IoTWatt integration resets at midnight.
You can change the begin=y
(which is the from the beginning of this year) to any date you want, and it will not reset anymore.
For my case I use begin=2023-01-01
so it never resets.
Thanks again. I have read before about being careful to not overload the iotaWatt with data requests. Over time with the increasing gap from today to the specified beginning (e.g. 2023-01-01) will that ever be a problem do you think?
The issue is more about fetching often. Not how much youâre fetching.
The round robin database stores pre-calculated values at different precision. So it keeps average for a year, a month, a day. So if you ask for the average say since beginning of last year, it gets the value for last year, then the value for every month, and then average the values at the highest resolution for recent data.
This is similar to what rrdtool database is doing.
So while the larger the interval it is, does take a slightly more processing power, itâs not significant.
Which is also why making the integration only fetch from midnight made no sense. Iâm still annoyed that this PR got through.
So donât fetch every 5s like some folks want to do, but donât worry about what you are fetching.
Great. I have another question. Any idea why one of my sensor values is coming through as zero (see the first one grid_export
?
http://192.168.1.233/query?select=[grid_export.wh,grid_consumption.wh,Solar.wh,Light2A.wh,Oven.wh,Power4C.wh,PhaseA.wh,PhaseB.wh,PhaseC.wh]&begin=2023-01-01&end=m&group=all&header=yes
{"range":[1672495200,1693289460],"labels":["grid_export","grid_consumption","Solar","Light2A","Oven","Power4C","PhaseA","PhaseB","PhaseC"],
"data":[[0,6435562,2654983,273419,155031,1400680,1513689,2677022,2244851]]}
As I mentioned this is currently on my test box so I want to get it right before changing my running system. The sensor is also zero on my running system but grid_export_wh_accumulated is working fine? And therefore the data I have there is also fine,
Iotawatt setup:
How has this output be defined? Are you using the new integrators?
The last picture above shows how it is defined in iotawatt. Every other output works fine whether that is a physical input or a derived outputâŚexcept for that one?
You need to read iotawattâs documentation about integrators.
What you are seeing is exactly why I had introduced the accumulated sensors to start. Now that the integrators exist in iotawatt itâs no longer necessary.
When you calculate with a normal output sensor something like sensor1+sensor2|max 0 over a long period how it calculates is:
Sensor1 energy + sensor2 energy. Where sensor1 is how much energy it used since the beginning of the year. Same for sensor 2.
So for your import that will never be negative. As you imported way more than you produced.
This issue has been discussed a thousand times. If you read the documentation in both iotawatt or home assistant iotawatt integration you would know. Thereâs an entire chapter talking about how to configure your sensors in iotawatt on the HA page.
I thought I had done that. The HA docs say:
Since I have my solar going into Phase B this seems correct:
The integrator may be the key as I only have this:
It was so long ago I donât recall why I added that one⌠However if there should be more then it must have been masked in my other system due to the accumulated sensors. However, I am not sure why the grid consumption would be returning a value but the grid export not?
I have changed my setup as per the iotawatt integrator docs so will see what happens! Thanks for all the help.
edit: Hmmm⌠My grid consumption has gone to zero now⌠I will revert that until I get his sorted.
edit2: Actually might be settling down now. I will see how it looks tomorrow once it has started a clean day.
You need to wait for the integrators to recalculate everything. It does the integration on every samples ever recorded (at 30+fps). it takes a while. itâs all in the Iotawatt documentation.
https://docs.iotawatt.com/en/master/integrators.html
it takes about 15 minutes to process 24h of data, if you look in the iotawatt âData Logsâ status, you will see how much data has been processed so far.
My grid consumption has gone to zero now
whatever was displayed was wrong anyway. So if you prefer to have something just for the sake of displaying something itâs up to you.
OK thanks. So should I create an integrator for every input and derived output? And then create an output for each which is just the integrator name .pos
?
Edit: Actually reading it again I understand this is only necessary for values that go up and down. So I think I am good now. Thanks again for your patience.
No. Only for those that can change sign or those that arenât always increasing
Usually itâs only for export and import