Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
add path to login
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandawg93 committed Jul 28, 2020
1 parent 58e6526 commit 101cbef
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ Google Accounts are configured using the `"googleAuth"` object in `config.json`,
}
```

**Note:** If the steps below do not work, refer to the [manual authentication method](https://github.com/Brandawg93/homebridge-nest-cam/wiki/Manual-Authentication). You may need to reauthenticate periodically due to your Google account settings.

1. If the plugin is installed globally, run `homebridge-nest-cam login`, otherwise, *ensure that you are in the plugin's root directory* and run `node dist/login.js`. If your account has 2 factor authentication, use the `-h` flag.
1. If the plugin is installed globally, run `homebridge-nest-cam login`, otherwise, *ensure that you are in the plugin's root directory* and run `node dist/login.js`.
2. Login to your Nest account.
3. Copy the output to your `config.json`.

**Notes:**
- If the steps above do not work, refer to the [manual authentication method](https://github.com/Brandawg93/homebridge-nest-cam/wiki/Manual-Authentication).
- You may need to reauthenticate periodically due to your Google account settings.
- If your account has 2 factor authentication, use the `-h` flag.
- If you are unable to open the chromium browser, install it manually and specify its path via the `-p` flag.

#### options
Extra options can be enabled/disabled depending on which switches and sensors you would like to see in the Home app. Here is the current list of available options:

Expand Down
17 changes: 1 addition & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"displayName": "Homebridge Nest Cam",
"name": "homebridge-nest-cam",
"version": "4.0.0-test.3",
"version": "4.0.0-test.4",
"description": "Nest cam plugin for homebridge: https://homebridge.io/",
"main": "dist/index.js",
"license": "GPL-3.0",
Expand Down
14 changes: 13 additions & 1 deletion src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ export async function login(email?: string, password?: string): Promise<void> {
puppeteer.use(pluginStealth());

const headless = !process.argv.includes('-h');
const path = (): string => {
if (process.argv.includes('-p')) {
const index = process.argv.indexOf('-p');
return process.argv[index + 1];
}
return '';
};
const prompt = (query: string, hidden = false): Promise<string> =>
new Promise((resolve, reject) => {
const rl = readline.createInterface({
Expand Down Expand Up @@ -47,7 +54,12 @@ export async function login(email?: string, password?: string): Promise<void> {
});

try {
const browser = await puppeteer.launch({ headless: headless });
const options: any = { headless: headless };
const executablePath = path();
if (executablePath) {
options.executablePath = path();
}
const browser = await puppeteer.launch(options);
console.log('Opening chromium browser...');
const page = await browser.newPage();
const pages = await browser.pages();
Expand Down
3 changes: 2 additions & 1 deletion src/nest-cam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class NestCam extends EventEmitter {
}
}

async getFaces(): Promise<any> {
async getFaces(): Promise<Array<any>> {
try {
if (!this.accessory.context.removed) {
const response = await this.endpoints.sendRequest(
Expand All @@ -237,5 +237,6 @@ export class NestCam extends EventEmitter {
} catch (error) {
handleError(this.log, error, 'Error getting faces');
}
return [];
}
}

0 comments on commit 101cbef

Please sign in to comment.