Print scannable setup code to terminal on startup

This commit is contained in:
Devran Ünal
2015-09-17 17:00:52 +02:00
parent 72b9175b78
commit 2135e7eccb

12
app.js
View File

@@ -191,6 +191,16 @@ function createAccessory(accessoryInstance, displayName) {
}
}
// Returns the setup code in a scannable format.
function printPin(pin) {
console.log("Scan this code with your HomeKit App on your iOS device:");
console.log("\x1b[30;47m%s\x1b[0m", " ");
console.log("\x1b[30;47m%s\x1b[0m", " ┌────────────┐ ");
console.log("\x1b[30;47m%s\x1b[0m", " │ " + pin + " │ ");
console.log("\x1b[30;47m%s\x1b[0m", " └────────────┘ ");
console.log("\x1b[30;47m%s\x1b[0m", " ");
}
// Returns a logging function that prepends messages with the given name in [brackets].
function createLog(name) {
return function(message) {
@@ -210,3 +220,5 @@ function publish() {
}
startup();
printPin(bridgeConfig.pin);