Update to node-red-nodes-emoncms node

Continuing the discussion from MQTT JSON Input with timetamp:

As the MQTT input currently does not support a time element, I decided to try the Emoncms Node-red node. I discovered it had not been updated to match the new input API so I have had a start at improving it. You can find the 2 relevant files here. Simply overwrite the files in your modules folder and restart Node-red service. You will need to select a ‘data type’ in the node before using it.

My test environment is a little limited so if anyone wants to try this out for me feel free.

The key difference is that you need to select a data type of either legacy (which should behave as before), JSON, fulljson or CSV.

I have also made it such that you can (optionally) supply an ISO date and it will convert that to seconds.

There is now a status output from the push node so you can see if the server reports success. As I discovered this does not mean that data has been accepted, just that the server is OK!

If this node doesn’t work, please let me have an example URI you are trying to submit and I’ll check and see what is happening.

I am confident the full (or validated) JSON input works (as I am using it). I suspect the json one will not, but it is the same construct as before. However, I need this tested.

HTH

[Edit]
I have created a fork and opened a PR. If you want to test the updated node, please do. Just overwrite the js and html files in the node folder and restart node-red.

Feedback welcome on the PR.

The changes I proposed have been merged and the node updated.

I have just created a PR to modify the emoncms-in node to return all the Feed data.

As it returns it in a different part of the message, it is a non-breaking change.

Can’t believe it is 3 years since I did the first lots of mods!

The update has been merged and published - v0.3.0. It is a non-breaking change.

  • The Topic is now the name of the Feed
  • All the data for the Feed is returned as a feed_data element of the JSON

The message returned from the Feed is in the format:

{
	"_msgid": "7c6f5707.ca0ac8",
	"payload": 1941426,
	"topic": "Pulse-Wh",
	"rc": 200,
	"feed_data": {
		"id": "77",
		"userid": "1",
		"name": "Pulse-Wh",
		"datatype": "1",
		"tag": "3",
		"public": "0",
		"size": "",
		"engine": "5",
		"processList": "",
		"unit": "Wh",
		"time": 1612803769,
		"value": 1941426
	}
}