Closed Flole998 closed 1 year ago
Hmm, alright. Could you post some more logs on what happens? What's the device in question? Why does it not have a name? How does the Plejd app look?
@Flole998: After an in-depth code review I get the issue you're talking about. You're indeed right that the specific part of the code lacks typing and (incorrectly) assumes that id and name exists.
I've clarified the typing, changed name
to title
and created a lookup to go from device id (which we have) to BLE id (which we don't have).
This is part of the latest commit in the https://github.com/icanos/hassio-plejd/tree/develop branch and planned for 0.11
In PlejdBLEHandler.js there are cases where fields of the variable
this.connectedDevice
are accessed. For examplelogger.info(`BLE Connected to ${this.connectedDevice.name}`);
which will always return "undefined" as the type is a Device (from types/ApiSite.d.ts) and not an InputDevice or OutputDevice.Also syncing the time is broken due to this,
this.connectedDevice.id
is needed there but that doesn't exist, so 0 is assumed there which doesn't work if there is no device with mesh index 0.