Enabled debugging support
This commit is contained in:
parent
2475aea1c8
commit
ed0b418b4d
16
.vscode/launch.json
vendored
Normal file
16
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"preLaunchTask": "build and install",
|
||||
"program": "/Users/brandonwatson/.npm-global/bin/homebridge",
|
||||
"sourceMaps": true,
|
||||
}
|
||||
]
|
||||
}
|
17
.vscode/tasks.json
vendored
Normal file
17
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "build",
|
||||
"problemMatcher": []
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "build and install",
|
||||
"command": "npm run build&&sudo npm install -g --unsafe-perm ."
|
||||
}
|
||||
]
|
||||
}
|
@ -96,7 +96,9 @@ class HubDataProvider {
|
||||
await Promise.all(
|
||||
//Turn off devices
|
||||
devicesToTurnOff.map(async (device: IDevice) => {
|
||||
await device.powerOff();
|
||||
if (device) {
|
||||
await device.powerOff();
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
@ -124,7 +126,7 @@ class HubDataProvider {
|
||||
|
||||
//Turn on devices
|
||||
await Promise.all(devicesToTurnOn.map(async (device: IDevice) => {
|
||||
if (device && device.name && this.devices[device.name]) {
|
||||
if (device && device.name) {
|
||||
if (!device.on) {
|
||||
this.log(`Turning on device ${device.name}`)
|
||||
await device.powerOn();
|
||||
@ -479,10 +481,10 @@ class HubDataProvider {
|
||||
let powerOnCommand: string = "Power On";
|
||||
let powerToggleCommand: string = "Power Toggle";
|
||||
if (this.supportsCommand(powerOnCommand)) {
|
||||
await this.sendCommand(this.getCommand(powerOnCommand));
|
||||
await this.sendCommand(powerOnCommand);
|
||||
this.on = true;
|
||||
} else if (this.supportsCommand(powerToggleCommand)) {
|
||||
await this.sendCommand(this.getCommand(powerToggleCommand));
|
||||
await this.sendCommand(powerToggleCommand);
|
||||
this.on = true;
|
||||
}
|
||||
},
|
||||
@ -490,18 +492,16 @@ class HubDataProvider {
|
||||
let powerOffCommand: string = "Power Off";
|
||||
let powerToggleCommand: string = "Power Toggle";
|
||||
if (this.supportsCommand(powerOffCommand)) {
|
||||
await this.sendCommand(this.getCommand(powerOffCommand));
|
||||
await this.sendCommand(powerOffCommand);
|
||||
this.on = false;
|
||||
} else if (this.supportsCommand(powerToggleCommand)) {
|
||||
await this.sendCommand(this.getCommand(powerToggleCommand));
|
||||
await this.sendCommand(powerToggleCommand);
|
||||
this.on = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.log(`Device list: ${JSON.stringify(this.devices)}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
"declaration": true,
|
||||
"outDir": "./bin",
|
||||
"strict": true,
|
||||
"sourceMap": true,
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
|
Loading…
Reference in New Issue
Block a user