Sensor name def in emonhub.conf isn't respected by emonCMS

Hi folks,
I’ve got a bit of an antiquated setup compared to some of the newer hardware I see posted here. Hoping I can find some resolution to my issue.

I have an emonpi collecting data from an emontx3 (CM firmware) over the UART (they’re less than a meter apart so RF isn’t necessary). When I setup the interfacer per this page:

docs.openenergymonitor.org

emonTx3 direct serial — OpenEnergyMonitor 0.0.1 documentation

emonCMS is no longer respecting the names for the power readings I have defined in emonhub.conf. instead, the “Inputs” page on emonCMS just displays the generic P1, P2, P3, P4.

Is there any reason why this might happen with the USB0 interfacer?

Thanks for your support.

CJB

Here’s the interfacer:

[[USB0]]
    Type = EmonHubOEMInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyUSB0
        com_baud = 115200
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        nodename = emontx3cm15

Here’s the node def

[[15]]
    nodename = emontx3cm15
    [[[rx]]]
       names = MSG, Vrms, Pstairs, Phallway, Pff, Psf, E1, E2, E3, E4,pulse
       datacodes = L,h,h,h,h,h,L,L,L,L,L
       scales = 1,0.01,1,1,1,1,1,1,1,1,1
       units = n,V,W,W,W,W,Wh,Wh,Wh,Wh,p

some version details:

emonTx V3.4 EmonLibCM Continuous Monitoring V2.00
EmonHub v2.5.2

Screen grab from emonCMS

[Edited for presentation - Moderator (RW)]

To the best of my knowledge, the USB serial input bypasses the Node definition in emonHub.conf – the variables are sent as name:value pairs in the serial data from your emonTx V3.

So if this emontx3/firmware/emonTx34/emonTx34_CM/emonTx34_CM.ino at master · openenergymonitor/emontx3 · GitHub is the sketch in your emonTx V3, it’s lines 430 - 433 that need changing. At present, they send (using the numbers from your screenshot)

“P1”:7,“P2”:0,“P3”:0,“P4”:1

      if (CT1) { Serial.print(F(",\"P1\":")); Serial.print(emontx.P1); }
      if (CT2) { Serial.print(F(",\"P2\":")); Serial.print(emontx.P2); }
      if (CT3) { Serial.print(F(",\"P3\":")); Serial.print(emontx.P3); }
      if (CT4) { Serial.print(F(",\"P4\":")); Serial.print(emontx.P4); }

So line 430 would change to

      if (CT1) { Serial.print(F(",\"Pstairs\":")); Serial.print(emontx.P1); }

and so on. And you could change the energy (‘E’) values likewise to match, if you wish.

[Edit]
Of course, if you don’t want to edit your sketch and upload it to the emonTx V3, you could keep “P1” as the name of the Input to emonCMS, and name the Feed where the data is stored and retrieved from for display as “Pstairs” or “Stairs_kW”, etc.

Thanks for your response Robert. I’m running a total of six emonTx3 units to the same emonpi and I don’t log all of the inputs as Feeds. So I’d end up with six P1s, six P2s etc. To further complicate matters, because of the ordering of circuits in the panel and use of the high sensitivity input on each unit, grouping the emonTx3 in any logical way isn’t possible. Given all these challenges, its just much more convenient to have the Input’s aptly referenced on display in emonCMS. And from what I’ve read in your post, it sounds like modifying the FW is the best solution in my case when using the USB interfacer

So I’m going about that and I believe I have gathered all the appropriate libraries (see below) to compile emonTx34_CM.ino. However, the Arduino IDE chokes on line 194:

‘emonTx34_CM.ino:194:3: error: ‘load_config’ was not declared in this scope’
‘emonTx34_CM.ino:346:3: error: ‘getSettings’ was not declared in this scope’

So I’m wondering if I’ve copied over the wrong version of one of these libraries because a grep search in the Arduino directory including the libraries subdirectory only turns up the calls in emonTx34_CM.ino, but none of the libraries. Do you happen to know where the load_config and getSettings functions are supposed to be defined?

Thank again.

The full installation instructions for the Arduino IDE (I can’t help you if you try to use platfomio) are in the Docs section: Learn → Electricity Monitoring → Using the Arduino IDE and as far as I know, the list of libraries is accurate.

When you fetched the source from Github, if there was more than one, did you get all the files in the directory where emonTx34_CM.ino was and put all of them in the same directory on your machine? Without knowing which version you’re actually using, I can’t check.

Sorry, problem solved. Looks like load_config is defined in another sketch emonTx34_CM_config.ino in the same directory as emonTx34_CM.ino that I overlooked when copying the files over. I should be back up and running shortly. Thanks again.

Not another sketch, part of the same one. It’s how the Arduino IDE works (or to put it another way, it’s basically a sensible compiler and linker that’s been taken and dumbed down to the point of being barely usable to those of us who are familiar with sensible systems used as their designers intended).

1 Like

Yeah I didn’t appreciate that the Arduino compiler’s default operation (i.e. without a directive) is to assemble all the .ino files in the same directory into one large.cpp source. I guess I need to do more reading…

I’ve pointed your problem out to the designers of the next versions of the emonTx and the emonPi, so it might be something that can be catered for in the future.

1 Like