Set entiteis to correct type (switch/light) and fix availability for scenes

- General cleanup and clarification of MQTT messages
This commit is contained in:
Victor Hagelbäck 2021-05-03 09:45:57 +02:00
parent 36e5c62b4f
commit 236e533c8a
3 changed files with 122 additions and 63 deletions

View file

@ -348,7 +348,13 @@ class PlejdApi {
const dimmable = device.traits === TRAITS.DIMMABLE;
// dimmable = settings.dimCurve !== 'NonDimmable';
const { name: typeName, type } = this._getDeviceType(plejdDevice);
const { name: typeName, type: deviceType } = this._getDeviceType(plejdDevice);
let loadType = deviceType;
if (device.outputType === 'RELAY') {
loadType = 'switch';
} else if (device.outputType === 'LIGHT') {
loadType = 'light';
}
/** @type {import('types/DeviceRegistry').OutputDevice} */
const outputDevice = {
@ -361,7 +367,7 @@ class PlejdApi {
output: deviceOutput,
roomId: device.roomId,
state: undefined,
type,
type: loadType,
typeName,
version: plejdDevice.firmware.version,
uniqueId: uniqueOutputId,