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/README.md
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

49 lines
1.5 KiB
Markdown

node-red-node-emoncms
=====================
A <a href="http://nodered.org" target="_new">Node-RED</a> node to send fetch/post data to/from <a href="http://emoncms.org" target="_new">emoncms.org</a>, 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.