Firstly that’s a float(ing point number) integers are whole numbers only eg int(72000.6) = 72000.
I can see several things not quite right so I will just run through them and then you can use what you can from that.
-
best practice would be to put the “log to feed” at the top of the processing to log the input in it’s rawest form and it make easier reading, it’s a little more logical.
-
name that first “log to feed” something with “power” in the name,
-
The allow positive followed by an allow negative translates to “zero everything” because each of those processes blocks everything above or below zero.
-
so the “+72000” line will always result in a value of “72000”.
-
the value fed into the “power to kWh” process is always 72000, only the time interval between input updates can effect the output of this process now.
The normal arrangement here would be
log to feed “xyz_power”
power to kWh “xyz_kwh”
power to kwhd “xyz_kwhd”
and then if you wanted to have a feed that tracks your meter, you could use the input api to “correct” the kwh total by setting up a separate input, lets call it “adjust”
https://emoncms.org/input/post?node=adjust&csv=0
to that new input add one new process “log to feed” and select your kwh feed you want to correct.
then pause your other inputs for a moment (to avoid conflicting inputs trying to save different values at the same time)
then wait a few seconds (about the same length of time as the fixed interval of the feed you are editing)
and post the current meter reading to the new input
https://emoncms.org/input/post?node=adjust&csv=72000
then wait a few seconds again (about the same length of time as the fixed interval of the feed you are editing)
and restart your original input, it should add it’s energy used to the 72000
It would be wise to delete the “adjust” input when you have finished with it to avoid any accidents
alternatively you could add
reset to zero
+feed p2kw
+ 72000
log to feed “meter reading”
to the end of the processing above, but this results in 2 feeds to be maintained (ie twice the disk space and double the input processing (probably not a real concern)
However be aware that emoncms uses 32bit floats and therefore generally accurate to 7 digits, by syncing you meter reading you are going to loose some resolution 123.456Kw used + 72000 = 72123.460 (not 72123.456, again not a big concern when viewing but when you have a small load it might not register. 72012.460 + 4Wh = 72123.460. At a 10 sec update interval (4Wh every10s) that’s 1440watts, anything less than 1440watts might not register. My rough maths might be out here but I hope it at least demonstrates the potential issue.
[edit - having said all that, the “2 feed approach” would get around the resolution because the energy would be calculated on the smaller running total and then that gets increased to the meter reading value by simply adding the 72000]
[edit2 - you can also use a virtual feed for the second feed instead of a conventional phpfina as the apps module etc will work equally well with the first feed as it uses the delta between points not the total]