Created
September 25, 2014 20:44
-
-
Save timfpark/18c64577451eb414e22d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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