Only add a BLE output id once during discovery to account for grouping in DWN devices
This commit is contained in:
parent
14ba127182
commit
ae8e41ec41
1 changed files with 8 additions and 0 deletions
|
|
@ -49,6 +49,14 @@ class DeviceRegistry {
|
||||||
|
|
||||||
/** @param outputDevice {import('types/DeviceRegistry').OutputDevice} */
|
/** @param outputDevice {import('types/DeviceRegistry').OutputDevice} */
|
||||||
addOutputDevice(outputDevice) {
|
addOutputDevice(outputDevice) {
|
||||||
|
const alreadyExistingBLEDevice = this.getOutputDeviceByBleOutputAddress(outputDevice.bleOutputAddress);
|
||||||
|
if (alreadyExistingBLEDevice) {
|
||||||
|
logger.warn(`Device with output id ${outputDevice.bleOutputAddress} already exists named ${alreadyExistingBLEDevice.name}. These two devices are probably grouped in the Plejd app. If this seems to be an error, please log a GitHub issue.`);
|
||||||
|
logger.info(`NOT adding ${outputDevice.name} to device registry`);
|
||||||
|
logger.verbose(`Details of device NOT added: ${JSON.stringify(outputDevice)}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.outputDevices = {
|
this.outputDevices = {
|
||||||
...this.outputDevices,
|
...this.outputDevices,
|
||||||
[outputDevice.uniqueId]: outputDevice,
|
[outputDevice.uniqueId]: outputDevice,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue