It’s basically just syntactic sugar at this point, but I hope to keep hacking on it and building it out further. Let me know if you have any suggestions/needs. I will likely need to make a lot of updates as I play with and integrate sensors.
Also if there are any existing node.js libraries, please link them - I was having a hard time finding existing stuff. Thanks!
I just added support for this. Right now you can use the following code to get a response for a variable. It looks like the SparkCore team is still building out the variable return data structure, so in the meantime the callback just receives the entire server response. It would be nice if we could give the function the variable as you intended from the spark core firmware though (directly in number or string format for example).
var Sparky = require('sparky')
var core1 = new Sparky({
deviceId: 'your device id',
token: 'your access token',
})
core1.get('MyCustomVariable', function(response) {
// Full response of the SparkCore API resides in the first argument
});
only one little thing … You’re using curl to create the request … I modified your version a bit. And i’m using restler to create the requests to the api.
I did this because i don’t have any curl running on my windows machine … And by using the restler node_module you’re able to do the same thing … only without using this curl library …
If you’re interested … just let me know something and I’ll send you the link …