node-red-contrib-octocore v0.0.12
node-red-contrib-octocore
A Node-RED module to communicate with the OctoCore platform from Octotronic.
Overview
This Node-RED module provides nodes to publish and subscribe to messages on the OctoCore platform using NATS. It includes the following nodes:
uns-publish
: Publish messages to the OctoCore platform.uns-subscribe
: Subscribe to messages from the OctoCore platform.uns-request
: Send requests to the OctoCore platform and receive responses.nats-server
: Configure the NATS server connection.
Installation
To install the module, run the following command in your Node-RED user directory (typically ~/.node-red
):
npm install node-red-contrib-octocore
Nodes
NATS Server Configuration
nats-server
This node is used to configure the connection to the NATS server.
- Server: The URL of the NATS server.
- User: The username for the NATS server.
- Password: The password for the NATS server.
Publish Node
uns-publish
This node is used to publish messages to the OctoCore platform.
- Name: The name of the node.
- Server: The NATS server configuration to use.
- Dataformat: The format of the data to publish (
UNS Value
,Reply
,RAW Value
,Specific Topic
,Use msg.topic
). - Datapoint / Subject: The datapoint or subject to publish to.
The payload of the message to publish can be set via the msg.payload
property.
Subscribe Node
uns-subscribe
This node is used to subscribe to messages from the OctoCore platform.
- Name: The name of the node.
- Server: The NATS server configuration to use.
- Dataformat: The format of the data to subscribe to (
UNS Value
,RAW Value
,Specific Subject
). - Datapoint / Subject: The datapoint or subject to subscribe to.
The received message will be available in the msg.payload
property.
Request Node
uns-request
This node is used to send requests to the OctoCore platform and receive responses.
- Name: The name of the node.
- Server: The NATS server configuration to use.
- Subject: The subject to send the request to.
The payload of the request can be set via the msg.payload
property. The response will be available in the msg.payload
property.
Example Flow
Here is an example flow that demonstrates how to use the uns-publish
, uns-subscribe
, and uns-request
nodes:
[
{
"id": "nats-server-config",
"type": "nats-server",
"z": "",
"name": "NATS Server",
"server": "nats://localhost:4222",
"user": "username",
"pass": "password"
},
{
"id": "publish-node",
"type": "uns-publish",
"z": "",
"name": "Publish to OctoCore",
"server": "nats-server-config",
"dataformat": "uns_value",
"datapointid": "example.datapoint",
"wires": []
},
{
"id": "subscribe-node",
"type": "uns-subscribe",
"z": "",
"name": "Subscribe from OctoCore",
"server": "nats-server-config",
"dataformat": "uns_value",
"datapointid": "example.datapoint",
"wires": [["debug-node"]]
},
{
"id": "request-node",
"type": "uns-request",
"z": "",
"name": "Request from OctoCore",
"server": "nats-server-config",
"subject": "example.subject",
"wires": [["debug-node"]]
},
{
"id": "debug-node",
"type": "debug",
"z": "",
"name": "Debug",
"active": true,
"console": "false",
"complete": "false",
"x": 500,
"y": 300,
"wires": []
}
]
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Links
www.octotronic.com