node-red-contrib-mongoose-os-rpc

0.1.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    1

Package Sidebar

Install

npm i node-red-contrib-mongoose-os-rpc

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • pkgeorgiev