node-red-contrib-mongoose-os-rpc 0.1.0

A node for calling functions via RPC on Mongoose OS enabled devices (ESP8266 etc.)

npm install 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 transport
  •   ws://deviceIpOrDnsName/rpc - when using WebSocket transport
  • mqtt://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).

References

Node Info

Version: 0.1.0
Updated 1 month, 1 week ago
License: MIT

Downloads

1 in the last day
11 in the last week
58 in the last month

Nodes

  • mongoose-os-rpc

Keywords

  • mongoose-os
  • rpc
  • esp8266
  • node-red

Maintainers

  • pkgeorgiev