Skip to content

Commit

Permalink
nissanEV adjust connect Msg
Browse files Browse the repository at this point in the history
  • Loading branch information
bolliy committed Jul 7, 2024
1 parent efcaf77 commit 821b4ac
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 125 deletions.
9 changes: 4 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Nissan extends utils.Adapter {
}
}

async loginEV() {
async loginEV(connectMsg = false) {
try {
this.nissanEvClient = await leafConnect({
username: this.config.user,
Expand All @@ -125,10 +125,9 @@ class Nissan extends utils.Adapter {
// pollingInterval: 30000, // in seconds
});
this.isInLogin = true;
if (connectMsg) this.log.info('Connected to Nissan EV');
if (!this.isReady) {
this.log.info('Connected to Nissan EV');
await this.getNissanEvVehicles();

}
} catch(error) {
this.isInLogin = false;
Expand All @@ -151,7 +150,7 @@ class Nissan extends utils.Adapter {
} else {
this.log.warn('Response Error status '+status+'. Start Relogin');
}
await this.loginEV();
await this.loginEV(status !== 401);
}
}
//bolliy ++
Expand All @@ -160,7 +159,7 @@ class Nissan extends utils.Adapter {
async updateNissanEv() {
try {
if (!this.nissanEvClient || !this.isInLogin) {
await this.loginEV();
await this.loginEV(true);
}

if (!this.nissanEvClient) return;
Expand Down
182 changes: 66 additions & 116 deletions package-lock.json

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

Loading

0 comments on commit 821b4ac

Please sign in to comment.