ninjablocks / client Goto Github PK
View Code? Open in Web Editor NEWNode.js code that interfaces devices with the Ninja platform
License: MIT License
Node.js code that interfaces devices with the Ninja platform
License: MIT License
On the production client, it has been necessary to convert incoming data to JSON for handling inside the .write function. eg
Device.prototype.write = function (data) {
var self = this;
data = JSON.parse(data);
// I'm being actuated with data!
However, this generates an error on the new enterprise client, given that "data" is already an object.
My work around to make the driver valid on both platforms is:
Device.prototype.write = function (data) {
var self = this;
if (Object.prototype.toString.call(data) != "[object Object]") { data = JSON.parse(data); }
// I'm being actuated with data!
Issue seems to be from the refactor and ninja.devices no longer being a thing?
2014-04-16 03:14:54.466] [INFO] NB rest - REST POST /rest/v0/device/DEVICEHUB_zigbee78A051000047901A1_0_238
[2014-04-16 03:14:54.480] [ERROR] console - TypeError: Cannot read property 'DEVICEHUB_zigbee78A051000047901A1_0_238' of undefined
at exports.actuate (/opt/ninjablocks/client/drivers/rest/routes/index.js:20:33)
at callbacks (/opt/ninjablocks/client/drivers/rest/node_modules/express/lib/router/index.js:160:37)
at param (/opt/ninjablocks/client/drivers/rest/node_modules/express/lib/router/index.js:134:11)
at param (/opt/ninjablocks/client/drivers/rest/node_modules/express/lib/router/index.js:131:11)
at pass (/opt/ninjablocks/client/drivers/rest/node_modules/express/lib/router/index.js:141:5)
at Router._dispatch (/opt/ninjablocks/client/drivers/rest/node_modules/express/lib/router/index.js:169:5)
at Object.router (/opt/ninjablocks/client/drivers/rest/node_modules/express/lib/router/index.js:32:10)
at next (/opt/ninjablocks/client/drivers/rest/node_modules/express/node_modules/connect/lib/proto.js:190:15)
at Object.exports.allowCORS [as handle] (/opt/ninjablocks/client/drivers/rest/lib/helpers.js:34:5)
at next (/opt/ninjablocks/client/drivers/rest/node_modules/express/node_modules/connect/lib/proto.js:190:15)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.