isobarot-edge-gateway
v1.0.0
Published
A library that serves as a hub for collecting data and statuses from devices and sending it to the isobarot cloud over HTTP or MQTT.
Downloads
2
Maintainers
Readme
isobarot-edge-gateway
- Client library for sending data to isobarot cloud over HTTP or MQTT.
Getting Started
npm install --save isobarot-edge-gateway
HTTP Example - Local
const { EdgeGateway } = require("isobarot-edge-gateway");
const gateway = new EdgeGateway({
type: "local",
configurationApiUrl: "https://api.isobarot.com/path-to-config",
configurationMqttBrokerUrl: "api.isobarot.com",
configurationMqttTopic: "config",
isobarCloudSenderParams: {
url: "api.isobarot.com",
},
});
gateway.init();
gateway.setValue("<sensor-id or custom-topic>", {
apiToken: "<token>",
record: {
// ...
},
});
// on application close
gateway.dispose();
MQTT Example - Local
const { EdgeGateway } = require("isobarot-edge-gateway");
const gateway = new EdgeGateway({
type: "local",
configurationApiUrl: "https://api.isobarot.com/path-to-config",
configurationMqttBrokerUrl: "api.isobarot.com",
configurationMqttTopic: "config",
isobarCloudSenderParams: {
url: "api.isobarot.com",
type: "mqtt"
},
});
gateway.init();
gateway.setValue("<sensor-id or custom-topic>", {
apiToken: "<token>",
record: {
// ...
},
});
// on application close
gateway.dispose();
MQTT Example - Hub - To be implemented
const { EdgeGateway } = require("isobarot-edge-gateway");
const gateway = new EdgeGateway({
type: "hub",
hubPort: 1883,
configurationApiUrl: "https://api.isobarot.com/path-to-config",
configurationMqttBrokerUrl: "api.isobarot.com",
configurationMqttTopic: "config",
isobarCloudSenderParams: {
url: "api.isobarot.com",
type: "mqtt"
},
});
gateway.init();
/*
Hub is listening on 0.0.0.0:1883
Publish to <topic> { apiToken: <token>, record: { ... } }
*/
// on application close
gateway.dispose();