mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
Print scannable setup code to terminal on startup
This commit is contained in:
12
app.js
12
app.js
@@ -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].
|
// Returns a logging function that prepends messages with the given name in [brackets].
|
||||||
function createLog(name) {
|
function createLog(name) {
|
||||||
return function(message) {
|
return function(message) {
|
||||||
@@ -210,3 +220,5 @@ function publish() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startup();
|
startup();
|
||||||
|
|
||||||
|
printPin(bridgeConfig.pin);
|
||||||
|
|||||||
Reference in New Issue
Block a user