Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dishwasher currentInputName is undefined and crashes on .includes(). #270

Closed
zthun opened this issue Dec 30, 2023 · 0 comments
Closed

Dishwasher currentInputName is undefined and crashes on .includes(). #270

zthun opened this issue Dec 30, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@zthun
Copy link

zthun commented Dec 30, 2023

Describe The Bug:

When trying to show the status of my dishwasher, I get a crash in currentInputName().

To Reproduce:

  • Install Plugin
  • Access account with older dishwasher without steam setting

Expected behavior:

  • I can see the dishwasher in my home app.

Logs:

[12/29/2023, 10:06:26 PM] [homebridge-lg-thinq] TypeError: Cannot read properties of undefined (reading 'includes')
    at Dishwasher.currentInputName (/usr/local/lib/node_modules/homebridge-lg-thinq/src/devices/Dishwasher.ts:410:32)
    at ConfiguredName.<anonymous> (/usr/local/lib/node_modules/homebridge-lg-thinq/src/devices/Dishwasher.ts:106:14)
    at ConfiguredName.emit (node:events:517:28)
    at ConfiguredName.emit (node:domain:489:12)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2463:14
    at new Promise (<anonymous>)
    at ConfiguredName.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2461:12)
    at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:195:27)
    at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:176:57)
    at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:169:75
[12/29/2023, 10:06:26 PM] [homebridge-lg-thinq] TypeError: Cannot read properties of undefined (reading 'includes')
    at Dishwasher.currentInputName (/usr/local/lib/node_modules/homebridge-lg-thinq/src/devices/Dishwasher.ts:410:32)
    at ConfiguredName.<anonymous> (/usr/local/lib/node_modules/homebridge-lg-thinq/src/devices/Dishwasher.ts:115:14)
    at ConfiguredName.emit (node:events:517:28)
    at ConfiguredName.emit (node:domain:489:12)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2463:14
    at new Promise (<anonymous>)
    at ConfiguredName.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2461:12)
    at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:195:27)
    at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:176:57)
    at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:169:75

Plugin Config:

{
    "country": "US",
    "language": "en-US",
    "auth_mode": "token",
    "refresh_token": "<redacted>",
    "username": "<redacted>",
    "password": "<redacted>",
    "devices": [
        {
            "id": "d685b291-34ea-14f4-8e82-402f862ee67c",
            "name": "Dishwasher",
            "type": "DISHWASHER",
            "dishwasher_trigger": true
        }
    ],
    "platform": "LGThinQ",
    "thinq1": true,
    "refresh_interval": 60
}

Notes:

The issue is here in Dishwasher.ts, line 410:

if (this.Status.data.steam.includes('ON')) {
  this.inputNameOptions += ' Steam,';
}

My dishwasher doesn't have a true steam function. A change to the following should fix this particular issue.

if (this.Status.data.steam?.includes('ON')) {
  this.inputNameOptions += ' Steam,';
}

Probably should change all of them, but this is the one that is currently crashing for me.

Environment:

  • Plugin Version: 1.6.3
  • Homebridge Version: v1.7.0
  • Node.js Version: 18.18.2
  • Operating System: FreeBSD (13.1)
@zthun zthun added the bug Something isn't working label Dec 30, 2023
nVuln pushed a commit that referenced this issue Jan 28, 2024
@nVuln nVuln closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants