diff --git a/src-admin/src/i18n/de.json b/src-admin/src/i18n/de.json index 592845f..937f47d 100644 --- a/src-admin/src/i18n/de.json +++ b/src-admin/src/i18n/de.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "Es wurden keine Geräte hinzugefügt, da sie bereits in der Liste sind oder durch die Lizenz nicht zugelassen sind.", "No devices was added, as they are not allowed by license": "Es wurden keine Geräte hinzugefügt, da diese laut Lizenz nicht zulässig sind", "No one device created. Create one, by clicking on the \"+\" button on the left.": "Noch kein Gerät erstellt. Erstellen Sie eins, indem Sie links auf die Schaltfläche „+“ klicken.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "Der Knoten wurde aktiviert und wird nun verbunden. Es kann einen Moment dauern, bis die Geräte dieses Knotens angezeigt werden.", "Not connected": "Nicht verbunden", "Not supported yet": "Noch nicht unterstützt", "Not used devices": "Nicht verwendete Geräte", diff --git a/src-admin/src/i18n/en.json b/src-admin/src/i18n/en.json index 6f314e4..8788bec 100644 --- a/src-admin/src/i18n/en.json +++ b/src-admin/src/i18n/en.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "No devices was added, as they are already in the list or not allowed by license", "No devices was added, as they are not allowed by license": "No devices was added, as they are not allowed by license", "No one device created. Create one, by clicking on the \"+\" button on the left.": "No one device created. Create one, by clicking on the \"+\" button on the left.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.", "Not connected": "Not connected", "Not supported yet": "Not supported yet", "Not used devices": "Not used devices", diff --git a/src-admin/src/i18n/es.json b/src-admin/src/i18n/es.json index ea3aed9..59ba9b5 100644 --- a/src-admin/src/i18n/es.json +++ b/src-admin/src/i18n/es.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "No se agregó ningún dispositivo porque ya está en la lista o no está permitido por la licencia.", "No devices was added, as they are not allowed by license": "No se agregaron dispositivos, ya que no están permitidos por la licencia.", "No one device created. Create one, by clicking on the \"+\" button on the left.": "No se ha creado ningún dispositivo. Cree uno haciendo clic en el botón \"+\" de la izquierda.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "El nodo se ha activado y se conectará ahora. Puede tardar un momento hasta que se muestren los dispositivos de este nodo.", "Not connected": "No conectado", "Not supported yet": "Aún no es compatible", "Not used devices": "Dispositivos no usados", diff --git a/src-admin/src/i18n/fr.json b/src-admin/src/i18n/fr.json index 03adf5e..996ffea 100644 --- a/src-admin/src/i18n/fr.json +++ b/src-admin/src/i18n/fr.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "Aucun appareil n'a été ajouté, car ils sont déjà dans la liste ou ne sont pas autorisés par la licence", "No devices was added, as they are not allowed by license": "Aucun appareil n'a été ajouté, car ils ne sont pas autorisés par la licence", "No one device created. Create one, by clicking on the \"+\" button on the left.": "Aucun appareil n'a été créé. Créez-en un en cliquant sur le bouton « + » à gauche.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "Le nœud a été activé et va être connecté maintenant. Il peut s'écouler un certain temps avant que les appareils de ce nœud ne soient affichés.", "Not connected": "Pas connecté", "Not supported yet": "Pas encore pris en charge", "Not used devices": "Appareils non utilisés", diff --git a/src-admin/src/i18n/it.json b/src-admin/src/i18n/it.json index f5c17b2..f7dd002 100644 --- a/src-admin/src/i18n/it.json +++ b/src-admin/src/i18n/it.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "Nessun dispositivo è stato aggiunto, poiché sono già presenti nell'elenco o non sono consentiti dalla licenza", "No devices was added, as they are not allowed by license": "Nessun dispositivo è stato aggiunto, poiché non sono consentiti dalla licenza", "No one device created. Create one, by clicking on the \"+\" button on the left.": "Nessun dispositivo creato. Creane uno, cliccando sul pulsante \"+\" a sinistra.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "Il nodo è stato abilitato e sarà ora connesso. Potrebbe essere necessario un po' di tempo prima che vengano visualizzati i dispositivi di questo nodo.", "Not connected": "Non collegata", "Not supported yet": "Non ancora supportato", "Not used devices": "Dispositivi non utilizzati", diff --git a/src-admin/src/i18n/nl.json b/src-admin/src/i18n/nl.json index 8192b19..6bdcfba 100644 --- a/src-admin/src/i18n/nl.json +++ b/src-admin/src/i18n/nl.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "Er zijn geen apparaten toegevoegd, omdat ze al in de lijst staan of niet zijn toegestaan door de licentie", "No devices was added, as they are not allowed by license": "Er zijn geen apparaten toegevoegd, omdat deze niet zijn toegestaan volgens de licentie", "No one device created. Create one, by clicking on the \"+\" button on the left.": "Geen enkel apparaat gemaakt. Maak er een door op de \"+\" knop aan de linkerkant te klikken.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "Node is ingeschakeld en wordt nu verbonden. Het kan even duren voordat de apparaten van dit knooppunt worden weergegeven.", "Not connected": "Niet verbonden", "Not supported yet": "Nog niet ondersteund", "Not used devices": "Niet gebruikte apparaten", diff --git a/src-admin/src/i18n/pl.json b/src-admin/src/i18n/pl.json index 8cc7fea..418a9c6 100644 --- a/src-admin/src/i18n/pl.json +++ b/src-admin/src/i18n/pl.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "Nie dodano żadnych urządzeń, ponieważ znajdują się już na liście lub nie są dozwolone przez licencję", "No devices was added, as they are not allowed by license": "Nie dodano żadnych urządzeń, ponieważ nie są one dozwolone przez licencję", "No one device created. Create one, by clicking on the \"+\" button on the left.": "Nie utworzono żadnego urządzenia. Utwórz je, klikając przycisk „+” po lewej stronie.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "Węzeł został włączony i zostanie teraz połączony. Wyświetlenie urządzeń tego węzła może chwilę potrwać.", "Not connected": "Nie połączony", "Not supported yet": "Jeszcze nieobsługiwane", "Not used devices": "Nieużywane urządzenia", diff --git a/src-admin/src/i18n/pt.json b/src-admin/src/i18n/pt.json index 761dabc..9a521d8 100644 --- a/src-admin/src/i18n/pt.json +++ b/src-admin/src/i18n/pt.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "Nenhum dispositivo foi adicionado, pois eles já estão na lista ou não são permitidos pela licença", "No devices was added, as they are not allowed by license": "Nenhum dispositivo foi adicionado, pois não são permitidos pela licença", "No one device created. Create one, by clicking on the \"+\" button on the left.": "Nenhum dispositivo criado. Crie um, clicando no botão \"+\" à esquerda.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "O nó foi ativado e será ligado agora. Pode demorar um pouco até que os dispositivos deste nó sejam mostrados.", "Not connected": "Não conectado", "Not supported yet": "Ainda não suportado", "Not used devices": "Dispositivos não usados", diff --git a/src-admin/src/i18n/ru.json b/src-admin/src/i18n/ru.json index 0d7dd09..93b8515 100644 --- a/src-admin/src/i18n/ru.json +++ b/src-admin/src/i18n/ru.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "Устройства не были добавлены, так как они уже есть в списке или не разрешены лицензией.", "No devices was added, as they are not allowed by license": "Устройства не добавлены, так как они не разрешены лицензией.", "No one device created. Create one, by clicking on the \"+\" button on the left.": "Ни одно устройство не создано. Создайте его, нажав на кнопку \"+\" слева.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "Узел включен и теперь будет подключен. Может потребоваться некоторое время, чтобы отобразились устройства этого узла.", "Not connected": "Не подключен", "Not supported yet": "Пока не поддерживается", "Not used devices": "Не используемые устройства", diff --git a/src-admin/src/i18n/uk.json b/src-admin/src/i18n/uk.json index 1bfbff9..b380d7e 100644 --- a/src-admin/src/i18n/uk.json +++ b/src-admin/src/i18n/uk.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "Пристрої не додано, оскільки вони вже є в списку або заборонені ліцензією", "No devices was added, as they are not allowed by license": "Жодних пристроїв не додано, оскільки вони заборонені ліцензією", "No one device created. Create one, by clicking on the \"+\" button on the left.": "Жодного пристрою не створено. Створіть його, натиснувши кнопку «+» ліворуч.", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "Вузол увімкнено, і зараз його буде підключено. Може минути деякий час, доки не відобразяться пристрої цього вузла.", "Not connected": "Не з'єднано", "Not supported yet": "Ще не підтримується", "Not used devices": "Пристрої не використовувалися", diff --git a/src-admin/src/i18n/zh-cn.json b/src-admin/src/i18n/zh-cn.json index ff54c9c..0344b03 100644 --- a/src-admin/src/i18n/zh-cn.json +++ b/src-admin/src/i18n/zh-cn.json @@ -108,6 +108,7 @@ "No devices was added, as they are already in the list or not allowed by license": "未添加任何设备,因为它们已在列表中或许可证不允许", "No devices was added, as they are not allowed by license": "未添加任何设备,因为许可证不允许这些设备", "No one device created. Create one, by clicking on the \"+\" button on the left.": "尚未创建设备。点击左侧的“+”按钮创建一个。", + "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.": "Node got enabled and will be connected now. It might take a moment until the devices of this node are shown.", "Not connected": "未连接", "Not supported yet": "尚不支持", "Not used devices": "未使用的设备", diff --git a/src/lib/devices/Blind.ts b/src/lib/devices/Blind.ts index 0cf91d2..a920e4c 100644 --- a/src/lib/devices/Blind.ts +++ b/src/lib/devices/Blind.ts @@ -11,19 +11,18 @@ class Blind extends BlindButtons { this._construction.push( this.addDeviceStates([ - // actual value first, as it will be read first { name: 'ACTUAL', valueType: ValueType.NumberPercent, accessType: StateAccessType.Read, - type: PropertyType.Level, + type: PropertyType.LevelActual, callback: state => (this.#getLevelState = state), }, { name: 'SET', valueType: ValueType.NumberPercent, accessType: StateAccessType.ReadWrite, - type: PropertyType.LevelActual, + type: PropertyType.Level, callback: state => (this.#setLevelState = state), }, ]), diff --git a/src/matter/behaviors/IdentifyServer.ts b/src/matter/behaviors/IdentifyServer.ts new file mode 100644 index 0000000..a1103d6 --- /dev/null +++ b/src/matter/behaviors/IdentifyServer.ts @@ -0,0 +1,9 @@ +import { IdentifyServer } from '@matter/main/behaviors'; + +export class LoggingIdentifyServer extends IdentifyServer {} + +export class LightingIdentifyServer extends IdentifyServer { + override triggerEffect(): void { + // TODO + } +} diff --git a/src/matter/behaviors/IoBrokerContext.ts b/src/matter/behaviors/IoBrokerContext.ts new file mode 100644 index 0000000..409e16b --- /dev/null +++ b/src/matter/behaviors/IoBrokerContext.ts @@ -0,0 +1,25 @@ +import { Behavior } from '@matter/main'; +import type GenericDevice from '../../lib/devices/GenericDevice'; +import type { MatterAdapter } from '../../main'; + +export class IoBrokerContextBehavior extends Behavior { + static override readonly id = 'ioBrokerContext'; + declare state: IoBrokerContextBehavior.State; + + override initialize(): void { + if (!this.state.adapter) { + throw new Error('Adapter not set'); + } + if (!this.state.device) { + throw new Error('Device not set'); + } + } +} + +// eslint-disable-next-line @typescript-eslint/no-namespace +export namespace IoBrokerContextBehavior { + export class State { + adapter!: MatterAdapter; + device!: GenericDevice; + } +} diff --git a/src/matter/to-iobroker/UtilityOnlyToIoBroker.ts b/src/matter/to-iobroker/UtilityOnlyToIoBroker.ts index c116ccb..d02ef3b 100644 --- a/src/matter/to-iobroker/UtilityOnlyToIoBroker.ts +++ b/src/matter/to-iobroker/UtilityOnlyToIoBroker.ts @@ -1,5 +1,6 @@ import ChannelDetector from '@iobroker/type-detector'; import type { Endpoint, PairedNode } from '@project-chip/matter.js/device'; +import { PowerSource } from '@matter/main/clusters'; import type { GenericDevice } from '../../lib'; import type ElectricityDataDevice from '../../lib/devices/ElectricityDataDevice'; import type { DetectedDevice } from '../../lib/devices/GenericDevice'; @@ -50,16 +51,29 @@ export class UtilityOnlyToIoBroker extends GenericElectricityDataDeviceToIoBroke override get iconDeviceType(): string | undefined { switch (this.deviceType) { case 'ElectricalSensor': - // Return a special measurement icon for it + // Electrical sensor icon return 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+DQogICAgPHBhdGggZmlsbD0iY3VycmVudENvbG9yIiBkPSJtMjIgMjAuNTktNC42OS00LjY5QzE4LjM3IDE0LjU1IDE5IDEyLjg1IDE5IDExYzAtNC40Mi0zLjU4LTgtOC04LTQuMDggMC03LjQ0IDMuMDUtNy45MyA3aDIuMDJDNS41NyA3LjE3IDguMDMgNSAxMSA1YzMuMzEgMCA2IDIuNjkgNiA2cy0yLjY5IDYtNiA2Yy0yLjQyIDAtNC41LTEuNDQtNS40NS0zLjVIMy40QzQuNDUgMTYuNjkgNy40NiAxOSAxMSAxOWMxLjg1IDAgMy41NS0uNjMgNC45LTEuNjlMMjAuNTkgMjJ6IiAvPg0KICAgIDxwYXRoIGZpbGw9ImN1cnJlbnRDb2xvciIgZD0iTTguNDMgOS42OSA5LjY1IDE1aDEuNjRsMS4yNi0zLjc4Ljk1IDIuMjhoMlYxMmgtMWwtMS4yNS0zaC0xLjU0bC0xLjEyIDMuMzdMOS4zNSA3SDcuN2wtMS4yNSA0SDF2MS41aDYuNTV6IiAvPg0KPC9zdmc+'; case 'BridgedNode': return 'node'; - // TODO Add PowerSource + case 'PowerSource': { + const powerSource = this.appEndpoint.getClusterClient(PowerSource.Complete); + if (powerSource) { + if (powerSource.supportedFeatures.battery) { + // Battery icon + return 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+DQogICAgPHBhdGggZmlsbD0iY3VycmVudENvbG9yIiBkPSJNMTUuNjcgNEgxNFYyaC00djJIOC4zM0M3LjYgNCA3IDQuNiA3IDUuMzN2MTUuMzNDNyAyMS40IDcuNiAyMiA4LjMzIDIyaDcuMzNjLjc0IDAgMS4zNC0uNiAxLjM0LTEuMzNWNS4zM0MxNyA0LjYgMTYuNCA0IDE1LjY3IDQiIC8+DQo8L3N2Zz4='; + } else if (powerSource.supportedFeatures.wired) { + // Wired icon + return 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+DQogICAgPHBhdGggZmlsbD0iY3VycmVudENvbG9yIiBkPSJNMTYuMDEgNyAxNiAzaC0ydjRoLTRWM0g4djRoLS4wMUM3IDYuOTkgNiA3Ljk5IDYgOC45OXY1LjQ5TDkuNSAxOHYzaDV2LTNsMy41LTMuNTF2LTUuNWMwLTEtMS0yLTEuOTktMS45OSIgLz4NCjwvc3ZnPg=='; + } + } + } + // eslint-disable-next-line no-fallthrough default: if (this.#deviceTypeSupported) { super.iconDeviceType; } else { - return 'unknown'; + // Questionmark icon + return 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgPg0KICAgIDxwYXRoIGZpbGw9ImN1cnJlbnRDb2xvciIgZD0iTTExLjA3IDEyLjg1Yy43Ny0xLjM5IDIuMjUtMi4yMSAzLjExLTMuNDQuOTEtMS4yOS40LTMuNy0yLjE4LTMuNy0xLjY5IDAtMi41MiAxLjI4LTIuODcgMi4zNEw2LjU0IDYuOTZDNy4yNSA0LjgzIDkuMTggMyAxMS45OSAzYzIuMzUgMCAzLjk2IDEuMDcgNC43OCAyLjQxLjcgMS4xNSAxLjExIDMuMy4wMyA0LjktMS4yIDEuNzctMi4zNSAyLjMxLTIuOTcgMy40NS0uMjUuNDYtLjM1Ljc2LS4zNSAyLjI0aC0yLjg5Yy0uMDEtLjc4LS4xMy0yLjA1LjQ4LTMuMTVNMTQgMjBjMCAxLjEtLjkgMi0yIDJzLTItLjktMi0yIC45LTIgMi0yIDIgLjkgMiAyIj48L3BhdGg+DQo8L3N2Zz4='; } } }