Building A Custom Connector
These are the steps to configure your connector once you have built it with yo meshblu-connector
see: What is Yo?
Building Your Connector
- cd into the directory with your connector
- Open up the index.js file
- Edit the MESSAGE_SCHEMA and OPTIONS_SCHEMA to fit your parameters
- MESSAGE_SCHEMA defines the structure of messages that the device can understand
- OPTIONS_SCHEMA are used to set configuration properties at start time
- In the Plugin.prototype.onConfig function, enter the code that you want to be executed when the device is configured
- In the Plugin.prototype.onMessage function, define how you want your device to behave when it receives a message
Registering Your Connector
- Run
npm install -g meshblu-util
- Run
meshblu-util register -d '{"name":"YOUR_DEVICE_NAME","type":"device:YOUR_DEVICE_TYPE"}'
- Copy your JSON response and paste it into the meshblu.json file contained by your device folder
- Run
npm install
- If you have any dependancies, run
npm install --save YOUR_DEPENDANCY
- Run
npm start
Testing Your Connector
- Login to Octoblu and go to the Connect page
- Go to Add node and add a generic device
- Now go to your terminal and run
cat meshblu.json
to see your device's UUID and Token - Go back to your generic device and select the UUID from the drop down
- If your UUID is not showing up, select "Claim Existing"
- Enter your UUID and Token, name your device, and click add
- Go to the connect page, drop the device into your flow, and you're done!
Example Connector
Updated less than a minute ago