node-red-contrib-makdev-iot
v0.1.0
Published
Node-RED nodes for querying your own IoT data from the MakDev IoT Platform Agent API
Readme
node-red-contrib-makdev-iot
Node-RED nodes for pulling your own IoT sensor data out of the MakDev IoT Platform (makdev.net) without hand-building HTTP Request nodes.
Wraps the platform's Agent HTTP API (GET /api/agent/devices|fields|data/latest|data/range), which is only usable by registered mqtt_xxx accounts and always scoped to your own data.
Nodes
- makdev-iot-config - config node holding your Base URL and Agent Key. The Agent Key is stored encrypted by Node-RED's own credential store, never in the exported flow JSON.
- makdev-iot - queries your data. One node, four actions selectable from a dropdown:
devices- list devices that have reported datafields- list the fields currently present for a device (fields vary per device/user - there's no fixed list)latest- most recent reading for a device (optionally a single field)range- historical readings for a device over a time range (optionally a single field)
Getting an Agent Key
- Log in to your MakDev account and call
POST /api/agent-keywith your normal login token. - The response contains
api_key- copy it now, it is shown only once. - Paste it into the
makdev-iot-confignode's "Agent Key" field and click "Test connection".
If you ever lose the key, calling POST /api/agent-key again issues a new one and revokes the old one (only one key is active per account at a time).
Example flow
[inject] -> [makdev-iot: devices] -> [debug]Then, once you know a device name:
[inject] -> [makdev-iot: fields, device=myDevice] -> [debug]
[inject] -> [makdev-iot: latest, device=myDevice] -> [debug]
[inject] -> [makdev-iot: range, device=myDevice, start=-24h] -> [debug]device and field can be set to a fixed string or pulled from msg.*/flow/global context, so you can drive them dynamically from an upstream node.
Output
devices/fields:msg.payloadis an array of strings.latest/range:msg.payloadis an array of{ time, field, value }objects.msg.makdevis always set to{ action, device, field }describing the request that was made.
Error handling
Failures (invalid device/field format, expired or revoked key, deactivated account) surface as a Node-RED error (catchable with a catch node) and are shown on the node's status with the HTTP status code, e.g. 401 Agent API key expired or revoked.
Not included
- This package does not publish itself to npm - that's a separate, one-way decision left to whoever maintains this repo.
- No MQTT node - use Node-RED's built-in
mqtt in/mqtt outnodes againstmqtt.makdev.netdirectly. - No rate limiting on the client side - the Agent API is currently free/unmetered; if the platform later adds quotas, errors will simply surface with whatever status/message the server returns.
