Add description to device types to improve clarity
This commit is contained in:
parent
efac28fc30
commit
aaad0ebf61
2 changed files with 14 additions and 7 deletions
|
|
@ -451,9 +451,9 @@ class PlejdApi {
|
||||||
// dimmable = settings.dimCurve !== 'NonDimmable';
|
// dimmable = settings.dimCurve !== 'NonDimmable';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { name: typeName, type: deviceType } = this._getDeviceType(plejdDevice);
|
const decodedDeviceType = this._getDeviceType(plejdDevice);
|
||||||
|
|
||||||
let loadType = deviceType;
|
let loadType = decodedDeviceType.type;
|
||||||
if (device.outputType === 'RELAY') {
|
if (device.outputType === 'RELAY') {
|
||||||
loadType = 'switch';
|
loadType = 'switch';
|
||||||
} else if (device.outputType === 'LIGHT') {
|
} else if (device.outputType === 'LIGHT') {
|
||||||
|
|
@ -474,7 +474,8 @@ class PlejdApi {
|
||||||
roomName: roomTitle,
|
roomName: roomTitle,
|
||||||
state: undefined,
|
state: undefined,
|
||||||
type: loadType,
|
type: loadType,
|
||||||
typeName,
|
typeDescription: decodedDeviceType.description,
|
||||||
|
typeName: decodedDeviceType.name,
|
||||||
version: plejdDevice.firmware.version,
|
version: plejdDevice.firmware.version,
|
||||||
uniqueId: uniqueOutputId,
|
uniqueId: uniqueOutputId,
|
||||||
};
|
};
|
||||||
|
|
@ -509,8 +510,9 @@ class PlejdApi {
|
||||||
const uniqueInputId = this.deviceRegistry.getUniqueInputId(device.deviceId, input.input);
|
const uniqueInputId = this.deviceRegistry.getUniqueInputId(device.deviceId, input.input);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { name: typeName, type, broadcastClicks } = this._getDeviceType(plejdDevice);
|
const decodedDeviceType = this._getDeviceType(plejdDevice);
|
||||||
if (broadcastClicks) {
|
|
||||||
|
if (decodedDeviceType.broadcastClicks) {
|
||||||
/** @type {import('types/DeviceRegistry').InputDevice} */
|
/** @type {import('types/DeviceRegistry').InputDevice} */
|
||||||
const inputDevice = {
|
const inputDevice = {
|
||||||
bleInputAddress,
|
bleInputAddress,
|
||||||
|
|
@ -518,8 +520,9 @@ class PlejdApi {
|
||||||
name: device.title,
|
name: device.title,
|
||||||
input: input.input,
|
input: input.input,
|
||||||
roomId: device.roomId,
|
roomId: device.roomId,
|
||||||
type,
|
type: decodedDeviceType.type,
|
||||||
typeName,
|
typeDescription: decodedDeviceType.description,
|
||||||
|
typeName: decodedDeviceType.name,
|
||||||
version: plejdDevice.firmware.version,
|
version: plejdDevice.firmware.version,
|
||||||
uniqueId: uniqueInputId,
|
uniqueId: uniqueInputId,
|
||||||
};
|
};
|
||||||
|
|
@ -560,6 +563,7 @@ class PlejdApi {
|
||||||
roomName: undefined,
|
roomName: undefined,
|
||||||
state: undefined,
|
state: undefined,
|
||||||
type: 'light',
|
type: 'light',
|
||||||
|
typeDescription: 'A Plejd room',
|
||||||
typeName: 'Room',
|
typeName: 'Room',
|
||||||
uniqueId: roomId,
|
uniqueId: roomId,
|
||||||
version: undefined,
|
version: undefined,
|
||||||
|
|
@ -589,6 +593,7 @@ class PlejdApi {
|
||||||
roomName: undefined,
|
roomName: undefined,
|
||||||
state: false,
|
state: false,
|
||||||
type: 'scene',
|
type: 'scene',
|
||||||
|
typeDescription: 'A Plejd scene',
|
||||||
typeName: 'Scene',
|
typeName: 'Scene',
|
||||||
version: undefined,
|
version: undefined,
|
||||||
uniqueId: scene.sceneId,
|
uniqueId: scene.sceneId,
|
||||||
|
|
|
||||||
2
plejd/types/DeviceRegistry.d.ts
vendored
2
plejd/types/DeviceRegistry.d.ts
vendored
|
|
@ -13,6 +13,7 @@ export interface OutputDevice {
|
||||||
roomName: string | undefined;
|
roomName: string | undefined;
|
||||||
state: boolean | undefined;
|
state: boolean | undefined;
|
||||||
type: string;
|
type: string;
|
||||||
|
typeDescription: string;
|
||||||
typeName: string;
|
typeName: string;
|
||||||
version: string;
|
version: string;
|
||||||
uniqueId: string;
|
uniqueId: string;
|
||||||
|
|
@ -27,6 +28,7 @@ export interface InputDevice {
|
||||||
input: number;
|
input: number;
|
||||||
roomId: string;
|
roomId: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
typeDescription: string;
|
||||||
typeName: string;
|
typeName: string;
|
||||||
version: string;
|
version: string;
|
||||||
uniqueId: string;
|
uniqueId: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue