Sorry, yes, my brain appears to have been asleep when I wrote those lines. Unfortunately, it’s not working properly now either - it’s too hot here to think straight.
The sketch you want is indeed EmonTxV4_6x_temperature
This does use emonLibCM, so this should not be changed. (You can get the full documentation on emonLibCM by downloading it from the forum here: https://community.openenergymonitor.org/t/emonlibcm-version-2-2-2/
How are you getting the data out of your emonTx? This is likely to have a bearing on the changes you need (or don’t need) to make.
What you need in any case is as you rightly say: EmonLibCM_getIrms(…) will get the actual current on its own. The potential catch is, it’s a double, and if you’re not careful it’ll get truncated to an integer (Power or VA is big enough to be OK as an integer, current isn’t).
If you’re using the radio, but I suspect you might not be, you should multiply by 10 or 100 before it gets truncated when it’s assigned to an integer, then you’ll have one or two decimal places when you restore it later.
If you’re using only the serial USB connection, the code for this is inside the if
if (EEProm.json_enabled) { ... }
and the obvious best way to add the current is to change the serial.print(...) for the relevant P to (e.g.)
Serial.print(F(",\"P1\":")); Serial.print(EmonLibCM_getIrms(0)); or add it as another line,
and this automatically gives a human-readable number to 2 places of decimal, and ignores the r.f. data structure completely.
Sorry, no ‘special’ formatting is allowed by Discourse, so apologies if I’ve missed a question. I’d recommend you use the forum-then you can see your post as I see it
EmonVS - Do I really need this? - #8 by grod55
No - this is debugging print for use when calibrating.
You set the calibration etc by doing it via the serial port (‘on-line’) and saving the new values to EEPROM. This what the ‘conf’ file does. However, the defaults are in the EEProm structure at the top of the main source file, so if you know the approximate values in advance, you can change the defaults here.
Don’t change anything else until you’re sure of the consequences.