Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mydevicesiot/cayennejs
Cayenne API for Node.JS
https://github.com/mydevicesiot/cayennejs
arduino esp8266 iot lorawan mqtt nodemcu raspberrypi
Last synced: 2 months ago
JSON representation
Cayenne API for Node.JS
- Host: GitHub
- URL: https://github.com/mydevicesiot/cayennejs
- Owner: myDevicesIoT
- Created: 2016-11-21T04:32:36.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-27T19:30:57.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T15:03:43.623Z (2 months ago)
- Topics: arduino, esp8266, iot, lorawan, mqtt, nodemcu, raspberrypi
- Language: JavaScript
- Homepage: https://mydevices.com/cayenne
- Size: 69.3 KB
- Stars: 12
- Watchers: 9
- Forks: 12
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cayenne IoT Node.JS API
Use this library to quickly connect your device to Cayenne Cloud. For more information see our [API Documentation](http://www.cayenne-mydevices.com/docs/#bring-your-own-thing-api-mqtt-messaging-topics)
```
npm install cayennejs
``````javascript
var Cayenne = require('cayennejs');// Initiate MQTT API
const cayenneClient = new Cayenne.MQTT({
username: "foobar",
password: "secret",
clientId: "thing-id"
});cayenneClient.connect((err, mqttClient) => {
// dashboard widget automatically detects datatype & unit
cayenneClient.kelvinWrite(3, 65);// sending raw values without datatypes
cayenneClient.rawWrite(4, 123);// subscribe to data channel for actions (actuators)
cayenneClient.on("cmd9", function(data) {
console.log(data);
});});
```