Multiple EmonPi's post to single remote Emoncms installation

Hi

I seem to be having issues with regards to multip emonpi’s posting input data to my remote emoncms server.

All Pi’s are posting as NODE 5 regardless of whether or not they have been named in the .conf file.

Does anyone have any ideas?

Pete

Following on from our email discussion:

Sorry, just double checked. My mistake, passing names of feeds from local to remote emoncms via emonhub is not supported. I got confused since my emoncms.org inputs were named, this is because I named them manually!

To have multiple emonPi / emonBase post to a single remote emoncms account you will need to use a different node ID for each emonPi then manually name the feeds in your remote emoncms. See here where to change the emonPi node ID. E.g. change 5 to 4 in both locations below:

Emonhub uses the bulk send API to send data to remote emoncms e.g.

https://emoncms.org/input/bulk.json?apikey=fccf2b06379fd43eb5f30a265b7ae92b&data=[[1465735583,5,133,0,133,232.38,0,0,0,0,0,0,0],[1465735588,5,133,0,133,232.27,0,0,0,0,0,0,0],[1465735593,5,132,0,132,233.45000000000002,0,0,0,0,0,0,0],[1465735598,5,130,0,130,231.58,0,0,0,0,0,0,0],[1465735603,5,131,0,131,232.11,0,0,0,0,0,0,0],[1465735608,5,136,0,136,231.88,0,0,0,0,0,0,0],[1465735613,5,133,0,133,232.13,0,0,0,0,0,0,0],[1465735618,5,130,0,130,230.91,0,0,0,0,0,0,0],[1465735620,23,20.3,0,0,2.1,1,-71],[1465735621,19,0,0,0,2.5,557,3,-29],[1465735621,20,19.6,0,71.9,2.5,-68],[1465735623,5,132,0,132,231.27,0,0,0,0,0,0,0],[1465735628,5,131,0,131,231.19,0,0,0,0,0,0,0],[1465735633,5,133,0,133,231.33,0,0,0,0,0,0,0],[1465735638,5,131,0,131,231.16,0,0,0,0,0,0,0]]&sentat=1465735641

As you can see no naming is included in this API. This decision was made to keep bandwidth overhead low. To send names you will need to use the JSON API e.g:

http://localhost/emoncms/input/post.json?node=1&json={power:200}&apikey=fccf2b06379fd43eb5f30a265b7ae92b

https://emoncms.org/site/api#input

Since network overhead is not an issue for you since you are on a local network, maybe emonhub could be modified. I’m not sure how difficult it would be to modify emonhub to use the JSON API and include input names, @Paul?

Or, as an alternative, you could use nodeRED that’s built into each emonPi (port 1880) to make a flow that reads the data from emonPi MQTT then posts to your remote emoncms using the JSON API instead of bulk send which supports naming.

Is that @pb66 - Paul

So i need to manually name the inputs in emon cms? How do i do this?

Also how do i change to the json input on the emonpi

Pete

Inputs can be given names when they are logged to feeds. See user guide: emonCMS: Getting started emonPi/Base — OpenEnergyMonitor 0.0.1 documentation. The inputs themselves can also be given names by clicking on the pencil icon.

This will require changes to emonhub:

It will probably be easier for your just undertake the one step process of naming the feeds on your remote Emoncms

1 Like

And change the node id as above for each emonpi?

The 3 emonPi’s will be hard coded in the firmware to node 5, you can of course edit the firmware on 2 of them but then you have an on-going concern of updating the firmware, either you can allow it to happen automatically and have to re-edit the sketches or sticking with the edited versions and missing any updates.

emonHub has a “nodeoffset” function you could use to get around this. in emonPi No2’s emonhub.conf’s [[rfm2pi]] [[[runtimesettings]]] adding nodeoffset = 10 (for example) will add 10 to the node id’s of any packets streamed from the attached emonpi board so while the firmware remains node 5 it will be presented as node 15 to emoncms, you would also need to edit the emonhub.conf [nodes] section from [[5]] to [[15]] too.

You could then do the same for emonPi No3, but use nodeoffset = 20 for example.This is primarily aimed at expanding on the 1-30 range of node ids available to rfm devices but works equally well for the base as well.

It would require some careful planning if you have other devices particularly rfm based and it will be further restricted if using emoncms.org as you can not use numbers higher than 32, a self hosted emoncms you can just use nodeoffset = 32 and nodeoffset = 64 for the easiest solution.

This is an issue I have brought up before, more than once. I would love to make emonHub create the input names and also have the option to post using json ie not bulk upload but the issue is at the emoncms end as it forces a permanent, incompatible and non reversible choice between 2 systems that could very easily work in harmony and offer interoperable compatibility.
This same “name OR number” barrier also causes an incompatibility between mqtt topics and bulk upload api’s.

emoncms can already do both names and numbers, it already does it just cannot mix and match because it uses the same field as either an index or a name depending on the initial post.

I have offered to make emonhub use both name and index but it won’t work unless emoncms plays ball too. If a choice has to be made between the 2 methods, the index number method is better for emonHub, I will happily add the use of names but not replace the use of index numbers entirely.

No need to change the firmware, the emonPi node ID can be changed in emonhub.conf:

image

ahh yes of course it it can, I forget it’s rfm2pi heritage and was thinking node id not base id!

before i go an mess this up.

please can you advise:

i need to re-name the base ID and the NODE id for each of the emonpi’s?

Then it should post to emoncms just fine?

the baseid = 5 will use the [[5]] configuration settings from the [nodes] section so yes they should be changed together to match.

Hi
Ive updated this now, however its updating both node 3 and node 5,

Any ideas??

Did you change to baseid =3 and node decoder [3]? Could node 5 be coming from one of the other emonpi’s you have posting to the same emoncms account?

Pleas post your entire emonhub.conf and emonhub.log if you would like us to debug further.