Latest Build Version 10.2.7 Serial Interface stopped working

I just had automatic update after a restart caused by power loss. It updated from low-write Version 10.2.7 to the latest build 10.5.6. Now one of my Serial Inputs stopped working.

I am using 2 Inputs total, both UART Serial. The one coming from an ESP32 for Energy is still working, the one from Arduino Pulse counter stopped.

I inserted my backup SD card with Version 10.2.7, and both serial Input works, so there is no problem with the Arduino sending Serial data.

There is a slight possibility that the upgraded 10.5.6 got corrupted during power loss. But unlikely, that it just caused a serial feed to stop working. Everything else is fine. I did have to run “cd /var/www/emoncms && git pull”, to get all the sidebar and top menus to appear again after update.

‘’’
[[SerialTx3e]]
Type = EmonHubTx3eInterfacer
[[[init_settings]]]
com_port = /dev/ttyAMA1
com_baud = 115200
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
nodeoffset = 9

[[9]]
nodename = emontx5
[[[rx]]]
names = pulse1, pulse2, pulse3, pulse4, pulse5, pulse6, pulse7, pulse8, pulse9, pulse10, pulse11, pulse12
datacode = 0
#datacodes = L,L,L,L,L,L,L,L,L,L,L,L
scales = 1,1,1,1,1,1,1,1,1,1,1,1
units =p,p,p,p,p,p,p,p,p,p,p,p

‘’’

Hello @dlmpryor do you see any errors in your emonhub log? perhaps try restarting emonhub and seeing if any errors are printed just after the restart.

Thanks Trystan for the reply. I did a EmonHub restart. It is attached in the text file.

I did notice that [[SerialTx3e]] does not Publish to MQTT after update. It is a custom Arduino serial pulse counter using your 12 pulse output program.

The input I used in EmonHub config is “Type = EmonHubTx3eInterfacer”, so may not work with version 10.5.6?
In the EmonHub log, is as follows: SerialTx3e START MESSAGE: 0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0
and never gets to MQTT Publishing?
emonhub log.txt (18.6 KB)

Working on this issue more today, it appears to have something to do with MQTT Publishing using Type = EmonHubTx3eInterfacer. I do have another direct serial using Type = EmonHubSerialInterfacer, and it is still working after update to build 10.5.6.

From the Emoncms Log, every time I reboot I get this Warning:
2021-06-26 11:53:13.812|WARN|emoncms_mqtt.php|Not connected, retrying connection
2021-06-26 11:53:13.862|WARN|emoncms_mqtt.php|Connecting to MQTT server: Connection Accepted.: code: 0

The actual time I rebooted the PI was 2021-06-26 06:10:09,131 (UTC),
but it looks like MQTT is 2021-06-26 12:06:26.381

The direct serial sent from the Arduino is time:count:
‘’’
//--------------------------------------------------------------------
// Spit out data every 1s (time here is in microseconds)
//--------------------------------------------------------------------
if ((time - ltime) > (1000000 * printTime))
{
ltime = time; //Print timer

for (int i = 2; i <= 13; i++)          //For all inputs:
{
  //dlp 01012019 Change to match format of EmonCMS
  Serial.print(p[i].rate(time));  Serial.print(':'); Serial.print(p[i].count);  //Print values
  //Serial.print(p[i].prateAccum); Serial.print(p[i].count);  //Print values
  if (i != 13) Serial.print(',');

  p[i].count = 0;                      //Reset count (we just send count increment)
  p[i].prateAccum = 0;                 //Reset accum so that we can calculate a new average
}
Serial.println();                      //End line

}

}
‘’’

I will post my solution to the custom direct serial interface that stopped working after update, just in case someone has a similar problem.

Thankfully none of the leaders replied right away, since the solution was probably obvious to them. This forced me to learn more about the EmonHub interfacer and proper serial data input.

Turns out I was using a deprecated method to send direct serial data to the “EmonHubTx3eInterfacer”.

Seems to be working good now, any suggestions are welcome, following are the changes:

Changed in EmonHub serial interface from Type = EmonHubTx3eInterfacer to EmonHubSerialInterfacer:

[[SerialTx3e]]
      //Type = EmonHubTx3eInterfacer
      Type = EmonHubSerialInterfacer
      [[[init_settings]]]
           com_port = /dev/ttyAMA1
           com_baud = 115200
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,
	   nodeoffset = 9

Also had to modify the Arduino program to:

//if ((time - ltime) > (1000000 * printTime))
  if ((time - ltime) > (10000000 * printTime)) // change to 10 seconds
  {
    ltime = time;                          //Print timer

    for (int i = 2; i <= 13; i++)          //For all inputs:
    {
      //dlp 01012019 Change to match format of EmonCMS
      //Serial.print(p[i].rate(time));  Serial.print(':'); Serial.print(p[i].count);  //Print values
      //Serial.print(p[i].prateAccum); Serial.print(p[i].count);  //Print values
      Serial.print(p[i].count);  Serial.print(' ');//Print Values
      //if (i != 13) Serial.print(',');
      if (i != 13);

      p[i].count = 0;                      //Reset count (we just send count increment)
      p[i].prateAccum = 0;                 //Reset accum so that we can calculate a new average
    }
    Serial.println();                      //End line
  }
}

Edit - fixed formatting - Moderator