setting up emontx v2 with emonhub

hello,

i have an older emontx v2 unit, which was all setup and working. I have a  rfm12 receiver attached to a rasp pi. again, was all working.

my old system crashed, so i setup the new pi SD image. which had emonhub and emonCMS on it.

i am trying to configure my emontxv2 to be seen and data logged. I just can't figure out what to do.

it seems i have to configure emonhub to recieve the data. I have set my baud rate, and i get data from the unit. 

a small example  below from emonhub.log:

2015-07-04 02:43:40,710 DEBUG    RFM2Pi     191 NEW FRAME : 10 237 254 0 0 0 0 232 96
2015-07-04 02:43:40,716 WARNING  RFM2Pi     191 Scales ['1', '1', '1', '1', '0.01', '0.1', '0.1', '0.1', '0.1', '0.1', '0.1', '1'] for RX data : [237, 254, 0, 0, 0, 0, 232, 96] not suitable

2015-07-04 02:43:46,073 DEBUG    RFM2Pi     192 NEW FRAME : 10 231 254 0 0 0 0 231 96
2015-07-04 02:43:46,078 WARNING  RFM2Pi     192 Scales ['1', '1', '1', '1', '0.01', '0.1', '0.1', '0.1', '0.1', '0.1', '0.1', '1'] for RX data : [231, 254, 0, 0, 0, 0, 231, 96] not suitable

 

The data is being received, but i have no idea how to change the config to make it work with the emontxv2. All the examples i can find via search and google are for the v3 and these just don't work.

my config for node 10 is as follows :

[[10]]
    nodename = emonTx_1
    firmware =emonTxV2_CT123_Voltage
    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,  Vrms                                        #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                  #Firmware =<V1.4 (un-comment)
       #units =W,W,W,V                           #Firmware =<V1.4 (un-comment)

 

this is the default, but i can't work out what to change, documentation for the emonhub.conf is very poor.

can anyone point me in the right direction please? I would be most grateful.

Thanks,

 

Stephen.

 

 

 

pb66's picture

Re: setting up emontx v2 with emonhub

Hi Stephen
You are quite right the emonHub documentation is lacking somewhat, however with the original emonHub, when you installed it and added your emoncms apikey(s), it would of worked correctly 'out of the box', it was designed to work in "OEM legacy mode" by default. 

The emon-pi variant of emonHub included on the 'post-emonPi' SDcard image is heavily adapted for use with the emonPi and emonCMS low-write v8.5, it can still be used in other ways but the settings and the image documentation lean towards the emonPi.

Are you intending to run a local emoncms? if so what version? 

The low-write v8.5 emoncms requires more info from emonhub to automatically configure the inputs, the node 10 configuration you see in the conf is to set up the inputs from the current range of emoncms hardware.
By having [[10]] declared in the [nodes] means the "legacy defaults" will be over ruled by what is defined, correct or not.

As a quick fix/test try changing the [[10]] to an out of range number eg [[100]], if you have added an emoncms.org apikey to the conf already then emonHub should assume node 10 is a "standard OEM" node and default processing used, I hope this is still the case for this version. but if not we can define "your" node 10.

I can see you have figured out the use of the single datacode 'h' which would have worked in pre-emonPi emonhub, in this version though it moves the problem along to scales (hence the error you see), emonhub has received 8 bytevalues which you have defined as ints so it is expecting 4 scales and gets 12, scale = 1 (no plural) should resolve this, but may not as there are several changes not in the original so I'm not 100%. 

So if using the local emonCMS low-write v8.5 or want node 10 defined anyway you could try 
[[10]]
    nodename = emonTx_1
    firmware = emonTxV2_CT123_Voltage
    hardware = emonTx_v2_2
    [[[rx]]]
        names = power1, power2, power3, Vrms
        datacodes = h, h, h, h # (a little more specific than datacode = h)
        scales = 1,1,1,1
        units =W,W,W,V 
        
This uses generic terms for [[[rx]]] names, you can replace with your own if you prefer eg grid, solar, hotwater, voltage etc to match any existing emoncms labels.

The more emonhub'ish way to have done this would of been to not include any default nodes active (leave commented out maybe or "just add node id" perhaps) and make emonhub allocate default values if the node is not defined so the equivalent of

[[any undefined node id]]
    nodename = the undefined node id
    firmware = ""
    hardware = ""
    [[[rx]]]
        name = the values array position
        datacode = h
        scale = 1
        unit = ""

please let us know how you get on as I'm sure other emonTx v2 users may find this useful.

Paul

euridium's picture

Re: setting up emontx v2 with emonhub

Hello Paul,

 

thanks for the info, things start to make a bit more sense.

my plan, ultimately, is to use a linux server installed version of the CMS, and have the hub feed into that, but that is not set up yet as i was trying to setup 1 bit at a time and get it working.

 

is there a different SD image that i should be using? All the setup is very different from the last time i set this all up, so my learning curve has started from nearly zero again.

I have tried to setup the node as you suggested but something isn't  happy.

when i move the config to [[100]]. by moving the config away from node [[10]] the input it picked up by the "nodes" tab in the emoncms tab on the web config, where it wasn't before.

if i add a node defenition in that is "generic" as you suggest

-----

[[10]]
    nodename = 10
    firmware = ""
    hardware = ""
    [[[rx]]]
        name = the values array position
        datacode = h
        scale = 1
        unit = ""

-----

then this works ok, but i've clearly not defined any units or scales, etc.

if i try to define them with something like this :

[[10]]
    nodename = 10
    firmware = ""
    hardware = ""
    [[[rx]]]
        name = the values array position
        datacode = h, h, h, h
        scale = 1,1,1,1
        unit = ""

 

the config dies, and i get lots of these :

2015-07-04 11:25:09,964 WARNING MainThread RFM2Pi thread is dead

2015-07-04 11:25:10,206 WARNING MainThread RFM2Pi thread is dead

2015-07-04 11:25:10,456 WARNING MainThread RFM2Pi thread is dead
 

in the log.

i then have to change the config and reboot the pi to get it working.

 

clearly the 9 byte values recieved from the emon_tx are not straight numbers

i presume the data format is : unsig int - node id

sig  long - power1 (2 bytes)

sig long - power 2 (2 bytes)

sig long - power 3 (2 bytes)

unsig long - volts * 10 ( 2 bytes)

??

Trying this out :

-----

[[10]]
    nodename = 10
    firmware = ""
    hardware = ""
    [[[rx]]]
        name = the values array position
        datacode = l, l, l, L
        scale = 1,1,1,1
        unit = ""

-----

also fails, and i get the same

2015-07-04 11:25:10,456 WARNING MainThread RFM2Pi thread is dead

type error message.

i'm confused. clearly the node works, both the TX and RX sides, but trying to setup the data types fails totally, i'm clearly totally missing something!

 

Thanks!

 

Stephen.

 

pb66's picture

Re: setting up emontx v2 with emonhub

I'm afraid I cannot explain the "WARNING MainThread RFM2Pi thread is dead" log messages beyond emonhub hasn't handled an error and that thread has crashed (which you had probably worked out).

The 9 values are node id plus 4 byte-pair integers. all the data settings ignore the node id and only refer to the data portion eg in your case the last 8 bytes. The datacodes then define how many values to form from those bytes.

When illustrating what emonhub should be defaulting to, the "the values array position" in italics in your particular case would be 1,2,3,4. This is to replicate the " normal behavior of the emoncms inputs module,

Also the use of plurals as opposed to the singular in datacode, scale and unit etc is deliberate to signify slightly different things, eg "datacode = h" means the data packet consists of only signed ints of an undefined number(legacy) like a global datacode for that node, so any even number of data bytes will be acceptable. However "datacodes = h" (plural) means the fully defined datacodes for this node is a single h therefore 2bytes/1 int, likewise "datacodes = h, h, h, h" specifically defines 4 ints (8bytes).

This use of plurals should be consistent through all the nodes data settings ie (names,) scales and units etc.

[[10]]
    nodename = 10
    firmware = ""
    hardware = ""
    [[[rx]]]
        names = 1, 2, 3, 4
        datacode = h 
        scale = 1
        units = w,w,w,v

or to be a little more specific try

[[10]]
    nodename = 10
    firmware = ""
    hardware = ""
    [[[rx]]]
        names = 1, 2, 3, 4
        datacodes = h, h, h, h
        scales = 1,1,1,1
        units = w,w,w,v

Paul

euridium's picture

Re: setting up emontx v2 with emonhub

Thanks Paul,

 

that seemed to do the trick.

Just working through some issues with my install of opencms now :)

 

Stephen.

 

fbonte's picture

Re: setting up emontx v2 with emonhub

Thanks to this thread by Paul and Stephen, I finally managed to get my home energy monitoring system up and running...!

I bought my hardware almost 2 years ago, but never succeeded in setting it up properly. When I did a little cleaning of the mancave last week, I found my box of parts and decided to give it another go... with success this time!

 

Here in Belgium, there is a company that sells a similar commercial product. One of the features is that the software takes a 'DNA' sample of your electrical appliances so the system recognizes what is switched 'on' and thus what is causing the power consumption. Are there any plans to develop this for the openenergy community in the future?

 

Cheers,

Filip

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.