Fix for devices without output
This commit is contained in:
parent
a633ffacb3
commit
36e5c62b4f
1 changed files with 37 additions and 30 deletions
|
|
@ -326,42 +326,49 @@ class PlejdApi {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const deviceOutput = outputSettings ? outputSettings.output : 0;
|
const deviceOutput = outputSettings ? outputSettings.output : 0;
|
||||||
const bleOutputAddress = this.siteDetails.outputAddress[device.deviceId][deviceOutput];
|
const outputAddress = this.siteDetails.outputAddress[device.deviceId];
|
||||||
|
|
||||||
if (device.traits === TRAITS.NO_LOAD) {
|
if (outputAddress) {
|
||||||
logger.warn(
|
const bleOutputAddress = outputAddress[deviceOutput];
|
||||||
`Device ${device.title} (${device.deviceId}) has no load configured and will be excluded`,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
const uniqueOutputId = this.deviceRegistry.getUniqueOutputId(device.deviceId, deviceOutput);
|
|
||||||
|
|
||||||
const plejdDevice = this.siteDetails.plejdDevices.find(
|
if (device.traits === TRAITS.NO_LOAD) {
|
||||||
(x) => x.deviceId === device.deviceId,
|
logger.warn(
|
||||||
);
|
`Device ${device.title} (${device.deviceId}) has no load configured and will be excluded`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const uniqueOutputId = this.deviceRegistry.getUniqueOutputId(
|
||||||
|
device.deviceId,
|
||||||
|
deviceOutput,
|
||||||
|
);
|
||||||
|
|
||||||
const dimmable = device.traits === TRAITS.DIMMABLE;
|
const plejdDevice = this.siteDetails.plejdDevices.find(
|
||||||
// dimmable = settings.dimCurve !== 'NonDimmable';
|
(x) => x.deviceId === device.deviceId,
|
||||||
|
);
|
||||||
|
|
||||||
const { name: typeName, type } = this._getDeviceType(plejdDevice);
|
const dimmable = device.traits === TRAITS.DIMMABLE;
|
||||||
|
// dimmable = settings.dimCurve !== 'NonDimmable';
|
||||||
|
|
||||||
/** @type {import('types/DeviceRegistry').OutputDevice} */
|
const { name: typeName, type } = this._getDeviceType(plejdDevice);
|
||||||
const outputDevice = {
|
|
||||||
bleOutputAddress,
|
|
||||||
deviceId: device.deviceId,
|
|
||||||
dimmable,
|
|
||||||
hiddenFromRoomList: device.hiddenFromRoomList,
|
|
||||||
hiddenFromIntegrations: device.hiddenFromIntegrations,
|
|
||||||
name: device.title,
|
|
||||||
output: deviceOutput,
|
|
||||||
roomId: device.roomId,
|
|
||||||
state: undefined,
|
|
||||||
type,
|
|
||||||
typeName,
|
|
||||||
version: plejdDevice.firmware.version,
|
|
||||||
uniqueId: uniqueOutputId,
|
|
||||||
};
|
|
||||||
|
|
||||||
this.deviceRegistry.addOutputDevice(outputDevice);
|
/** @type {import('types/DeviceRegistry').OutputDevice} */
|
||||||
|
const outputDevice = {
|
||||||
|
bleOutputAddress,
|
||||||
|
deviceId: device.deviceId,
|
||||||
|
dimmable,
|
||||||
|
hiddenFromRoomList: device.hiddenFromRoomList,
|
||||||
|
hiddenFromIntegrations: device.hiddenFromIntegrations,
|
||||||
|
name: device.title,
|
||||||
|
output: deviceOutput,
|
||||||
|
roomId: device.roomId,
|
||||||
|
state: undefined,
|
||||||
|
type,
|
||||||
|
typeName,
|
||||||
|
version: plejdDevice.firmware.version,
|
||||||
|
uniqueId: uniqueOutputId,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.deviceRegistry.addOutputDevice(outputDevice);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// What should we do with inputs?!
|
// What should we do with inputs?!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue