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

Commit

Permalink
Merge pull request #512 from tronikos/master
Browse files Browse the repository at this point in the history
Fix Nest Auth to work with FT accounts
  • Loading branch information
Brandawg93 authored Sep 24, 2022
2 parents d757748 + 9df0531 commit 1e7d04a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ class NestCamPlatform implements DynamicPlatformPlugin {

return await old_auth(issueToken, cookies, apiKey, this.log);
} else if (nest_token) {
return await nest_auth(nest_token, this.log);
return await nest_auth(nest_token, this.log, ft);
} else {
this.log.error(
'You must provide a refreshToken or googleAuth object in config.json. Please see README.md for instructions',
Expand Down
6 changes: 3 additions & 3 deletions src/nest/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ export async function old_auth(issueToken: string, cookies: string, apiKey?: str
/**
* Attempt to authenticate using unmigrated Nest account
*/
export async function nest_auth(nest_token: string, log?: Logging, ft = false): Promise<string> {
const referer = ft ? 'https://home.nest.ft.com' : 'https://home.nest.com';
export async function nest_auth(nest_token: string, log?: Logging, ft): Promise<string> {
const referer = ft ? 'https://home.ft.nest.com' : 'https://home.nest.com';
let req: AxiosRequestConfig;

log?.debug('Authenticating via pre-defined nest_token');
Expand Down Expand Up @@ -252,7 +252,7 @@ export async function nest_auth(nest_token: string, log?: Logging, ft = false):
if (['ECONNREFUSED', 'ESOCKETTIMEDOUT', 'ECONNABORTED', 'ENOTFOUND', 'ENETUNREACH'].includes(error.code)) {
log?.error('Retrying in ' + API_AUTH_FAIL_RETRY_DELAY_SECONDS + ' second(s).');
await delay(API_AUTH_FAIL_RETRY_DELAY_SECONDS * 1000);
return await nest_auth(nest_token, log);
return await nest_auth(nest_token, log, ft);
} else {
return '';
}
Expand Down

0 comments on commit 1e7d04a

Please sign in to comment.