Skip to content

Commit

Permalink
Add advance setting for detecting device state, issue #103
Browse files Browse the repository at this point in the history
  • Loading branch information
dwaan committed Jan 28, 2024
1 parent a381859 commit 5a56cb1
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 6 deletions.
31 changes: 31 additions & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,16 @@
"type": "string",
"title": "Volume Down",
"placeholder": "eg: KEYCODE_VOLUME_DOWN"
},
"stateAdbCommand": {
"type": "string",
"title": "State Command",
"placeholder": "eg: dumpsys power | grep mHoldingDisplaySuspendBlocker="
},
"stateAdbOutputAwake": {
"type": "string",
"title": "State Command Output",
"placeholder": "eg: true (case sensitive)"
}
}
}
Expand Down Expand Up @@ -887,6 +897,27 @@
]
}
]
},
{
"title": "Advance Settings",
"expandable": true,
"expanded": false,
"description": "More advance settings. Leave it blank if you don't know what is this.",
"items": [
{
"type": "flex",
"displayFlex": true,
"flex-direction": "column",
"items": [
{
"key": "accessories[].stateAdbCommand"
},
{
"key": "accessories[].stateAdbOutputAwake"
}
]
}
]
}
]
}
Expand Down
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,19 @@ class ADBPlugin {
this.enablePlaybackSensor = this.config.playbacksensor || NO;
this.playbackSensorDelayOff = this.config.playbacksensordelay || 10000;
this.playbackSensorExclude = this.config.playbacksensorexclude || "";
// State detection
this.stateAdbCommand = this.config.stateAdbCommand;
this.stateAdbOutputAwake = this.config.stateAdbOutputAwake;
// Power
this.powerOnChange = NO;
this.wolLoop = EMPTY;
this.retryPowerOn = this.retrypoweron || 10;
// App
this.currentAppID = HOME_APP_ID;

console.log(this.stateAdbCommand);
console.log(this.stateAdbOutputAwake);

// Accessory status
this.adb = new adb(this.ip, {
path: this.path,
Expand All @@ -85,6 +91,8 @@ class ADBPlugin {
retryPowerOn: this.retryPowerOn,
keycodePowerOn: this.config.poweron,
keycodePowerOff: this.config.poweroff,
stateAdbCommand: this.stateAdbCommand,
stateAdbOutputAwake: this.stateAdbOutputAwake
});

/**
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "homebridge-adb",
"version": "2.2.6",
"version": "2.2.7",
"description": "A HomeBridge plugin to control ADB enabled Android devices",
"main": "index.js",
"engines": {
"node": ">=14.0.0",
"homebridge": ">=1.1.0"
"node": ">=18.0.0",
"homebridge": ">=1.5.0"
},
"scripts": {
"test": "npm link && nodemon"
Expand All @@ -28,12 +28,12 @@
},
"homepage": "https://github.com/dwaan/homebridge-adb#readme",
"dependencies": {
"nodejs-adb-wrapper": "1.3.8",
"nodejs-adb-wrapper": "1.3.9",
"wake_on_lan": "1.0.0"
},
"devDependencies": {
"homebridge": "^1.3.9",
"nodemon": "^3.0.1"
"homebridge": "^1.5.0",
"nodemon": "^3.0.3"
},
"funding": [
{
Expand Down

0 comments on commit 5a56cb1

Please sign in to comment.