EmonCMS Spinner on Input Tab - no data received - and eventual loss of http connection to EmonPi

Hi All

Hoping someone can help me with troubleshooting my installation a little. I’m trying to set up monitoring in a community building that has a mixture of single and multi phase supplies. I have two EmonTx4 units and one EmonPi emonBase [edit by MOD]. So far we have only put one of the Tx4s in (channel 18). It has four inputs, the first three are multiphase with 3x50A sensors, then a single phase with a 20A. The sensors were installed by an electrician following the instructions (I am not an expert in circuits as such). I then went in and set up the EmonTx config as above using the Web UI.

I have set up the EmonPi emonBase [edit by MOD] to connect to the mesh wifi, which starts off OK. But I am now encountering 2 problems:

1 On the inputs tab of the EmonCMS I just get an endless waiting spinner, with no data being received;
2. Maybe due to this problem, the system may be gradually overloading, as eventually my web connection to the EmonPi emonBase [edit by MOD] starts to timeout (after about 5 mins), only being fixed by a reboot.

Some pointers on what might be happening and what to try next would be great. Unfortunately I can’t easily check the clamp installation as they are inside the switch box.

emonhub.log

2023-06-07 09:50:13,129 INFO     MainThread EmonHub v2.5.5
2023-06-07 09:50:13,129 INFO     MainThread Opening hub...
2023-06-07 09:50:13,130 INFO     MainThread Running as user: pi
2023-06-07 09:50:13,130 INFO     MainThread Logging level set to DEBUG
2023-06-07 09:50:13,130 INFO     MainThread Creating EmonHubOEMInterfacer 'EmonPi2'
2023-06-07 09:50:13,131 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 38400 bits/s
2023-06-07 09:50:13,133 INFO     MainThread Creating EmonHubOEMInterfacer 'USB0'
2023-06-07 09:50:13,134 ERROR    MainThread Could not open serial port: /dev/ttyUSB0 @ 115200 bits/s (retry every 10s)
2023-06-07 09:50:13,135 INFO     MainThread Creating EmonHubRFM69LPLInterfacer 'SPI'
2023-06-07 09:50:13,151 INFO     MainThread Creating RFM69 LowPowerLabs interfacer
2023-06-07 09:50:13,151 INFO     MainThread node_id = 5
2023-06-07 09:50:13,151 INFO     MainThread network_id = 210
2023-06-07 09:50:13,151 INFO     MainThread Starting radio setup
2023-06-07 09:50:13,175 INFO     MainThread Radio setup complete
2023-06-07 09:50:13,176 DEBUG    MainThread Setting SPI pubchannels: ['ToEmonCMS']
2023-06-07 09:50:13,178 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT'
2023-06-07 09:50:13,179 DEBUG    MainThread Setting MQTT pubchannels: ['ToRFM12']
2023-06-07 09:50:13,179 DEBUG    MainThread Setting MQTT subchannels: ['ToEmonCMS']
2023-06-07 09:50:13,179 INFO     MainThread Setting MQTT node_format_enable: 0
2023-06-07 09:50:13,180 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2023-06-07 09:50:13,180 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2023-06-07 09:50:13,180 INFO     MainThread Setting MQTT node_JSON_enable: 0
2023-06-07 09:50:13,181 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2023-06-07 09:50:13,182 DEBUG    MainThread Setting emoncmsorg interval: 30
2023-06-07 09:50:13,182 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2023-06-07 09:50:13,182 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2023-06-07 09:50:13,183 WARNING  MainThread Setting emoncmsorg apikey: obscured
2023-06-07 09:50:13,183 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2023-06-07 09:50:13,183 INFO     MainThread Setting emoncmsorg senddata: 1
2023-06-07 09:50:13,184 INFO     MainThread Setting emoncmsorg sendstatus: 0
2023-06-07 09:50:13,184 INFO     MainThread Setting emoncmsorg sendnames: 1
2023-06-07 09:50:13,184 INFO     MainThread Setting emoncmsorg compress: 0
2023-06-07 09:50:13,185 DEBUG    MainThread Automatic configuration of nodes enabled

EmonHub Config

#######################################################################
#######################      emonhub.conf     #########################
#######################################################################
### emonHub configuration file, for info see documentation:
### https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md
#######################################################################
#######################    emonHub  settings    #######################
#######################################################################

[hub]
   ### loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL
   loglevel = DEBUG
   autoconf = 1
### Uncomment this to also send to syslog
# use_syslog = yes
#######################################################################
#######################       Interfacers       #######################
#######################################################################

[interfacers]
   ### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
   [[EmonPi2]]
       Type = EmonHubOEMInterfacer
       [[[init_settings]]]
           com_port = /dev/ttyAMA0
           com_baud = 38400
       [[[runtimesettings]]]
           pubchannels = ToEmonCMS,
           subchannels = ToRFM12,
   
   [[USB0]]
       Type = EmonHubOEMInterfacer
       [[[init_settings]]]
           com_port = /dev/ttyUSB0
           com_baud = 115200
       [[[runtimesettings]]]
           pubchannels = ToEmonCMS,
           subchannels = ToRFM12,
           nodename = emonTx4
   
   [[SPI]]
       Type = EmonHubRFM69LPLInterfacer
       [[[init_settings]]]
           nodeid = 5
           networkID = 210
       [[[runtimesettings]]]
           pubchannels = ToEmonCMS,
   
   
   [[MQTT]]
       Type = EmonHubMqttInterfacer
       [[[init_settings]]]
           mqtt_host = 127.0.0.1
           mqtt_port = 1883
           mqtt_user = emonpi
           mqtt_passwd = emonpimqtt2016
       
       [[[runtimesettings]]]
           pubchannels = ToRFM12,
           subchannels = ToEmonCMS,
           
           # emonhub/rx/10/values format
           # Use with emoncms Nodes module
           node_format_enable = 0
           node_format_basetopic = emonhub/
           
           # emon/emontx/power1 format - use with Emoncms MQTT input
           # http://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
           nodevar_format_enable = 1
           nodevar_format_basetopic = emon/
           
           # Single JSON payload published  - use with Emoncms MQTT
           node_JSON_enable = 0
           node_JSON_basetopic = emon/
   
   [[emoncmsorg]]
       Type = EmonHubEmoncmsHTTPInterfacer
       [[[init_settings]]]
       [[[runtimesettings]]]
           pubchannels = ToRFM12,
           subchannels = ToEmonCMS,
           url = https://emoncms.org
           apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
           senddata = 1    # Enable sending data to Emoncms.org
           sendnames = 1    # Send full input names (compression will be automatically enabled)
           interval = 30    # Bulk send interval to Emoncms.org in seconds

#######################################################################
#######################          Nodes          #######################
#######################################################################

## See config user guide: https://github.com/openenergymonitor/emonhub
## If autoconf is enabled above, node configuration will automatically
## populate based on templates listed in available.conf

[nodes]
   [[18]]
       nodename = emonTx4_18
       [[[rx]]]
           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, 0.01, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.01, 0.01, 0.01, 1.0
           units = n, V, W, W, W, W, W, W, Wh, Wh, Wh, Wh, Wh, Wh, C, C, C, p
   [[23]]
       nodename = emonth2_23
       [[[rx]]]
           names = temperature, external temperature, humidity, battery, pulsecount
           datacodes = h, h, h, h, L
           scales = 0.1, 0.1, 0.1, 0.1, 1.0
           units = C, C, %, V, p
 

Edits by MOD as it is an emonBase as confirmed by OP.

Hello @paulusm and welcome to the forum!

Do you have an existing EmonPi (silver aluminium case, LCD display on the front) from a previous installation or did you mean that you have an emonBase (black enclosure no LCD display) ?

Hi, it’s the emonBase

Thanks!

It might be worth trying the following URL’s just to clear any inputs that may be causing issues on that page:

http://IP-ADDRESS/device/clean.json
http://IP-ADDRESS/input/clean.json

It might also be worth running a system update to make sure you have the latest software versions.

How are you expecting the TX4 and emonBase to communicate? Via RFM (radio packets) or direct USB?

Hi @borpin - was planning on using the radio as its on the other side of the room right now. And it looked like it had picked up the node OK in the config?

OK, I really need @TrystanLea to weigh in here as I am not sure if this is the default setup.

What you have is an EmonTX talking to the EmonBase (that has an RFM Module plugged into the Pi). On the EmonBase there is a bit of software called emonhub (the config above) that picks up data from various sources and primarily sends it back out to emoncms to record the data.

You have 3 interfacers specified, but I think you probably only need one of them (probably the EmonPi2 one but I cannot be certain). This is connecting to the serial port on the GPIO Pins and reading the data from the RFM Module.

[interfacers]
   ### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
   [[EmonPi2]]
   
   [[USB0]]
   
   [[SPI]]

From the log, is that all you get? If so, emonhub is not receiving any data.

[edit]

Just to check, you connected the emonTX4 directly to the emonBase by USB to do this?

And then saved the config?

No, I did the EmonTx config from the browser based tool as per the setup instructions

image

So plugged it into a PC then?

Did you definitely save the changes?

image

OK, some progress

When I ran

http://IP-ADDRESS/device/clean.json

I got the message

Fatal error: Uncaught mysqli_sql_exception: Table 'input' is marked as crashed and should be repaired in /var/www/emoncms/Modules/input/input_model.php:501 Stack trace: #0 /var/www/emoncms/Modules/input/input_model.php(501): mysqli->query() #1 /var/www/emoncms/Modules/input/input_controller.php(84): Input->clean() #2 /var/www/emoncms/core.php(78): input_controller() #3 /var/www/emoncms/index.php(242): controller() #4 {main} thrown in /var/www/emoncms/Modules/input/input_model.php on line 501

So as per this SO answer I ran (via SSH, which I had to enable by adding the empty ssh file to the boot partition on the SD card)

sudo  mysqlcheck --repair --all-databases

And now I get the input screen without the spinner. I can also see the node (this is off site though at the moment with a different emonTx4).

DIdn’t quite solve the wifi issue but that’s next