Change behavior to add all devices to Home Assistan, whether they are hidden in the Plejd app or not

This commit is contained in:
Victor Hagelbäck 2021-06-21 12:06:08 +02:00
parent 42bf415fa5
commit 56870879b8
5 changed files with 2 additions and 37 deletions

View file

@ -49,13 +49,6 @@ class DeviceRegistry {
/** @param outputDevice {import('types/DeviceRegistry').OutputDevice} */ /** @param outputDevice {import('types/DeviceRegistry').OutputDevice} */
addOutputDevice(outputDevice) { addOutputDevice(outputDevice) {
if (outputDevice.hiddenFromIntegrations || outputDevice.hiddenFromRoomList) {
logger.verbose(`Device ${outputDevice.name} is hidden and will not be included.
Hidden from room list: ${outputDevice.hiddenFromRoomList}
Hidden from integrations: ${outputDevice.hiddenFromIntegrations}`);
return;
}
this.outputDevices = { this.outputDevices = {
...this.outputDevices, ...this.outputDevices,
[outputDevice.uniqueId]: outputDevice, [outputDevice.uniqueId]: outputDevice,

View file

@ -444,8 +444,6 @@ class PlejdApi {
bleOutputAddress, bleOutputAddress,
deviceId: device.deviceId, deviceId: device.deviceId,
dimmable, dimmable,
hiddenFromRoomList: device.hiddenFromRoomList,
hiddenFromIntegrations: device.hiddenFromIntegrations,
name: device.title, name: device.title,
output: deviceOutput, output: deviceOutput,
roomId: device.roomId, roomId: device.roomId,
@ -518,8 +516,6 @@ class PlejdApi {
bleOutputAddress: roomAddress, bleOutputAddress: roomAddress,
deviceId: null, deviceId: null,
dimmable, dimmable,
hiddenFromRoomList: false,
hiddenFromIntegrations: false,
name: room.title, name: room.title,
output: undefined, output: undefined,
roomId: undefined, roomId: undefined,
@ -540,7 +536,7 @@ class PlejdApi {
_getSceneDevices() { _getSceneDevices() {
this.deviceRegistry.clearSceneDevices(); this.deviceRegistry.clearSceneDevices();
// add scenes as switches // add scenes as switches
const scenes = this.siteDetails.scenes.filter((x) => x.hiddenFromSceneList === false); const scenes = [...this.siteDetails.scenes];
scenes.forEach((scene) => { scenes.forEach((scene) => {
const sceneNum = this.siteDetails.sceneIndex[scene.sceneId]; const sceneNum = this.siteDetails.sceneIndex[scene.sceneId];
@ -549,7 +545,6 @@ class PlejdApi {
bleOutputAddress: sceneNum, bleOutputAddress: sceneNum,
deviceId: undefined, deviceId: undefined,
dimmable: false, dimmable: false,
hiddenFromSceneList: scene.hiddenFromSceneList,
name: scene.title, name: scene.title,
output: undefined, output: undefined,
roomId: undefined, roomId: undefined,

View file

@ -17,9 +17,7 @@ class SceneManager {
} }
init() { init() {
const scenes = this.deviceRegistry const scenes = [...this.deviceRegistry.getApiSite().scenes];
.getApiSite()
.scenes.filter((x) => x.hiddenFromSceneList === false);
this.scenes = {}; this.scenes = {};
scenes.forEach((scene) => { scenes.forEach((scene) => {

View file

@ -7,9 +7,6 @@ export interface OutputDevice {
deviceId: string; deviceId: string;
dim?: number; dim?: number;
dimmable: boolean; dimmable: boolean;
hiddenFromRoomList?: boolean;
hiddenFromIntegrations?: boolean;
hiddenFromSceneList?: boolean;
name: string; name: string;
output: number; output: number;
roomId: string | undefined; roomId: string | undefined;

18
plejd/types/Mqtt.d.ts vendored
View file

@ -5,21 +5,3 @@ export type TOPIC_TYPES = { [key: string]: TopicType };
export type MqttType = 'light' | 'scene' | 'switch' | 'device_automation'; export type MqttType = 'light' | 'scene' | 'switch' | 'device_automation';
export type MQTT_TYPES = { [key: string]: MqttType }; export type MQTT_TYPES = { [key: string]: MqttType };
export interface OutputDevice {
bleOutputAddress: number;
deviceId: string;
dim?: number;
dimmable: boolean;
hiddenFromRoomList?: boolean;
hiddenFromIntegrations?: boolean;
hiddenFromSceneList?: boolean;
name: string;
output: number;
roomId: string;
state: boolean | undefined;
type: string;
typeName: string;
version: string;
uniqueId: string;
}