Getting Restarted

I have an emonBase (RaspberryPi RF add-on: RFM69Pi - 433Mhz, Raspberry Pi 2 & 4GB Pre-built SD card) and a emonTx V3 and ran into an issue recently. The heat pump it was attached to now shows as inactive. I looked at the log and there is Error parsing config file “/home/pi/data/emonhub.conf”:. To fix that, I opened the EmonHub Config Editor and updated the apikey for the Read & Write api’s. (it had been set to “xxxxx…”). I rebooted the pi but I get

[email protected]:~$ sudo service emonhub status
[FAIL] Checking OpenEnergyMonitor emonHub: emonhub process has failed!

any suggestions on next steps to fix this?

Thanks,
Don

anything in the logs files that might lead you to the error on startup?

Yes, I am getting

2017-02-20 00:40:32,087 CRITICAL MainThread Error parsing config file “/home/pi/data/emonhub.conf”: Parsing failed with several errors.
First error at line 246.

in the emonconfig log view

can you copy and paste line 246 here of your config? and a few line above/below

Take a good hard look at your emonhub.conf file.

It sounds as if something has gone seriously wrong when you edited it. Is there anything significant at or leading up to line 246? Is that where you did the edit, if not look there.

@dcolecpa But mask your APIKey!

(And for good measure, fill in your country in your profile. It helps us with time zones, electricity supply system, etc.)

It looks like line 246 is

[[[rx]]]

Here are the lines around it.

[[8]]
nodename = emonTx_3
firmware =V2_3_emonTxV3_4_DiscreteSampling
hardware = emonTx_(NodeID_DIP_Switch1:OFF)
[[[rx]]]
names = power1, power2, power3, power4, Vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
datacodes = h,h,h,h,h,h,h,h,h,h,h,L
scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1
units =W,W,W,W,V,C,C,C,C,C,C,p

Please let me know what you think

Also I uploaded the whole conf file ( wiht the apikey modified). The line numbering is out of sync but thought it may help. Econcms.txt (17.2 KB)

Thanks,
Don

Oops! Something’s gone wrong either with your download or your editing. You have duplicate node numbers - there are 3 instances of Node 8 for example in there, and some illegal statements.

What happened at Node 20 - Line 112:

datacode = h2/26/2017 Emoncms


scales = 0.1,0.1,0.1,0.1
units = C,C,%,V

That’s seriously wrong. “2/26/2017 Emoncms” shouldn’t be in there. It should be like Node 21 below.

Also Node 5 - Line 231 similarly:

names = power1,power2,power1_plus_power2,Vrms,T1,T2,T3,T4,T5,T6,pulseCount
datacodes = h, h, h, h, h, h, h, h, h, h, L2/26/2017 Emoncms

 scales = 1,1,1,0.01,0.1,0.1,0.1,0.1,0.1,0.1,1
units = W,W,W,V,C,C,C,C,C,C,p

I think you need to do some serious weeding!
You only need the node definitions that you are actually using, all the others can be deleted if that’s easier than looking for syntax errors.

But Line 246 (Node 8) looks correct! It’s only there that all the previous errors got too much for it and it gave up.

Thanks for the heads up, I think the 2/28/17 references are from my downloading . The rest I will try to weed out. Ah well, onward through the fog. …

Thanks,
Don

It might be easier to start with a default file and just lift the good bits out of yours!

Here is the default from the latest (Nov 16) image.emonpi.default.emonhub.conf.zip (1.6 KB)

Note that there is one set only of Nodes 5 - 11 & 19 - 26. And as I wrote earlier, you only need Node 5 for your emonPi and one other for your emonTx.

Here is the default emonhub fie on github:

Thanks for the info and help. I will start weeding out the junk.

Thanks,
Don

I’ve made some progress and weeded out the junk from my config file. I still have some issues and the log indicates that I keep connecting and disconnecting from the mqtt server (please see attached screenshot) . Any suggestions on the next steps?

Thanks,
Don

Could you have accidently changed to MQTT settings in the conf:

It seems emonhub is unable to connect to the localhost mqtt server. Could you post your full config file

I tried pasting in the top section of the standard config file, updating the api key, but still have the same issue.

I’d be happy to post the complete file however, I am having challenges getting it. I am fairly new to Linux / Pi’s and can’t seem to get the file.

I’ve tried copying and pasting the file from the Emons Editor and while ‘Copy’ is available in Chrome, ‘Paste’ is not available in Leafpad (or other editors), nor does Ctrl C and Ctrl V work (?!)

I tried the SCP command over SSH but couldn’t get the syntax right

Do I need to take down the pi and hook up a keyboard and monitor and get it directly, or is there a simpler way you can suggest.?

Thanks for the help

in the Emoncms emonHub config editor CTRL + A (to select all) then CTRL+C (to copy) works fine for me on chrome and firefox.

Worked well with Firefox. Here is the file.

Thanks,
Don

#######################################################################
#######################      emonhub.conf     #########################
#######################################################################
### emonHub configuration file, for info see documentation:
### http://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
### Uncomment this to also send to syslog
# use_syslog = yes
#######################################################################
#######################       Interfacers       #######################
#######################################################################

[interfacers]
### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
[[RFM2Pi]]
    Type = EmonHubJeeInterfacer
    [[[init_settings]]]
        com_port = /dev/ttyAMA0
        com_baud = 38400                        # 9600 for old RFM12Pi
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        subchannels = ToRFM12,

        group = 210
        frequency = 433
        baseid = 5                              # emonPi / emonBase nodeID
        calibration = 230V                      # (UK/EU: 230V, US: 110V)
        quiet = true                            # Disable quite mode (default enabled) to enable RF packet debugging, show packets which fail crc
        # interval =  0                         # Interval to transmit time to emonGLCD (seconds)
        

[[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 = 1
        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/

[[emoncmsorg]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = https://emoncms.org
        apikey = somethinghere
        senddata = 1                    # Enable sending data to Emoncms.org
        sendstatus = 1                  # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
        sendinterval= 30                # Bulk send interval to Emoncms.org in seconds

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

[nodes]

### List of nodes by node ID
### 'datacode' is default for node and 'datacodes' are per value data codes.
### if both are present 'datacode' is ignored in favour of 'datacodes'
### eg node 99 would expect 1 long and 4 ints, unless the "datacodes" line
### was removed, then "datacode" would make it expect any number of longs,
### likewise per value "scales" will override default node "scale", the number
### of "scales" must match the number of values or frame will be discarded.

[[5]]
    nodename = emonPi
    firmware = emonPi_RFM69CW_RF12Demo_DiscreteSampling.ino
    hardware = emonpi
    [[[rx]]]
        names = power1,power2,power1_plus_power2,Vrms,T1,T2,T3,T4,T5,T6,pulseCount
        datacodes = h, h, h, h, h, h, h, h, h, h, L
        scales = 1,1,1,0.01,0.1,0.1,0.1,0.1,0.1,0.1,1
        units = W,W,W,V,C,C,C,C,C,C,p
     
[[6]]
    nodename = emonTxShield
    firmware =emonTxShield
    hardware = emonTxShield
    [[[rx]]]
       names = power1, power2, power3, power4, Vrms
       datacode = h
       scales = 1,1,1,1,0.01
       units =W,W,W,W,V

[[7]]
    nodename = emonTx_4
    firmware =V2_3_emonTxV3_4_DiscreteSampling
    hardware = emonTx_(NodeID_DIP_Switch1:OFF)
    [[[rx]]]
       names = power1, power2, power3, power4, Vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
       datacodes = h,h,h,h,h,h,h,h,h,h,h,L
       scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1
       units =W,W,W,W,V,C,C,C,C,C,C,p

[[8]]
    nodename = emonTx_3
    firmware =V2_3_emonTxV3_4_DiscreteSampling
    hardware = emonTx_(NodeID_DIP_Switch1:OFF)
    [[[rx]]]
       names = power1, power2, power3, power4, Vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
       datacodes = h,h,h,h,h,h,h,h,h,h,h,L
       scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1
       units =W,W,W,W,V,C,C,C,C,C,C,p

[[9]]
    nodename = emonTx_2
    firmware =V1_6_emonTxV3_4_DiscreteSampling
    hardware = emonTx_(NodeID_DIP_Switch1:ON)
    [[[rx]]]
       names = power1, power2, power3, power4, Vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse #Firmware V1.6
       #names = power1, power2, power3, power4, Vrms, temp                                           #Firmware =<V1.4 (un-comment)
       datacode = h
       scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1 #Firmware V1.6
       units =W,W,W,W,V,C,C,C,C,C,C,p                   #FirmwareV1.6
       #scales = 1,1,1,1,0.01,0.1                       #Firmware =<V1.4 (un-comment)
       #units =W,W,W,W,V,C                              #Firmware =<V1.4 (un-comment)

[[10]]
    nodename = emonTx_1
    firmware =V1_6_emonTxV3_4_DiscreteSampling
    hardware = emonTx_(NodeID_DIP_Switch1:OFF)
    [[[rx]]]
       names = power1, power2, power3, power4, Vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse #Firmware V1.6
       #names = power1, power2, power3, power4, Vrms, temp        #Firmware =<V1.4 (un-comment)
       datacode = h
       scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1 #Firmware V1.6
       units =W,W,W,W,V,C,C,C,C,C,C,p                   #FirmwareV1.6
       #scales = 1,1,1,1,0.01,0.1                       #Firmware =<V1.4 (un-comment)
       #units =W,W,W,W,V,C                              #Firmware =<V1.4 (un-comment)
      
[[11]]
    nodename = 3phase
    [[[rx]]]
       names = powerL1, powerL2, powerL3, power4, Vrms, temp1, temp2, temp3, temp4, temp5, temp6
       datacode = h
       scales = 1,1,1,1,0.01,0.1,0.1,0.1,0.1,0.1,0.1
       units =W,W,W,W,V,C,C,C,C,C,C

[[19]]
    nodename = emonTH_1
    firmware = emonTH_DHT22_DS18B20_RFM69CW
    hardware = emonTH_(Node_ID_Switch_DIP1:OFF_DIP2:OFF)
    [[[rx]]]
       names = temperature, external temperature, humidity, battery
       datacode = h
       scales = 0.1,0.1,0.1,0.1
       units = C,C,%,V

[[20]]
    nodename = emonTH_2
    firmware = emonTH_DHT22_DS18B20_RFM69CW
    hardware = emonTH_(Node_ID_Switch_DIP1:ON_DIP2:OFF)
    [[[rx]]]
       names = temperature, external temperature, humidity, battery
       datacode = h
       scales = 0.1,0.1,0.1,0.1
       units = C,C,%,V

[[21]]
    nodename = emonTH_3
    firmware = emonTH_DHT22_DS18B20_RFM69CW
    hardware = emonTH_(Node_ID_Switch_DIP1:OFF_DIP2:ON)
    [[[rx]]]
       names = temperature, external temperature, humidity, battery
       datacode = h
       scales = 0.1,0.1,0.1,0.1
       units = C,C,%,V

[[22]]
    nodename = emonTH_4
    firmware = V1_5_emonTH_DHT22_DS18B20_RFM69CW
    hardware = emonTH_(Node_ID_Switch_DIP1:ON_DIP2:ON)
    [[[rx]]]
       names = temperature, external temperature, humidity, battery
       datacode = h
       scales = 0.1,0.1,0.1,0.1
       units = C,C,%,V
       
[[23]]
    nodename = emonTH_5
    firmware = V2.x_emonTH_DHT22_DS18B20_RFM69CW_Pulse
    hardware = emonTH_(Node_ID_Switch_DIP1:OFF_DIP2:OFF)
    [[[rx]]]
       names = temperature, external temperature, humidity, battery, pulseCount
       datacodes = h,h,h,h,L
       scales = 0.1,0.1,0.1,0.1,1
       units = C,C,%,V,p
  
[[24]]
    nodename = emonTH_6
    firmware = V2.x_emonTH_DHT22_DS18B20_RFM69CW_Pulse
    hardware = emonTH_(Node_ID_Switch_DIP1:ON_DIP2:OFF)
    [[[rx]]]
       names = temperature, external temperature, humidity, battery, pulseCount
       datacodes = h,h,h,h,L
       scales = 0.1,0.1,0.1,0.1,1
       units = C,C,%,V,p
    
[[25]]
    nodename = emonTH_7
    firmware = V2.x_emonTH_DHT22_DS18B20_RFM69CW_Pulse
    hardware = emonTH_(Node_ID_Switch_DIP1:OFF_DIP2:ON)
    [[[rx]]]
       names = temperature, external temperature, humidity, battery, pulseCount
       datacodes = h,h,h,h,L
       scales = 0.1,0.1,0.1,0.1,1
       units = C,C,%,V,p

[[26]]
    nodename = emonTH_8
    firmware = V2.x_emonTH_DHT22_DS18B20_RFM69CW_Pulse
    hardware = emonTH_(Node_ID_Switch_DIP1:ON_DIP2:ON)
    [[[rx]]]
       names = temperature, external temperature, humidity, battery, pulseCount
       datacodes = h,h,h,h,L
       scales = 0.1,0.1,0.1,0.1,1
       units = C,C,%,V,p

For what it is worth, below is the emonhub.log view

2017-03-07 23:39:34,991 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:34,995 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:35,086 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 56 149 127 4 178 19 130 62 56 23 68 90 247 48 185 153 79 250 7 29 132 (-89)
2017-03-07 23:39:35,096 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:35,100 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:35,201 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:35,205 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:35,306 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:35,310 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:35,412 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:35,416 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:35,517 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:35,521 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:35,622 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:35,626 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:35,727 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:35,731 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:35,832 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:35,836 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:35,896 DEBUG    RFM2Pi     Discarding RX frame 'unreliable content'? 182 192 238 99 104 15 117 62 193 198 244 189 189 243 230 190 220 110 15 21 111 (-87)
2017-03-07 23:39:35,937 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:35,941 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:36,043 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:36,047 INFO     MQTT       Unexpected disconnection
2017-03-07 23:39:36,148 INFO     MQTT       Connecting to MQTT Server
2017-03-07 23:39:36,152 INFO     MQTT       Unexpected disconnection

I can’t see anything wrong with the conf file, however it does seem to be quite an old version. What version of emonSD are you running?

$ ls /boot | grep emonSD

I would recomend you update to the latest version by downloading the latest SD card image (7th Nov 16) and flashing to a fresh SD card (8GB min):

I am running: emonSD-17Jun2015 and will try the more recent version.

Thanks,
Don

1 Like