Skip to content

Commit

Permalink
fix typeerror
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucky-ESA committed May 21, 2024
1 parent 7de6018 commit 63e5a9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Adapter for LG ThinQ
### **WORK IN PROGRESS**

- (Lucky-ESA) Fixed Mqtt wakeup for device 406 only
- (Lucky-ESA) Fixed TypeError

### 1.0.0 (2024-05-20)

Expand Down
4 changes: 2 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ class LgThinq extends utils.Adapter {
"x-service-code": this.svc,
"Accept-Language": `${this.gateway.languageCode};q=1`,
"x-message-id": uuid.v4(),
"x-emp-token": this.session.access_token,
"x-emp-token": this.session ? this.session.access_token : "",
"x-origin": "app-native",
"Accept": "application/json",
"Content-Type": "application/json;charset=UTF-8",
Expand Down Expand Up @@ -1182,7 +1182,7 @@ class LgThinq extends utils.Adapter {
async refreshNewToken() {
this.log.debug("refreshToken");
const tokenUrl = this.lgeapi_url + "oauth/1.0/oauth2/token";
if (!this.session.refresh_token) {
if (!this.session || !this.session.refresh_token) {
await this.setStateAsync("info.connection", false, true);
this.updateInterval && this.clearInterval(this.updateInterval);
this.qualityInterval && this.clearInterval(this.qualityInterval);
Expand Down

0 comments on commit 63e5a9e

Please sign in to comment.