Skip to content

Instantly share code, notes, and snippets.

@timfpark
Created September 25, 2014 20:44
Show Gist options
  • Save timfpark/18c64577451eb414e22d to your computer and use it in GitHub Desktop.
Save timfpark/18c64577451eb414e22d to your computer and use it in GitHub Desktop.
// provisioning
var device = new nitrogen.Device({
name: deviceAllJoynId,
nickname: deviceAllJoynId
});
service.connect(device, function(err, session, device) {
// listen for AllJoyn state changes and send up a state message
var msg = new nitrogen.Message({
tags: [ nitrogen.CommandManager.commandTag(this.id) ],
type: '_heatworksState',
body: {
current_limit: this.current_limit,
current_temp: 100.0 + Math.random() * 25, // 40-160F
current_current_draw: 25.0 + Math.random() * 5, // 0-50A
set_point: this.set_point,
total_run_time: 1000, // Seconds running (32bit long)
total_current_used: 1000.0 // Total Amps
}
});
msg.send(session);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment