Emonhub non data to emoncms

If EMONHUBTX3EINTERFACER is defined in the source file (which it is as distributed - it can of course be changed subsequently) for the EmonTxV34CM_rfm69n version, and always (totally unconditionally) for the EmonTxV3CM from Github (JeeLib ‘Classic’) version, then the serial output string, as I read the source files, comes from these lines of code respectively:

      Serial.print(F("MSG:")); Serial.print(emontx.Msg);
      Serial.print(F(",Vrms:")); Serial.print(emontx.Vrms*0.01);
      
      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); }
      
      if (CT1) { Serial.print(F(",E1:")); Serial.print(emontx.E1); }
      if (CT2) { Serial.print(F(",E2:")); Serial.print(emontx.E2); }
      if (CT3) { Serial.print(F(",E3:")); Serial.print(emontx.E3); }
      if (CT4) { Serial.print(F(",E4:")); Serial.print(emontx.E4); }
      
      if (emontx.T1!=30000) { Serial.print(F(",T1:")); Serial.print(emontx.T1*0.01); }
      if (emontx.T2!=30000) { Serial.print(F(",T2:")); Serial.print(emontx.T2*0.01); }
      if (emontx.T3!=30000) { Serial.print(F(",T3:")); Serial.print(emontx.T3*0.01); }

      Serial.print(F(",pulse:")); Serial.println(emontx.pulse);  

and

    Serial.print(F("MSG:")); Serial.print(emontx.Msg);
    Serial.print(F(",Vrms:")); Serial.print(emontx.Vrms*0.01);
    
    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); }
    
    if (CT1) { Serial.print(F(",E1:")); Serial.print(emontx.E1); }
    if (CT2) { Serial.print(F(",E2:")); Serial.print(emontx.E2); }
    if (CT3) { Serial.print(F(",E3:")); Serial.print(emontx.E3); }
    if (CT4) { Serial.print(F(",E4:")); Serial.print(emontx.E4); }
    
    if (emontx.T1!=30000) { Serial.print(F(",T1:")); Serial.print(emontx.T1*0.01); }
    if (emontx.T2!=30000) { Serial.print(F(",T2:")); Serial.print(emontx.T2*0.01); }
    if (emontx.T3!=30000) { Serial.print(F(",T3:")); Serial.print(emontx.T3*0.01); }

    Serial.print(F(",pulse:")); Serial.println(emontx.pulse);  

They look very much the same to me. But I do see a potential problem with the Github version: If the display of currents is enabled, there’s no CR/LF emitted after the last current,

     Serial.print(F(",pf4:")); Serial.print(EmonLibCM_getPF(EmonLibCM_getLogicalChannel(4)),4);

so on the next report, the “MSG:” is not necessarily at the beginning of a line.
The latest “RFM69 Native” version has the final current print properly terminated

      Serial.print(F(",pf4:")); Serial.println(EmonLibCM_getPF(EmonLibCM_getLogicalChannel(4)),4);

@Robert.Wall from his startup messages, I think he is using the older DS. Looking at the code on GitHub, I can’t see “MSG” as part of the output. Was this a change made to work with the EmonESP so potentially his firmware would not work with this serial interfacer?

I was sure I was using the default DS sketch, but perhaps not.

The last line is repeated every 10 seconds

I was only answering what I thought was your question.

If the sketch is always sending both the radio message and the serial message - in whatever format, this has been the cause of complaints from users of the serial output, because they can and do get multiple copies of the data if the radio is not disabled.

I’ve finally tracked down a V3.4, and the change note says that the difference from V3.3 is in the temperature sensor timing, so I think this will be very close. This only saves the RF Band, group and NodeID in EEPROM, so that’s removed from the list of possibilities.

The principal output is by radio. The DEBUG print does not begin: “MSG: …” and there is no other serial print output of power/current values.

I suggest István either updates his emonTx sketch to the latest CM version (EmonTxV3CM/src at master · openenergymonitor/EmonTxV3CM · GitHub), or you (@borpin) tell him which is the correct Interfacer to use with the plain serial output. He should not use the “RFM69 Native” sketch, because the radio message is only compatible with the emonPiCM

If the Git version is used, it would be prudent to change the final print before the end of the file into a println.

Or, István, if you want a challenge, you can change the print statements in your sketch so that sends the values in the correct format, for example:

MSG:1,ct1:25.6,ct2:36.7, ...(etc)...,vrms:230.1,pulse:0

and continue to use the EmonHubTx3eInterfacer.

It worked!
Works with the new firmware.
Thanks!
:grinning: :grinning: :grinning:

2 Likes