iobroker.zigbee 1.8.25 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/io-package.json +43 -40
- package/lib/devicemgmt.js +393 -0
- package/main.js +12 -0
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -134,6 +134,17 @@ You can thank the authors by these links:
|
|
|
134
134
|
-----------------------------------------------------------------------------------------------------
|
|
135
135
|
|
|
136
136
|
## Changelog
|
|
137
|
+
### 1.9.0 (2023-12-22)
|
|
138
|
+
* (arteck) up to new zhc
|
|
139
|
+
* (arteck) update dependency
|
|
140
|
+
|
|
141
|
+
### 1.8.27 (2023-12-22)
|
|
142
|
+
* (arteck) update dependency
|
|
143
|
+
|
|
144
|
+
### 1.8.26 (2023-12-22)
|
|
145
|
+
* (arteck) corr toZigbee message
|
|
146
|
+
* (arteck) add deviceManager
|
|
147
|
+
|
|
137
148
|
### 1.8.25 (2023-12-17)
|
|
138
149
|
* zhc 16.x
|
|
139
150
|
* (arteck) corr group from exclude dialog
|
|
@@ -166,10 +177,14 @@ You can thank the authors by these links:
|
|
|
166
177
|
### 1.8.16 (2023-07-11)
|
|
167
178
|
* (arteck) battery corr
|
|
168
179
|
|
|
169
|
-
### 1.8.
|
|
180
|
+
### 1.8.15 (2023-07-11)
|
|
181
|
+
* (arteck) corr battery status
|
|
182
|
+
|
|
183
|
+
### 1.8.13 (2023-07-09)
|
|
170
184
|
* (arteck) ota corr
|
|
171
185
|
* (arteck) devices are wrong with enum exposes
|
|
172
|
-
* (arteck) select field for groups is larger
|
|
186
|
+
* (arteck) select field for groups is larger
|
|
187
|
+
* (kirovilya) tuya.whitelabel corr
|
|
173
188
|
|
|
174
189
|
### 1.8.12 (2023-06-30)
|
|
175
190
|
* (arteck) new Documentation (thx Stefan)
|
package/io-package.json
CHANGED
|
@@ -1,8 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "zigbee",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.9.0",
|
|
5
5
|
"news": {
|
|
6
|
+
"1.9.0": {
|
|
7
|
+
"en": "up to new zhc\nupdate dependency",
|
|
8
|
+
"de": "bis zum neuen zhc\naktualisierung abhängigkeit",
|
|
9
|
+
"ru": "до нового жк\nобновление зависимости",
|
|
10
|
+
"pt": "até novo zhc\ndependência de atualização",
|
|
11
|
+
"nl": "♪\nvertaling:",
|
|
12
|
+
"fr": "jusqu'au nouveau zhc\nmettre à jour la dépendance",
|
|
13
|
+
"it": "fino a nuovo zhc\ndipendenza da aggiornamento",
|
|
14
|
+
"es": "hasta nuevo zhc\nactualización de la dependencia",
|
|
15
|
+
"pl": "do nowego żc\nzależności",
|
|
16
|
+
"uk": "до нового жк\nоновлення залежності",
|
|
17
|
+
"zh-cn": "新的忠诚\n更新"
|
|
18
|
+
},
|
|
19
|
+
"1.8.27": {
|
|
20
|
+
"en": "update dependency",
|
|
21
|
+
"de": "aktualisierung abhängigkeit",
|
|
22
|
+
"ru": "обновление зависимости",
|
|
23
|
+
"pt": "dependência de atualização",
|
|
24
|
+
"nl": "vertaling:",
|
|
25
|
+
"fr": "mettre à jour la dépendance",
|
|
26
|
+
"it": "dipendenza da aggiornamento",
|
|
27
|
+
"es": "actualización de la dependencia",
|
|
28
|
+
"pl": "zależności",
|
|
29
|
+
"uk": "оновлення залежності",
|
|
30
|
+
"zh-cn": "更新"
|
|
31
|
+
},
|
|
32
|
+
"1.8.26": {
|
|
33
|
+
"en": "corr toZigbee message\nadd deviceManager",
|
|
34
|
+
"de": "corr toZigbee Nachricht\nadd-Gerät Manager",
|
|
35
|
+
"ru": "corr toZigbee сообщение\nдобавить устройство менеджер",
|
|
36
|
+
"pt": "mensagem de corrija\nadicionar dispositivo Gerente",
|
|
37
|
+
"nl": "vertaling:\nvoeg Manager",
|
|
38
|
+
"fr": "corr toZigbee message\najouter le dispositif Manager",
|
|
39
|
+
"it": "corr aZigbee messaggio\naggiungere dispositivo Manager",
|
|
40
|
+
"es": "corr toZigbee message\nañadir dispositivo Manager",
|
|
41
|
+
"pl": "kor toZigbee message\ndodać manager",
|
|
42
|
+
"uk": "corr toZigbee повідомлення\nдодати пристрій Менеджер",
|
|
43
|
+
"zh-cn": "信\n增加装置 管理人员"
|
|
44
|
+
},
|
|
6
45
|
"1.8.25": {
|
|
7
46
|
"en": "zhc 16.x \ncorr group from exclude dialog",
|
|
8
47
|
"de": "zhc 16.x\nkorr gruppe aus ausschluss dialog",
|
|
@@ -54,45 +93,6 @@
|
|
|
54
93
|
"pl": "w przypadku, gdy meta jest pusta",
|
|
55
94
|
"uk": "аварійний випадок, коли мета",
|
|
56
95
|
"zh-cn": "c 当元空时发生事故"
|
|
57
|
-
},
|
|
58
|
-
"1.8.21": {
|
|
59
|
-
"en": "no converter found",
|
|
60
|
-
"de": "kein konverter gefunden",
|
|
61
|
-
"ru": "не найдено конвертер",
|
|
62
|
-
"pt": "não encontrado",
|
|
63
|
-
"nl": "geen converter gevonden",
|
|
64
|
-
"fr": "aucun convertisseur trouvé",
|
|
65
|
-
"it": "nessun convertitore trovato",
|
|
66
|
-
"es": "no convertidor encontrado",
|
|
67
|
-
"pl": "nie znaleziono konwerterów",
|
|
68
|
-
"uk": "не знайдено",
|
|
69
|
-
"zh-cn": "未找到转换器"
|
|
70
|
-
},
|
|
71
|
-
"1.8.20": {
|
|
72
|
-
"en": "add log",
|
|
73
|
-
"de": "log",
|
|
74
|
-
"ru": "добавить лог",
|
|
75
|
-
"pt": "adicionar log",
|
|
76
|
-
"nl": "voeg logboek toe",
|
|
77
|
-
"fr": "ajouter log",
|
|
78
|
-
"it": "aggiungi log",
|
|
79
|
-
"es": "añadir registro",
|
|
80
|
-
"pl": "dodać",
|
|
81
|
-
"uk": "увійти",
|
|
82
|
-
"zh-cn": "增 编"
|
|
83
|
-
},
|
|
84
|
-
"1.8.19": {
|
|
85
|
-
"en": "fix occupancy_timeout\nfix battery percentage and voltage",
|
|
86
|
-
"de": "fix occupation_timeout\nbatterieanteil und spannung fixieren",
|
|
87
|
-
"ru": "исправить occupancy_timeout\nисправить процент батареи и напряжение",
|
|
88
|
-
"pt": "corrigir ocupação_timeout\ncorrigir a porcentagem da bateria e a tensão",
|
|
89
|
-
"nl": "vertaling:\nvertaling:",
|
|
90
|
-
"fr": "fix occupancy_timeout\nfixer le pourcentage de la batterie et la tension",
|
|
91
|
-
"it": "fix occupazione_timeout\ncorreggere la percentuale della batteria e la tensione",
|
|
92
|
-
"es": "arreglar ocupación_timeout\nfijar porcentaje de batería y tensión",
|
|
93
|
-
"pl": "naprawa occupancy_time\nodsetek baterii i napięcia",
|
|
94
|
-
"uk": "фіксувати occupancy_timeout\nфіксувати відсоток акумулятора і напруга",
|
|
95
|
-
"zh-cn": "fix 占用:时间假\nfix 电池百分比和火山"
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"titleLang": {
|
|
@@ -145,6 +145,9 @@
|
|
|
145
145
|
"loglevel": "info",
|
|
146
146
|
"type": "hardware",
|
|
147
147
|
"materialize": true,
|
|
148
|
+
"supportedMessages": {
|
|
149
|
+
"deviceManager": true
|
|
150
|
+
},
|
|
148
151
|
"messagebox": true,
|
|
149
152
|
"stopBeforeUpdate": true,
|
|
150
153
|
"dataFolder": "zigbee_%INSTANCE%",
|
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
const dmUtils = require('@jey-cee/dm-utils');
|
|
2
|
+
const humanizeDuration = require('humanize-duration');
|
|
3
|
+
|
|
4
|
+
class dmZigbee extends dmUtils.DeviceManagement {
|
|
5
|
+
|
|
6
|
+
async getInstanceInfo() {
|
|
7
|
+
const data = {
|
|
8
|
+
...super.getInstanceInfo(),
|
|
9
|
+
apiVersion: 'v1',
|
|
10
|
+
actions: [
|
|
11
|
+
{
|
|
12
|
+
id: 'refresh',
|
|
13
|
+
icon: 'fas fa-redo-alt',
|
|
14
|
+
title: '',
|
|
15
|
+
description: {
|
|
16
|
+
en: 'Refresh device list',
|
|
17
|
+
de: 'Geräteliste aktualisieren',
|
|
18
|
+
ru: 'Обновить список устройств',
|
|
19
|
+
pt: 'Atualizar lista de dispositivos',
|
|
20
|
+
nl: 'Vernieuw apparaatlijst',
|
|
21
|
+
fr: 'Actualiser la liste des appareils',
|
|
22
|
+
it: 'Aggiorna elenco dispositivi',
|
|
23
|
+
es: 'Actualizar lista de dispositivos',
|
|
24
|
+
pl: 'Odśwież listę urządzeń',
|
|
25
|
+
|
|
26
|
+
uk: 'Оновити список пристроїв'
|
|
27
|
+
},
|
|
28
|
+
handler: this.handleRefresh.bind(this)
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'newDevice',
|
|
32
|
+
icon: 'fas fa-plus',
|
|
33
|
+
title: '',
|
|
34
|
+
description: {
|
|
35
|
+
en: 'Add new device to Zigbee',
|
|
36
|
+
de: 'Neues Gerät zu Zigbee hinzufügen',
|
|
37
|
+
ru: 'Добавить новое устройство в Zigbee',
|
|
38
|
+
pt: 'Adicionar novo dispositivo ao Zigbee',
|
|
39
|
+
nl: 'Voeg nieuw apparaat toe aan Zigbee',
|
|
40
|
+
fr: 'Ajouter un nouvel appareil à Zigbee',
|
|
41
|
+
it: 'Aggiungi nuovo dispositivo a Zigbee',
|
|
42
|
+
es: 'Agregar nuevo dispositivo a Zigbee',
|
|
43
|
+
pl: 'Dodaj nowe urządzenie do Zigbee',
|
|
44
|
+
|
|
45
|
+
uk: 'Додати новий пристрій до Zigbee'
|
|
46
|
+
},
|
|
47
|
+
handler: this.handleNewDevice.bind(this)
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
return data;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async handleRefresh(context) {
|
|
55
|
+
this.adapter.log.info('handleRefresh');
|
|
56
|
+
return { refresh: true };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async handleNewDevice(context) {
|
|
60
|
+
this.adapter.log.info('handleNewDevice');
|
|
61
|
+
|
|
62
|
+
const res = await this.adapter.zbController.permitJoin(permitTime);
|
|
63
|
+
|
|
64
|
+
const permitTime = this.adapter.config.countDown;
|
|
65
|
+
|
|
66
|
+
const progress = await context.openProgress('Searching...', { label: '0%' });
|
|
67
|
+
await this.delay(500);
|
|
68
|
+
for (let i = 1; i <= permitTime; i += 1) {
|
|
69
|
+
await this.delay(300);
|
|
70
|
+
this.log.info(`Progress at ${i}%`);
|
|
71
|
+
await progress.update({ value: i, label: `${i}%` });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
await this.delay(1000);
|
|
75
|
+
await progress.close();
|
|
76
|
+
|
|
77
|
+
return { refresh: true };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
async listDevices() {
|
|
83
|
+
const devices = await this.adapter.getDevicesAsync();
|
|
84
|
+
const arrDevices = [];
|
|
85
|
+
for (const i in devices) {
|
|
86
|
+
const status = {};
|
|
87
|
+
|
|
88
|
+
if (devices[i].common.type == 'group') continue;
|
|
89
|
+
|
|
90
|
+
const available = await this.adapter.getStateAsync(`${devices[i]._id}.available`);
|
|
91
|
+
if(available !== null && available !== undefined) {
|
|
92
|
+
status.connection = available.val ? 'connected' : 'disconnected';
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const link_quality = await this.adapter.getStateAsync(`${devices[i]._id}.link_quality`);
|
|
96
|
+
if(link_quality) {
|
|
97
|
+
status.rssi = link_quality.val;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const battery = await this.adapter.getStateAsync(`${devices[i]._id}.battery`);
|
|
101
|
+
if(battery) {
|
|
102
|
+
status.battery = battery.val;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
let hastDetails = false;
|
|
106
|
+
// Check if device has native.Sender_ID
|
|
107
|
+
if(devices[i].native.id) {
|
|
108
|
+
hastDetails = true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const deviceInfo = await this.adapter.zbController.getDevice('0x'+devices[i].native.id);
|
|
112
|
+
|
|
113
|
+
const res = {
|
|
114
|
+
id: devices[i]._id,
|
|
115
|
+
name: devices[i].common.name,
|
|
116
|
+
icon: devices[i].common.icon ? '/adapter/zigbee/' + devices[i].common.icon : null,
|
|
117
|
+
manufacturer: `${deviceInfo._manufacturerName}` ,
|
|
118
|
+
model: `${deviceInfo._modelID}`,
|
|
119
|
+
status: status,
|
|
120
|
+
hasDetails: hastDetails,
|
|
121
|
+
actions: [
|
|
122
|
+
/* {
|
|
123
|
+
id: 'delete',
|
|
124
|
+
icon: 'fa-solid fa-trash-can',
|
|
125
|
+
description: {
|
|
126
|
+
en: 'Delete this device',
|
|
127
|
+
de: 'Gerät löschen',
|
|
128
|
+
ru: 'Удалить это устройство',
|
|
129
|
+
pt: 'Excluir este dispositivo',
|
|
130
|
+
nl: 'Verwijder dit apparaat',
|
|
131
|
+
fr: 'Supprimer cet appareil',
|
|
132
|
+
it: 'Elimina questo dispositivo',
|
|
133
|
+
es: 'Eliminar este dispositivo',
|
|
134
|
+
pl: 'Usuń to urządzenie',
|
|
135
|
+
'zh-cn': '删除此设备',
|
|
136
|
+
uk: 'Видалити цей пристрій'
|
|
137
|
+
},
|
|
138
|
+
handler: this.handleDeleteDevice.bind(this)
|
|
139
|
+
},*/
|
|
140
|
+
{
|
|
141
|
+
id: 'rename',
|
|
142
|
+
icon: 'fa-solid fa-pen',
|
|
143
|
+
description: {
|
|
144
|
+
en: 'Rename this device',
|
|
145
|
+
de: 'Gerät umbenennen',
|
|
146
|
+
ru: 'Переименовать это устройство',
|
|
147
|
+
pt: 'Renomear este dispositivo',
|
|
148
|
+
nl: 'Hernoem dit apparaat',
|
|
149
|
+
fr: 'Renommer cet appareil',
|
|
150
|
+
it: 'Rinomina questo dispositivo',
|
|
151
|
+
es: 'Renombrar este dispositivo',
|
|
152
|
+
pl: 'Zmień nazwę tego urządzenia',
|
|
153
|
+
'zh-cn': '重命名此设备',
|
|
154
|
+
uk: 'Перейменуйте цей пристрій'
|
|
155
|
+
},
|
|
156
|
+
handler: this.handleRenameDevice.bind(this)
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
};
|
|
160
|
+
// if id contains gateway remove res.actions
|
|
161
|
+
if(devices[i]._id.includes('gateway')) {
|
|
162
|
+
res.actions = [];
|
|
163
|
+
}
|
|
164
|
+
arrDevices.push(res);
|
|
165
|
+
}
|
|
166
|
+
return arrDevices;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async getDeviceDetails(id, action, context) {
|
|
170
|
+
this.adapter.log.info('getDeviceDetails');
|
|
171
|
+
const devices = await this.adapter.getDevicesAsync();
|
|
172
|
+
const device = devices.find(d => d._id === id);
|
|
173
|
+
if(!device) {
|
|
174
|
+
return {error: 'Device not found'};
|
|
175
|
+
}
|
|
176
|
+
if(!device.native.id) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const deviceInfo = await this.adapter.zbController.getDevice('0x'+ device.native.id);
|
|
181
|
+
const lastSeen = await this.formatDate(deviceInfo._lastSeen);
|
|
182
|
+
|
|
183
|
+
const items = {};
|
|
184
|
+
|
|
185
|
+
for (const devInfo in deviceInfo._endpoints[0].inputClusters) {
|
|
186
|
+
|
|
187
|
+
const val = deviceInfo._endpoints[0].inputClusters[devInfo];
|
|
188
|
+
const valType = typeof val;
|
|
189
|
+
|
|
190
|
+
if (valType != 'object') {
|
|
191
|
+
const item = {
|
|
192
|
+
['inputCluster'+devInfo]: {
|
|
193
|
+
type: 'staticText',
|
|
194
|
+
text: `inputCluster ${devInfo} : ${val}`,
|
|
195
|
+
newLine: true,
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
Object.assign(items,item);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const data = {
|
|
204
|
+
id: deviceInfo._ieeeAddr,
|
|
205
|
+
schema: {
|
|
206
|
+
type: 'tabs',
|
|
207
|
+
items: {
|
|
208
|
+
_tab_Start: {
|
|
209
|
+
type: 'panel',
|
|
210
|
+
label: 'Main',
|
|
211
|
+
|
|
212
|
+
items: {
|
|
213
|
+
header_Start: {
|
|
214
|
+
type: 'header',
|
|
215
|
+
text: `${device.common.name} ${deviceInfo._ieeeAddr}`,
|
|
216
|
+
size: 3,
|
|
217
|
+
},
|
|
218
|
+
_link: {
|
|
219
|
+
label: `Manufacturer: ${deviceInfo._manufacturerName}`,
|
|
220
|
+
type: 'staticLink',
|
|
221
|
+
href: `https://www.zigbee2mqtt.io/supported-devices/#v=${deviceInfo._manufacturerName}`,
|
|
222
|
+
button: true,
|
|
223
|
+
},
|
|
224
|
+
_link2: {
|
|
225
|
+
label: `Model : ${device.common.type}`,
|
|
226
|
+
type: 'staticLink',
|
|
227
|
+
href: `https://www.zigbee2mqtt.io/devices/${device.common.type}.html`,
|
|
228
|
+
button: true,
|
|
229
|
+
},
|
|
230
|
+
_softwareBuildID: {
|
|
231
|
+
type: 'staticText',
|
|
232
|
+
text: `<b>Software Build Id:</b> ${deviceInfo._softwareBuildID}`,
|
|
233
|
+
style: {
|
|
234
|
+
fontSize: 14
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
_divider2: {
|
|
239
|
+
type: 'divider',
|
|
240
|
+
color: 'primary',
|
|
241
|
+
},
|
|
242
|
+
_interviewCompleted: {
|
|
243
|
+
type: 'checkbox',
|
|
244
|
+
label: `Interview completed`,
|
|
245
|
+
checked: deviceInfo._interviewCompleted == 1 ? 'true' : 'false',
|
|
246
|
+
disabled: 'true',
|
|
247
|
+
newLine: true,
|
|
248
|
+
},
|
|
249
|
+
_configure: {
|
|
250
|
+
type: 'checkbox',
|
|
251
|
+
label: 'is Configured',
|
|
252
|
+
help: 'if it possible',
|
|
253
|
+
checked: deviceInfo.meta.configured == 1 ? 'true' : 'false',
|
|
254
|
+
disabled: 'true',
|
|
255
|
+
},
|
|
256
|
+
_lastSeen: {
|
|
257
|
+
type: 'staticText',
|
|
258
|
+
text: `<b>Last seen:</b> ${lastSeen}`,
|
|
259
|
+
},
|
|
260
|
+
_manufacturerID: {
|
|
261
|
+
type: 'staticText',
|
|
262
|
+
text: `<b>Manufacturer Id:</b> ${deviceInfo._manufacturerID}`,
|
|
263
|
+
newLine: true,
|
|
264
|
+
},
|
|
265
|
+
_network: {
|
|
266
|
+
type: 'staticText',
|
|
267
|
+
text: `<b>Network address:</b> 0x${deviceInfo._networkAddress}`,
|
|
268
|
+
},
|
|
269
|
+
_type: {
|
|
270
|
+
type: 'staticText',
|
|
271
|
+
text: `<b>Device Type:</b> ${deviceInfo._type}`,
|
|
272
|
+
},
|
|
273
|
+
_powered: {
|
|
274
|
+
type: 'staticText',
|
|
275
|
+
text: deviceInfo._powerSource ? `<b>Power:</b> ${deviceInfo._powerSource.toUpperCase()}` : ``,
|
|
276
|
+
},
|
|
277
|
+
_maxListeners: {
|
|
278
|
+
type: 'staticText',
|
|
279
|
+
text: `<b>max Listeners:</b> ${deviceInfo._maxListeners}`,
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
_tab_Details: {
|
|
284
|
+
type: 'panel',
|
|
285
|
+
label: 'Details',
|
|
286
|
+
items,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
return data;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
async handleDeleteDevice(id, context) {
|
|
296
|
+
const devId = id.replace(/zigbee\.\d\./, '');
|
|
297
|
+
const deviceInfo = await this.adapter.zbController.getDevice('0x'+ devId);
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
const response = await context.showConfirmation({
|
|
301
|
+
en: `Do you really want to delete the device ${deviceInfo._ieeeAddr}?`,
|
|
302
|
+
de: `Möchten Sie das Gerät ${deviceInfo._ieeeAddr} wirklich löschen?`,
|
|
303
|
+
ru: `Вы действительно хотите удалить устройство ${deviceInfo._ieeeAddr}?`,
|
|
304
|
+
pt: `Você realmente deseja excluir o dispositivo ${deviceInfo._ieeeAddr}?`,
|
|
305
|
+
nl: `Weet u zeker dat u het apparaat ${deviceInfo._ieeeAddr} wilt verwijderen?`,
|
|
306
|
+
fr: `Voulez-vous vraiment supprimer l'appareil ${deviceInfo._ieeeAddr} ?`,
|
|
307
|
+
it: `Vuoi davvero eliminare il dispositivo ${deviceInfo._ieeeAddr}?`,
|
|
308
|
+
es: `¿Realmente desea eliminar el dispositivo ${deviceInfo._ieeeAddr}?`,
|
|
309
|
+
pl: `Czy na pewno chcesz usunąć urządzenie ${deviceInfo._ieeeAddr}?`,
|
|
310
|
+
'zh-cn': `您真的要删除设备 ${deviceInfo._ieeeAddr} 吗?`,
|
|
311
|
+
uk: `Ви дійсно бажаєте видалити пристрій ${deviceInfo._ieeeAddr}?`
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
// delete device
|
|
316
|
+
if(response === false) {
|
|
317
|
+
return {refresh: false};
|
|
318
|
+
}
|
|
319
|
+
const res = await this.adapter.leaveDevice('0x'+ devId);
|
|
320
|
+
|
|
321
|
+
if (res !== null) {
|
|
322
|
+
this.adapter.log.info(`${devId} deleted`);
|
|
323
|
+
return {refresh: true};
|
|
324
|
+
} else {
|
|
325
|
+
this.adapter.log.error(`Can not delete device ${devId}: ${JSON.stringify(res)}`);
|
|
326
|
+
return {refresh: false};
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
async handleRenameDevice(id, context) {
|
|
331
|
+
const result = await context.showForm({
|
|
332
|
+
type : 'panel',
|
|
333
|
+
items: {
|
|
334
|
+
newName: {
|
|
335
|
+
type: 'text',
|
|
336
|
+
trim: false,
|
|
337
|
+
placeholder: '',
|
|
338
|
+
}
|
|
339
|
+
}}, {
|
|
340
|
+
data: {
|
|
341
|
+
newName: ''
|
|
342
|
+
},
|
|
343
|
+
title: {
|
|
344
|
+
en: 'Enter new name',
|
|
345
|
+
de: 'Neuen Namen eingeben',
|
|
346
|
+
ru: 'Введите новое имя',
|
|
347
|
+
pt: 'Digite um novo nome',
|
|
348
|
+
nl: 'Voer een nieuwe naam in',
|
|
349
|
+
fr: 'Entrez un nouveau nom',
|
|
350
|
+
it: 'Inserisci un nuovo nome',
|
|
351
|
+
es: 'Ingrese un nuevo nombre',
|
|
352
|
+
pl: 'Wpisz nowe imię',
|
|
353
|
+
'zh-cn': '输入新名称',
|
|
354
|
+
uk: 'Введіть нове ім\'я'
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
if (result == undefined || result.newName == '') {
|
|
358
|
+
return {refresh: false};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const obj = {
|
|
362
|
+
common: {
|
|
363
|
+
name: result.newName
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
const res = await this.adapter.extendObjectAsync(id, obj);
|
|
367
|
+
this.adapter.log.info(JSON.stringify(res));
|
|
368
|
+
if (res === null) {
|
|
369
|
+
this.adapter.log.warn(`Can not rename device ${context.id}: ${JSON.stringify(res)}`);
|
|
370
|
+
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return {refresh: true};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
async formatDate(time, type) { //'ISO_8601' | 'ISO_8601_local' | 'epoch' | 'relative'
|
|
377
|
+
if (type === 'ISO_8601') return new Date(time).toISOString();
|
|
378
|
+
else if (type === 'ISO_8601_local') return this.toLocalISOString(new Date(time));
|
|
379
|
+
else if (type === 'epoch') return time;
|
|
380
|
+
else { // relative
|
|
381
|
+
const ago = humanizeDuration(Date.now() - time, {language: 'en', largest: 2, round: true}) + ' ago';
|
|
382
|
+
return ago;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
toLocalISOString(d) {
|
|
387
|
+
const off = d.getTimezoneOffset();
|
|
388
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes() - off, d.getSeconds(), d.getMilliseconds()).toISOString();
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
module.exports = dmZigbee;
|
package/main.js
CHANGED
|
@@ -33,6 +33,7 @@ const ExcludePlugin = require('./lib/exclude');
|
|
|
33
33
|
const zigbeeHerdsmanConverters = require('zigbee-herdsman-converters');
|
|
34
34
|
const vm = require('vm');
|
|
35
35
|
const util = require('util');
|
|
36
|
+
const dmZigbee = require('./lib/devicemgmt.js');
|
|
36
37
|
|
|
37
38
|
const createByteArray = function (hexString) {
|
|
38
39
|
const bytes = [];
|
|
@@ -73,6 +74,9 @@ class Zigbee extends utils.Adapter {
|
|
|
73
74
|
this.stController = new StatesController(this);
|
|
74
75
|
this.stController.on('log', this.onLog.bind(this));
|
|
75
76
|
this.stController.on('changed', this.publishFromState.bind(this));
|
|
77
|
+
|
|
78
|
+
this.deviceManagement = new dmZigbee(this);
|
|
79
|
+
|
|
76
80
|
this.plugins = [
|
|
77
81
|
new SerialListPlugin(this),
|
|
78
82
|
new CommandsPlugin(this),
|
|
@@ -693,6 +697,7 @@ class Zigbee extends utils.Adapter {
|
|
|
693
697
|
|
|
694
698
|
const preparedValue = (stateDesc.setter) ? stateDesc.setter(value, options) : value;
|
|
695
699
|
const preparedOptions = (stateDesc.setterOpt) ? stateDesc.setterOpt(value, options) : {};
|
|
700
|
+
|
|
696
701
|
let syncStateList = [];
|
|
697
702
|
if (stateModel && stateModel.syncStates) {
|
|
698
703
|
stateModel.syncStates.forEach(syncFunct => {
|
|
@@ -727,6 +732,13 @@ class Zigbee extends utils.Adapter {
|
|
|
727
732
|
state: {},
|
|
728
733
|
};
|
|
729
734
|
|
|
735
|
+
// new toZigbee
|
|
736
|
+
if (typeof preparedValue === 'number') {
|
|
737
|
+
meta.message.state = preparedValue > 0 ? 'ON' : 'OFF';
|
|
738
|
+
} else {
|
|
739
|
+
meta.message.state = preparedValue;
|
|
740
|
+
}
|
|
741
|
+
|
|
730
742
|
if (preparedOptions.hasOwnProperty('state')) {
|
|
731
743
|
meta.state = preparedOptions.state;
|
|
732
744
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.zigbee",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Kirov Ilya",
|
|
6
6
|
"email": "kirovilya@gmail.com"
|
|
@@ -22,15 +22,17 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@iobroker/adapter-core": "^3.0.4",
|
|
25
|
+
"@jey-cee/dm-utils": "^0.0.5",
|
|
26
|
+
"humanize-duration": "^3.31.0",
|
|
25
27
|
"tar": "^6.2.0",
|
|
26
|
-
"typescript": "^5.3.
|
|
27
|
-
"zigbee-herdsman": "0.
|
|
28
|
-
"zigbee-herdsman-converters": "16.
|
|
28
|
+
"typescript": "^5.3.3",
|
|
29
|
+
"zigbee-herdsman": "0.27.1",
|
|
30
|
+
"zigbee-herdsman-converters": "16.16.0"
|
|
29
31
|
},
|
|
30
32
|
"description": "Zigbee devices",
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"@alcalzone/release-script": "^3.
|
|
33
|
-
"@alcalzone/release-script-plugin-iobroker": "^3.
|
|
34
|
+
"@alcalzone/release-script": "^3.7.0",
|
|
35
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.7.0",
|
|
34
36
|
"@alcalzone/release-script-plugin-license": "^3.7.0",
|
|
35
37
|
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
|
|
36
38
|
"@iobroker/testing": "^4.1.0",
|