Skip to content

Instantly share code, notes, and snippets.

@tobie
Last active October 29, 2015 03:08
Show Gist options
  • Save tobie/4e438781ebf8d7980af9 to your computer and use it in GitHub Desktop.
Save tobie/4e438781ebf8d7980af9 to your computer and use it in GitHub Desktop.
//client side, thing is a remote lightbulb
var lightbulb = new Lightbulb();
lightbulb.onchange = e => {
console.log("Ligthbulb " + e.src + " changed state at " + e.time + " to " + e.dim);
};
lightbulb.requestData()
.then(function(data) {
console.log("current power consumption is " + data.power + " Watts");
})
.catch(function(err) {
console.err(err),
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment