node-red-contrib-mongoose-os-rpc 0.1.0
A node for calling functions via RPC on Mongoose OS enabled devices (ESP8266 etc.)
node-red-contrib-mongoose-os-rpc
A node for calling functions via RPC on Mongoose OS enabled devices (ESP8266 etc.) in NodeRED
Overview
This node connects to a Mongoose OS enabled device, executes given function by its name (optionally passing arguments) then returns function's result (asynchronously).
The address
property has the following format depending of the transport being used:
http://deviceIpOrDnsName/rpc
- when using HTTP transportws://deviceIpOrDnsName/rpc
- when using WebSocket transportmqtt://deviceIpOrDnsName/device_id
- when using MQTT transport
The function can be specified dynamically via input message where topic
is function's name and payload
contains the arguments (JSON string or JSON object).
Error handling
To handle RPC related errors (timeouts, unsupported commands etc.) you need to put a Catch node in your flow. The payload
of the Catch node will contain error's object:
{code: xyz, message: "specific error message"}
The code
property maps to standard http error codes.
All transport errors are reported via node.error and will be recorded in NodeRED's log (i.e. they will not reach any Catch node).