1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/io/emoncms
borpin dbea8a484a Updates to match API changes (#392)
* Updates to match API changes

Update to the node to match the server API changes. An attempt has been made to leave a legacy path for existing installations that may have not updated the server side.

* Updated following comments.

Update following comments.

Output removed and node.warn or error used.

oneeditprepare added.

Name moved to last item.

In addition, a check added to ensure nodegroup has valid value.

Question: I have added a 'return' as I do not want data posted if there is not a valid nodegroup.  Is this the best way to exit the function?  Always taught that multiple exits was a bad idea.  I wondered about raising an error / exception and then catching it but not sure how to do that.

* Update documentation for revised node
2018-01-07 15:37:28 +00:00
..
icons Tweak emoncms logo to closer match other styles 2014-02-14 20:45:59 +00:00
88-emoncms.html Updates to match API changes (#392) 2018-01-07 15:37:28 +00:00
88-emoncms.js Updates to match API changes (#392) 2018-01-07 15:37:28 +00:00
LICENSE Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
package.json bump emoncms version for nom 2017-11-18 23:34:39 +00:00
README.md Updates to match API changes (#392) 2018-01-07 15:37:28 +00:00

node-red-node-emoncms

A Node-RED node to send fetch/post data to/from emoncms.org, local emoncms server or any other emoncms server.

Install

Run the following command in your Node-RED user directory - typically ~/.node-red

    npm install node-red-node-emoncms

Usage

Emoncms post:

Preferred Data Type

The API now accepts a validated JSON object for the name value pairs. This is the preferred data type.

Legacy Data Type Support

The original input API for emoncms used a URI in the format post.json?. If the data type of legacy is selected, the msg.payload can contain:

A comma separated list of name value pairs, e.g.

name:value,...

A comma separated list of values (CSV), e.g.

1,2,..

A simple javascript object (note no quotes) e.g.

{temp:12, humidity:56};

Node

If Node is left blank msg.nodegroup will be used (if set). A Node must be set or the flow will fail.

msg.time

Insertion time can be manipulated by setting msg.time. This can be an ISO format date/time or a number of seconds in epoch format - i.e. seconds since 1970. If no time is set time now is set by emoncms.

Status

The flow will indicate if the node has successfully called the API. This is not a guarantee the data has been inserted to emoncms.

Emoncms In:

Fetches last emoncms feed value, returns a numerical value.