{"_id":"5600a4971503430d007cc97d","githubsync":"","__v":2,"category":{"_id":"56009c581503430d007cc955","__v":41,"project":"56009c541503430d007cc951","version":"56009c571503430d007cc954","pages":["56009c591503430d007cc957","56009c7f0c703d19009531c6","56009c911503430d007cc958","56009c9c1503430d007cc95a","56009ca697f69f1700f21a55","56009cb81503430d007cc95c","56009cc80c703d19009531c8","56009ce18c0c9d0d00dcaef8","56009cf21503430d007cc95e","56009cfe81a9670d006d146a","56009d0781a9670d006d146c","56009d1d81a9670d006d146e","56009d271503430d007cc960","56009d581503430d007cc962","56009d651503430d007cc964","56009d711503430d007cc966","56009d8d81a9670d006d1472","56009d970c703d19009531ce","56009da197f69f1700f21a5a","56009dae3aa0520d00da0bff","56009db83aa0520d00da0c01","56009dcf81a9670d006d1474","56009ddb3aa0520d00da0c04","56009de597f69f1700f21a5d","56009df80c703d19009531d0","56009e0d8c0c9d0d00dcaefa","56009e213aa0520d00da0c08","56009e2c81a9670d006d1476","5600a4971503430d007cc97d","561c5a6b01e1c417001f54f1","561d9845d712bc0d00777b72","563cfe55d8f2d20d00448d14","563d09d9913e650d00b65f92","566b3b8614c22f1900f00b7b","568ff8529ebef90d00872887","568ff8ed4719c119002ce637","5690922a208b910d00ed77b4","56a93fd311d0390d00a3d29a","56b25cc8a5a1020d00cf4cc3","56b25f02147e900d00d64990","56b291ed4e71701700232ea4"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-22T00:10:00.324Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"project":"56009c541503430d007cc951","version":{"_id":"56009c571503430d007cc954","__v":1,"project":"56009c541503430d007cc951","createdAt":"2015-09-22T00:09:59.421Z","releaseDate":"2015-09-22T00:09:59.421Z","categories":["56009c581503430d007cc955"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"5564f227f0f70f0d00a9ab20","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-22T00:45:11.304Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"These are the steps to configure your connector once you have built it with `yo meshblu-connector` see: [What is Yo?](https://github.com/octoblu/generator-meshblu-connector)\n\n### Building Your Connector\n* cd into the directory with your connector\n* Open up the index.js file\n* Edit the MESSAGE_SCHEMA and OPTIONS_SCHEMA to fit your parameters\n* MESSAGE_SCHEMA defines the structure of messages that the device can understand\n* OPTIONS_SCHEMA are used to set configuration properties at start time\n* In the Plugin.prototype.onConfig function, enter the code that you want to be executed when the device is configured\n* In the Plugin.prototype.onMessage function, define how you want your device to behave when it receives a message\n\n### Registering Your Connector\n* Run `npm install -g meshblu-util`\n* Run `meshblu-util register -d '{\"name\":\"YOUR_DEVICE_NAME\",\"type\":\"device:YOUR_DEVICE_TYPE\"}'`\n* Copy your JSON response and paste it into the meshblu.json file contained by your device folder\n* Run `npm install`\n* If you have any dependancies, run `npm install --save YOUR_DEPENDANCY`\n* Run `npm start`\n\n### Testing Your Connector\n* Login to Octoblu and go to the Connect page\n* Go to Add node and add a generic device\n* Now go to your terminal and run `cat meshblu.json` to see your device's UUID and Token\n* Go back to your generic device and select the UUID from the drop down\n* If your UUID is not showing up, select \"Claim Existing\"\n* Enter your UUID and Token, name your device, and click add\n* Go to the connect page, drop the device into your flow, and you're done!\n\n### Example Connector\n[Giphy GIF Getter](https://github.com/octoblu/gif-blu/blob/master/index.js)","excerpt":"","slug":"building-a-custom-connector","type":"basic","title":"Building A Custom Connector"}

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?](https://github.com/octoblu/generator-meshblu-connector) ### 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 [Giphy GIF Getter](https://github.com/octoblu/gif-blu/blob/master/index.js)