No, not if you’re routing through emonHub and using the EmonCMS Fixed Interval Timeseries database. It acquires the time of the time slot when the data makes it into the Feed, having gone through emonHub and whatever it needs in the RPi to get into emonCMS, then there’s the input processing on the Inputs page before it reaches the Feed.
(See my explanation for the mechanism Problem with data from MQTT feed seeming to be "lost" - #13 by Robert.Wall)
All that is possible. The steps are: Get or update the Arduino IDE, and install the plugin for the -DX processor, download the sketch and change it using your favourite editor or the Arduino IDE, compile and upload it to the emonTx4; then edit the emonhub.conf file in your emonBase (via the web browser) to tell it about the new input, then do as you need with the new input in emonCMS.
The instructions for setting up the Arduino IDE and the necessary libraries are in Learn → Electricity Monitoring → Using the Arduino IDE (Using the Arduino IDE — OpenEnergyMonitor 0.0.1 documentation)
You’ll get your sketch from this page (cunningly hidden under ‘Hardware’) Firmware — OpenEnergyMonitor 0.0.1 documentation You’ll need to look to see if you have the ‘6 temperatures’ version - I think the default is 3 temperatures, the top one on the page, and unless you asked for it, you won’t have the 3-phase version.
You’ll also need to install and configure the DxCore plug-in, instructions for which are about half-way down the page (ours, not Github). The instructions for the libraries are repeated just below.
At this point, you might want to download emonLibCM’s documentation file (if you didn’t get it) for reference, though you don’t need it.
Assuming you have the first (6 channel, 3 temperatures) sketch, the files you’ll need in the IDE are
EmonTxV4.ino and EmonTxV4_config.ino but you’ll only edit the first one.
Looking at the first, the powers you want are obtained from emonLibCM in lines (on the Github page) 349 - 364. The values are put into a struct created at lines 88 - 94, so you’ll need to add a new variable (or variables) there. I’d call it
P12 if it’s the sum/difference of powers P1 & P2 - but the name is your choice. If you want the accumulated energy as well, it’s the
(Don’t add any more than one power and one energy - 6 bytes - or the radio will foul up, you’re limited to 61 bytes - an integer is two, a long integer is 4)
Going back down the code to where you get the powers, add somewhere convenient & relevant (below
emonTx.P2 = ...?)
emontx.P12 = EmonLibCM_getRealPower(0) - EmonLibCM_getRealPower(1);
(for the difference, using whichever power or energy values you want, of course).
If you’re sending the data by ISM-band radio, this is all you need to change here. Save, compile and upload it - and the numbers will stop appearing in emonCMS. As long as the sketch runs, don’t panic.
Note where you added the new value(s) in the ‘struct’, and go to your web browser and emonCMS, and Setup → Emonhub. You’ll need the “Edit config” tab on the right. Scroll down to the block for your emonTx4 - probably Node 17:
nodename = emonTx4_17
names = MSG, Vrms, P1, P2, P3, P4, P5, P6, E1, E2, E3, E4, E5, E6, T1, T2, T3, pulse
datacodes = L,h,h,h,h,h,h,h,l,l,l,l,l,l,h,h,h,L
scales = 1,0.01,1,1,1,1,1,1,1,1,1,1,0.01,0.01,0.01,1
units = n,V,W,W,W,W,W,W,Wh,Wh,Wh,Wh,Wh,Wh,C,C,C,p
You’ll need to add your new power (and energy if you did this too) into the same POSITION in the lines of “names = …”, “datacodes = …”, “scales = …” and “units = …” as it was in the ‘struct’
so if you added
P12 as the 5th value following
P2, then add it as the 5th item in the
names = ... list,
h, as the 5th item in
datacodes = ...,
1.0 in the
scales = ... and
W, in the
units = ... lists.
And save it. It should restart automatically, but if not, click ‘Restart’.
Your data should now appear on the Inputs page of emonCMS.
(You could do emonHub first - the data stops flowing while this definition and the data sent are inconsistent.)
I won’t test it, but I think this will work. Don’t hesitate to come back if you have a problem - unless you use Platfrmio - then I can’t help you, cuz it screwed my system up when I tried to use it.