Weather data into Emoncms via Node-Red

Hi all,

So I’ve successfully setup Node-red so that I can input weather data from my Ecowitt personal weather station into my local Emoncms system (Ubuntu)

The only issue is that I’m having to load into separate input nodes as when I try to load them into one node to keep them together only one of them gets uploaded to Emoncms.

Is there a way to upload them all into one named node ?

Thanks for any assistance…



That’s how I do it.

No idea about NodeRED but I see you are putting data into WeatherUnderground? Another way… I have a Bressar weather station that goes to Wunderground this (I cant directly connect to it - well not without a load of reverse engineering I don’t have time for)

I just use a few lines of Python code to query the WeatherUnderground API download and save the data (so I have my own copy of MY data) and then make a http get call to emonPI

Getting the data:
= ‘**station_id**&format=json&units=m&apiKey=**api_key**&numericPrecision=decimal

Putting into the emonPI:

It just runs as a cron job on my home PI server ever 10 mins. Writing the code might not be your thing, but if you want to try just say and I can share

Hi Carl,

That’s a clever way of getting the data in. Unfortunately I fear that I haven’t made my issue very clear, so I’ll ty to show some screen shots to explain.

I’m not having any issues getting the data from my weather site (Ecowitt) - I then run it through some converters (the data is all in imperial and I need to convert some of it to metric etc). The issues is that I want all the data collected to go into the one input node, but alas I haven’t figured out how to do that. Hence I am importing the data into Emoncms into multiple input nodes as per my screen shots. I hope that explains it better.

The data is getting into Emoncms ok, and I can use it fine, but it’s pretty untidy in the Input screen.

It is a log time since I used the emoncms flow in NodeRed - I send everything via MQTT.

Personally, I’d split the input do what was needed and then build a JSON object to send it in one go to emoncms via MQTT in the form

{"Item1":100,"item2":200,"time": UNIXTIME}

Note Javascript generates time in milliseconds and emoncms wants seconds.

Even using the push node, I’d construct a single JSON string as it is more efficient.

However, what does the configuration of each emoncms push node look like (show 2 different ones)?

1 Like

Hi Brian,

Thanks for your reply - I’ve played with MQTT / Node-red without success in the past, I can get a connection and can confirm it is being sent but I can’t find the data anywhere. Obviously a rookie mistake somewhere along the line.

I’m going to just accept the current setup for what it is - all my feeds are running fine, despite the input page looking a bit messy, but whilst it’s woking I’ll leave it as is.

Thanks for your input.


Did you connect to the MQTT Broker on the Pi (using the username and password) and then use the base topic emon/?

I’m sure it can be sorted, I did ask…

What setting have you got in the EmonCMS push node? They absolutely can go into the same input node.
From memory you have to set the title as the input within the node and use the legacy mode.


So I’ve followed the above as best I can, but the input names are all ‘1’ - they populate x 3 the first time the functions are run, but after that only one of them updates. How do I change the output title from ‘1’ to either text or alternate numbers to ‘1’ ?

Hi Pete,
The help info for the node you are using (the book button in the top right of your node red editor) indicates the node needs to be fed name value pairs by the preceding function node.

The name should then appear in the node input list.

As @Vster indicated above, and this is the way I do it, you can use the mqtt out node to achieve the same outcome, where the mqtt topic is of the form emon/[node_name]/[input_name] and a simple value is in msg.payload.

I’ve previously tried mqtt to no avail, it’s showing as connected but nothing appears in the emoncms inputs.

Is there anything further that I have to change within emoncms to ensure mqtt is active? I’m running Ubuntu in a VirtualBox.

Checking via command line:

mosquitto_sub -v -u 'emonpi' -P 'emonpimqtt2016' -t 'emon/#'

shows that data is being correctly received but I can’t see the data anywhere in emoncms

I feel that I’ve missed something very simple in the setup…

Pete, Looking for something simple - have you set up the mqtt-broker configuration node in node-red to point to the emoncms mqtt broker?
My mqtt nodes look like this. Note that the node name in the topic is not the node number.

The mqtt-broker setup looks like this, with the mqtt username as password as you have been using in the security tab:

I note you appear to have run that command on your VirtualBox and you do not specify a host, so it will assume localhost.

I suspect you have 2 Brokers running, one on the VB and one on the EmonPi.

In Node Red you need to connect to the EmonPi Broker.


@Jaddache Only correct if NodeRed is installed on the EmonPi, which I suspect it isn’t in this case.

It is much better to build a JSON String and send it as a single publish command. Too many messages to EmonCMS will cause it to drop some as the Input Script cannot keep up.

Thanks for your replies gents.

Node-red is on the same ubuntu server as the emon system -

I’ve tried IP address and local host - same result. Like I posted earlier, the result of -

mosquitto_sub -v -u ‘emonpi’ -P ‘emonpimqtt2016’ -t ‘emon/#’

shows data being received by mqtt (at least that’s how I read it) - it’s just not appearing inside Emoncms.

Ok so your Emoncms setting need to be updated.

How did you install the setup?

Post the [MQTT] sections from the files


Do NOT edit the default-settings.ini but ADD the additional elements to the settings.ini file.

Note, you mat not have setup the user/password on your MQTT Broker on that server (depending how you installed it).

Personally I have Mosquito, Node-RED and Emoncms in separate containers not on one VM system.

Arrrh Brian, you are a legend, thank you for persevering with me on this topic.

I had previously checked the settings.ini file and had seen that it showed:

enabled = true
user = ‘emonpi’
password = ‘emonpimqtt2016’

Which to me indicated it was set up and should have been ok. I have updated the settings.ini file now to:

enabled = true
user = ‘emonpi’
password = ‘emonpimqtt2016’
host = ‘localhost’
port = 1883
basetopic = ‘emon’
client_id = ‘pete’
userid = 2
multiuser = false

Because everything else was working fine I presumed that all the default settings were ok. All is good now and I can keep working on the project, thanks again.