EmonHub install

I currently have an RPi 1 (Model B) running EmonHub - at least that’s what I recall I installed around 18 months ago, posting only to the hosted EmonCMS.

In addition, I also have an RPi 2 running OpenHab.

I’d like to consolidate the Emon set-up onto the RPi2

Questions:

  1. How do I verify what Emon set-up I have - assumed to be EmonHub only?
  2. How do I install just EmonHub (and dependencies) onto the OpenHab set-up; I’ve looked for EmonHub install instructions but can only find them associated to an install of the the SD image.

Thanks
James

Hello James,

The installation notes for the variant of emonhub running on the emonpi/emonbase (standalone install) are here:

Interested to hear if that works for you ok as its been a while since I installed it manually.

emonhub --version will tell you the version of emonhub you are running, you may need to use a path for that eg /home/pi/emonhub/src/emonhub.py on the emonpi sdcard image or if you have the emonhub utilities menu installed it will be just emonhub -v

Installation instructions for the original flavour of emonhub are also referenced in the emoncms install guide’s “emonhub” section

Excellent - Thank you, I had searched for details, but failed to find them.

It seems I’m running an old version:

[email protected] ~/emonhub/src $ python emonhub.py --version
emonHub Pre-Release Development Version (rc1.0)
[email protected] ~/emonhub/src $ 

I’m now trying to transfer over the settings from rc1.0 to the latest, my existing rc1.0 look like this:

[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'
[[10]]
        datacodes = h, h, h, h

However, the thing that’s throwing me here is that I have two nodes reporting back to the emontx, the log file gives:

2016-07-16 08:07:36,177 DEBUG 11 NEW FRAME : 1468652856.18  10 0 255 33 2 0 0 216 94
2016-07-16 08:07:36,183 DEBUG 11 Timestamp : 1468652856.18
2016-07-16 08:07:36,186 DEBUG 11      Node : 10
2016-07-16 08:07:36,189 DEBUG 11    Values : [-256, 545, 0, 24280]
2016-07-16 08:07:36,195 DEBUG 11 Append to 'emonCMS' buffer => time: 1468652856.18, data: [10, -256, 545, 0, 24280], ref: 11
2016-07-16 08:07:36,301 INFO Sending: http://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1468652856.18,10,-256,545,0,24280]]&sentat=1468652856
2016-07-16 08:07:36,385 DEBUG Receipt acknowledged with 'ok' from http://emoncms.org
2016-07-16 08:07:40,871 DEBUG 12 NEW FRAME : 1468652860.87  17 179 16 72 15 253 14 34 14 197 13 102 10
2016-07-16 08:07:40,877 DEBUG 12 Timestamp : 1468652860.87
2016-07-16 08:07:40,880 DEBUG 12      Node : 17
2016-07-16 08:07:40,884 DEBUG 12    Values : [4275, 3912, 3837, 3618, 3525, 2662]
2016-07-16 08:07:40,907 DEBUG 12 Append to 'emonCMS' buffer => time: 1468652860.87, data: [17, 4275, 3912, 3837, 3618, 3525, 2662], ref: 12
2016-07-16 08:07:41,012 INFO Sending: http://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[[1468652860.87,17,4275,3912,3837,3618,3525,2662]]&sentat=1468652861
2

Unless I’m reading the wrong .conf file (I’ve followed the symlink from the /etc/init.d/emonhub file, I don’t
There are two questions:

  1. Do I need to define node 17 in the new .conf file too
  2. How do I define the config for my nodes 10 and 17 ?
    Thanks
    James

One more thing, I’m getting lots of .log activity too:

2016-07-16 08:15:21,164 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:21,265 INFO     MQTT       Connecting to MQTT Server
2016-07-16 08:15:21,269 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:21,383 INFO     MQTT       Connecting to MQTT Server
2016-07-16 08:15:21,387 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:21,467 INFO     emoncmsorg sending: https://emoncms.org/input/bulk.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y&data=[]&sentat=1468653321
2016-07-16 08:15:21,488 INFO     MQTT       Connecting to MQTT Server
2016-07-16 08:15:21,492 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:21,607 INFO     MQTT       Connecting to MQTT Server
2016-07-16 08:15:21,611 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:21,632 DEBUG    emoncmsorg acknowledged receipt with 'ok' from https://emoncms.org
2016-07-16 08:15:21,633 INFO     emoncmsorg sending: https://emoncms.org/myip/set.json?apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y
2016-07-16 08:15:21,713 INFO     MQTT       Connecting to MQTT Server
2016-07-16 08:15:21,716 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:21,831 INFO     MQTT       Connecting to MQTT Server
2016-07-16 08:15:21,835 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:21,936 INFO     MQTT       Connecting to MQTT Server
2016-07-16 08:15:21,939 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:22,054 INFO     MQTT       Connecting to MQTT Server
2016-07-16 08:15:22,058 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:22,160 INFO     MQTT       Connecting to MQTT Server
2016-07-16 08:15:22,164 INFO     MQTT       Unexpected disconnection
2016-07-16 08:15:22,277 INFO     MQTT       Connecting to MQTT Server

Which suggests a problem with mosquitto?

The “rc1.0” appears to be the original emonhub which is pretty much as it stands today, there have been some very minor changes to the default settings and baud detection was added but the latest version of original emonhub is rc1.2.

The declaration of node [[10]] in your existing setup is not really required as emonhub decodes the data coming in via rfm as 16bit signed ints (h) by default so the

only really serves to explicitly define the size of the packet as 4 unsigned 16bit integers, which is why node 17 is working too.

This latest log is from the “emonpi variant” of emonhub and depending on what you wish to do you may well need to define the nodes, certainly in the days of the nodes module it was mandatory but I’m no longer sure where thing are currently.

The log messages do indeed suggest an issue with the mqtt broker, did you have an existing broker running for openhab? did you have authentication enabled? my experience here is limited I’m afraid so perhaps someone else can step in with some assistance.

OK, thanks all for the help so far… It is indeed a problem with Mosquitto…sort of…

I get the following output in the mosquitto log file:

Jul 26 20:46:08 openhab mosquitto[6216]: New connection from 127.0.0.1.
Jul 26 20:46:08 openhab mosquitto[6216]: Invalid protocol "MQTT" in CONNECT from 127.0.0.1.
Jul 26 20:46:08 openhab mosquitto[6216]: Socket read error on client (null), disconnecting.

When starting the emonhub service.
I had similar with mySensors, and it appears it’s down to the version of MQTT version used:

#define MQTT_VERSION MQTT_VERSION_3_1
//#define MQTT_VERSION MQTT_VERSION_3_1_1

from: [SOLVED] ESP8266MQTTClientGateway problem | MySensors Forum

How do I change the version in emonhub?

Thanks
James

Solved:

Followed the instructions here to install mosquitto:
https://mosquitto.org/2013/01/mosquitto-debian-repository/

Cheers
James