iobroker.hm-rpc 1.15.6 → 1.15.7
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 +3 -0
- package/build/main.js +25 -56
- package/io-package.json +13 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,6 +152,9 @@ via or/and operator. The then clause of the program can remain empty. Now your s
|
|
|
152
152
|
Placeholder for the next version (at the beginning of the line):
|
|
153
153
|
### __WORK IN PROGRESS__
|
|
154
154
|
-->
|
|
155
|
+
### 1.15.7 (2022-02-20)
|
|
156
|
+
* (foxriver76) fixed new devices beeing created as `undefined`
|
|
157
|
+
|
|
155
158
|
### 1.15.6 (2022-02-16)
|
|
156
159
|
* (foxriver76) implemented workaround for the RSSI_DEVICE 128 bug if devices connect to HMIP-HAP (fixes #346, #469, #402)
|
|
157
160
|
|
package/build/main.js
CHANGED
|
@@ -20,7 +20,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
/*
|
|
23
|
-
* Copyright (c) 2014-
|
|
23
|
+
* Copyright (c) 2014-2022 bluefox <dogafox@gmail.com>
|
|
24
24
|
*
|
|
25
25
|
* Copyright (c) 2014 hobbyquaker
|
|
26
26
|
*
|
|
@@ -399,9 +399,9 @@ async function readSettings(id) {
|
|
|
399
399
|
await Promise.all(promises);
|
|
400
400
|
controlEPaper(id, data);
|
|
401
401
|
} // endReadSettings
|
|
402
|
-
function startAdapter(options) {
|
|
403
|
-
options =
|
|
404
|
-
|
|
402
|
+
function startAdapter(options = {}) {
|
|
403
|
+
options = {
|
|
404
|
+
...options,
|
|
405
405
|
name: 'hm-rpc',
|
|
406
406
|
error: (e) => {
|
|
407
407
|
if (e.code === 'EADDRNOTAVAIL') {
|
|
@@ -481,15 +481,12 @@ function startAdapter(options) {
|
|
|
481
481
|
}
|
|
482
482
|
else if (tmp[4] === 'DISPLAY_DATA_STRING') {
|
|
483
483
|
// new EPAPER HMIP-WRCD has own states but needs to encode special chars by DIN_66003
|
|
484
|
-
|
|
485
|
-
val = tools.replaceSpecialChars(state.val || '');
|
|
484
|
+
val = tools.replaceSpecialChars(state.val ? state.val.toString() : '');
|
|
486
485
|
adapter.log.debug(`Encoded ${state.val} to ${val}`);
|
|
487
|
-
/** @ts-expect-error todo */
|
|
488
486
|
}
|
|
489
|
-
else if (tmp[4] === 'COMBINED_PARAMETER' && /DDS=.+,/g.test(state.val)) {
|
|
487
|
+
else if (tmp[4] === 'COMBINED_PARAMETER' && state.val && /DDS=.+,/g.test(state.val.toString())) {
|
|
490
488
|
// new EPAPER and DISPLAY_DATA_STRING is given, we need to replace
|
|
491
|
-
let text = state.val;
|
|
492
|
-
/** @ts-expect-error types needed */
|
|
489
|
+
let text = state.val.toString();
|
|
493
490
|
for (const line of text.split(/},(\s+)?{/g)) {
|
|
494
491
|
if (line === undefined) {
|
|
495
492
|
continue;
|
|
@@ -499,7 +496,6 @@ function startAdapter(options) {
|
|
|
499
496
|
const origText = line.slice(start, end);
|
|
500
497
|
const replacedText = tools.replaceSpecialChars(origText);
|
|
501
498
|
const lineReplaced = line.replace(`DDS=${origText}`, `DDS=${replacedText}`);
|
|
502
|
-
/** @ts-expect-error todo */
|
|
503
499
|
text = text.replace(line, lineReplaced);
|
|
504
500
|
} // endFor
|
|
505
501
|
val = text;
|
|
@@ -535,12 +531,11 @@ function startAdapter(options) {
|
|
|
535
531
|
adapter.log.error(`Cannot call setValue: ${e.message}`);
|
|
536
532
|
}
|
|
537
533
|
},
|
|
538
|
-
// Add messagebox Function for ioBroker.occ
|
|
539
534
|
message: async (obj) => {
|
|
540
535
|
adapter.log.debug(`[MSSG] Received: ${JSON.stringify(obj)}`);
|
|
541
536
|
if (obj.command === undefined ||
|
|
542
537
|
obj.command === null ||
|
|
543
|
-
obj.message
|
|
538
|
+
typeof obj.message !== 'object' ||
|
|
544
539
|
obj.message === null) {
|
|
545
540
|
adapter.log.warn(`Received invalid command via message "${obj.command}" "${JSON.stringify(obj.message)}" from ${obj.from}`);
|
|
546
541
|
if (obj.callback) {
|
|
@@ -548,14 +543,11 @@ function startAdapter(options) {
|
|
|
548
543
|
}
|
|
549
544
|
return;
|
|
550
545
|
}
|
|
551
|
-
/** @ts-expect-error types needed */
|
|
552
546
|
if (obj.message.params === undefined || obj.message.params === null) {
|
|
553
547
|
try {
|
|
554
548
|
if (rpcClient && connected) {
|
|
555
549
|
// if device specific command, send it's ID and paramType
|
|
556
|
-
const data = await rpcMethodCallAsync(obj.command,
|
|
557
|
-
/** @ts-expect-error types needed */
|
|
558
|
-
obj.message.ID !== undefined ? [obj.message.ID, obj.message.paramType] : []);
|
|
550
|
+
const data = await rpcMethodCallAsync(obj.command, obj.message.ID !== undefined ? [obj.message.ID, obj.message.paramType] : []);
|
|
559
551
|
if (obj.callback) {
|
|
560
552
|
adapter.sendTo(obj.from, obj.command, {
|
|
561
553
|
result: data,
|
|
@@ -564,7 +556,6 @@ function startAdapter(options) {
|
|
|
564
556
|
}
|
|
565
557
|
}
|
|
566
558
|
else {
|
|
567
|
-
/** @ts-expect-error types needed */
|
|
568
559
|
adapter.log.warn(`Cannot send "${obj.command}" "${obj.message.ID}": because not connected`);
|
|
569
560
|
if (obj.callback) {
|
|
570
561
|
adapter.sendTo(obj.from, obj.command, { error: 'not connected' }, obj.callback);
|
|
@@ -580,11 +571,8 @@ function startAdapter(options) {
|
|
|
580
571
|
try {
|
|
581
572
|
if (rpcClient && connected) {
|
|
582
573
|
const data = await rpcMethodCallAsync(obj.command, [
|
|
583
|
-
/** @ts-expect-error types needed */
|
|
584
574
|
obj.message.ID,
|
|
585
|
-
/** @ts-expect-error types needed */
|
|
586
575
|
obj.message.paramType,
|
|
587
|
-
/** @ts-expect-error types needed */
|
|
588
576
|
obj.message.params
|
|
589
577
|
]);
|
|
590
578
|
if (obj.callback) {
|
|
@@ -595,7 +583,6 @@ function startAdapter(options) {
|
|
|
595
583
|
}
|
|
596
584
|
}
|
|
597
585
|
else {
|
|
598
|
-
/** @ts-expect-error types needed */
|
|
599
586
|
adapter.log.warn(`Cannot send "${obj.command}" "${obj.message.ID}": because not connected`);
|
|
600
587
|
if (obj.callback) {
|
|
601
588
|
adapter.sendTo(obj.from, obj.command, { error: 'not connected' }, obj.callback);
|
|
@@ -689,8 +676,8 @@ function startAdapter(options) {
|
|
|
689
676
|
callback = null;
|
|
690
677
|
}
|
|
691
678
|
}
|
|
692
|
-
}
|
|
693
|
-
/** @ts-expect-error
|
|
679
|
+
};
|
|
680
|
+
/** @ts-expect-error fix it */
|
|
694
681
|
adapter = new utils.Adapter(options);
|
|
695
682
|
return adapter;
|
|
696
683
|
}
|
|
@@ -931,7 +918,7 @@ async function initRpcServer() {
|
|
|
931
918
|
clientId = adapter.namespace;
|
|
932
919
|
try {
|
|
933
920
|
const obj = await adapter.getForeignObjectAsync(`system.adapter.${adapter.namespace}`);
|
|
934
|
-
/** @ts-expect-error
|
|
921
|
+
/** @ts-expect-error bug already reported */
|
|
935
922
|
clientId = `${(_a = obj === null || obj === void 0 ? void 0 : obj.common) === null || _a === void 0 ? void 0 : _a.host}:${clientId}`;
|
|
936
923
|
}
|
|
937
924
|
catch (e) {
|
|
@@ -986,7 +973,7 @@ async function initRpcServer() {
|
|
|
986
973
|
});
|
|
987
974
|
rpcServer.on('system.listMethods', (err, params, callback) => {
|
|
988
975
|
if (err) {
|
|
989
|
-
adapter.log.warn(`
|
|
976
|
+
adapter.log.warn(`Error on system.listMethods: ${err}`);
|
|
990
977
|
}
|
|
991
978
|
adapter.log.info(`${adapter.config.type}rpc <- system.listMethods ${JSON.stringify(params)}`);
|
|
992
979
|
callback(null, [
|
|
@@ -1041,8 +1028,8 @@ async function initRpcServer() {
|
|
|
1041
1028
|
continue;
|
|
1042
1029
|
}
|
|
1043
1030
|
// lets get the device description
|
|
1031
|
+
/** @ts-expect-error bug reported */
|
|
1044
1032
|
const val = row.value;
|
|
1045
|
-
/** @ts-expect-error types needed */
|
|
1046
1033
|
if (typeof val.ADDRESS === 'undefined') {
|
|
1047
1034
|
continue;
|
|
1048
1035
|
}
|
|
@@ -1050,7 +1037,6 @@ async function initRpcServer() {
|
|
|
1050
1037
|
// and if it doesn't exist we can delete it
|
|
1051
1038
|
let index = -1;
|
|
1052
1039
|
for (let j = 0; j < newDevices.length; j++) {
|
|
1053
|
-
/** @ts-expect-error types needed */
|
|
1054
1040
|
if (newDevices[j].ADDRESS === val.ADDRESS && newDevices[j].VERSION === val.VERSION) {
|
|
1055
1041
|
index = j;
|
|
1056
1042
|
break;
|
|
@@ -1059,11 +1045,8 @@ async function initRpcServer() {
|
|
|
1059
1045
|
// if index is -1 than the newDevices doesn't have the
|
|
1060
1046
|
// device with address val.ADDRESS anymore, thus we can delete it
|
|
1061
1047
|
if (index === -1) {
|
|
1062
|
-
/** @ts-expect-error types needed */
|
|
1063
1048
|
if (val.ADDRESS && !adapter.config.dontDelete) {
|
|
1064
|
-
|
|
1065
|
-
if (val.ADDRESS.indexOf(':') !== -1) {
|
|
1066
|
-
/** @ts-expect-error types needed */
|
|
1049
|
+
if (val.ADDRESS.includes(':')) {
|
|
1067
1050
|
const address = val.ADDRESS.replace(':', '.').replace(adapter.FORBIDDEN_CHARS, '_');
|
|
1068
1051
|
const parts = address.split('.');
|
|
1069
1052
|
try {
|
|
@@ -1076,13 +1059,10 @@ async function initRpcServer() {
|
|
|
1076
1059
|
}
|
|
1077
1060
|
else {
|
|
1078
1061
|
try {
|
|
1079
|
-
/** @ts-expect-error types needed */
|
|
1080
1062
|
await adapter.deleteDeviceAsync(val.ADDRESS);
|
|
1081
|
-
/** @ts-expect-error types needed */
|
|
1082
1063
|
adapter.log.info(`obsolete device ${val.ADDRESS} deleted`);
|
|
1083
1064
|
}
|
|
1084
1065
|
catch (e) {
|
|
1085
|
-
/** @ts-expect-error types needed */
|
|
1086
1066
|
adapter.log.error(`Could not delete obsolete device ${val.ADDRESS}: ${e.message}`);
|
|
1087
1067
|
}
|
|
1088
1068
|
}
|
|
@@ -1127,10 +1107,9 @@ async function initRpcServer() {
|
|
|
1127
1107
|
if (row.id === `${adapter.namespace}.updated`) {
|
|
1128
1108
|
continue;
|
|
1129
1109
|
}
|
|
1110
|
+
/** @ts-expect-error bug reported */
|
|
1130
1111
|
const val = row.value;
|
|
1131
|
-
/** @ts-expect-error types needed */
|
|
1132
1112
|
if (val.ADDRESS) {
|
|
1133
|
-
/** @ts-expect-error types needed */
|
|
1134
1113
|
response.push({ ADDRESS: val.ADDRESS, VERSION: val.VERSION });
|
|
1135
1114
|
}
|
|
1136
1115
|
}
|
|
@@ -1194,7 +1173,6 @@ async function initRpcServer() {
|
|
|
1194
1173
|
* @param paramset - paramset object retrived by CCU
|
|
1195
1174
|
*/
|
|
1196
1175
|
async function addParamsetObjects(channel, paramset) {
|
|
1197
|
-
adapter.log.warn(JSON.stringify(paramset));
|
|
1198
1176
|
for (const [key, paramObj] of Object.entries(paramset)) {
|
|
1199
1177
|
const commonType = {
|
|
1200
1178
|
ACTION: 'boolean',
|
|
@@ -1239,11 +1217,10 @@ async function addParamsetObjects(channel, paramset) {
|
|
|
1239
1217
|
}
|
|
1240
1218
|
} // endIf
|
|
1241
1219
|
if (paramObj.SPECIAL) {
|
|
1242
|
-
if (
|
|
1220
|
+
if (typeof obj.common.states !== 'object') {
|
|
1243
1221
|
obj.common.states = {};
|
|
1244
1222
|
}
|
|
1245
1223
|
for (let i = 0; i < paramObj.SPECIAL.length; i++) {
|
|
1246
|
-
/** @ts-expect-error types needed */
|
|
1247
1224
|
obj.common.states[paramObj.SPECIAL[i].VALUE] = paramObj.SPECIAL[i].ID;
|
|
1248
1225
|
}
|
|
1249
1226
|
} // endIf
|
|
@@ -1566,8 +1543,9 @@ async function createDevices(deviceArr) {
|
|
|
1566
1543
|
}
|
|
1567
1544
|
icon = images_1.images[device.TYPE] ? `/icons/${images_1.images[device.TYPE]}` : '';
|
|
1568
1545
|
}
|
|
1546
|
+
const id = device.ADDRESS.replace(':', '.').replace(adapter.FORBIDDEN_CHARS, '_');
|
|
1569
1547
|
const obj = {
|
|
1570
|
-
_id:
|
|
1548
|
+
_id: id,
|
|
1571
1549
|
type: type,
|
|
1572
1550
|
common: {
|
|
1573
1551
|
name: device.ADDRESS,
|
|
@@ -1594,18 +1572,15 @@ async function createDevices(deviceArr) {
|
|
|
1594
1572
|
dpTypes[dpID].MAX = 100;
|
|
1595
1573
|
}
|
|
1596
1574
|
}
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
/** @ts-expect-error types needed */
|
|
1600
|
-
obj.common.role = roles_1.metaRoles.dvTYPE[obj.native.PARENT_TYPE];
|
|
1575
|
+
if (roles_1.metaRoles.dvTYPE && obj.native && roles_1.metaRoles.dvTYPE[device.PARENT_TYPE]) {
|
|
1576
|
+
obj.common.role = roles_1.metaRoles.dvTYPE[device.PARENT_TYPE];
|
|
1601
1577
|
}
|
|
1602
1578
|
try {
|
|
1603
|
-
|
|
1604
|
-
const res = await adapter.setObjectAsync(obj._id, obj);
|
|
1579
|
+
const res = await adapter.setObjectAsync(id, obj);
|
|
1605
1580
|
adapter.log.debug(`object ${res.id} created`);
|
|
1606
1581
|
}
|
|
1607
1582
|
catch (e) {
|
|
1608
|
-
adapter.log.error(`object ${
|
|
1583
|
+
adapter.log.error(`object ${id} error on creation: ${e.message}`);
|
|
1609
1584
|
}
|
|
1610
1585
|
if (obj.type === 'channel') {
|
|
1611
1586
|
queueValueParamsets.push(obj);
|
|
@@ -1645,8 +1620,8 @@ async function getCuxDevices() {
|
|
|
1645
1620
|
continue;
|
|
1646
1621
|
}
|
|
1647
1622
|
// lets get the device description
|
|
1623
|
+
/** @ts-expect-error bug reported */
|
|
1648
1624
|
const val = row.value;
|
|
1649
|
-
/** @ts-expect-error types needed */
|
|
1650
1625
|
if (typeof val.ADDRESS === 'undefined') {
|
|
1651
1626
|
continue;
|
|
1652
1627
|
}
|
|
@@ -1654,7 +1629,6 @@ async function getCuxDevices() {
|
|
|
1654
1629
|
// and if it doesn't exist we can delete it
|
|
1655
1630
|
let index = -1;
|
|
1656
1631
|
for (let j = 0; j < newDevices.length; j++) {
|
|
1657
|
-
/** @ts-expect-error types needed */
|
|
1658
1632
|
if (newDevices[j].ADDRESS === val.ADDRESS && newDevices[j].VERSION === val.VERSION) {
|
|
1659
1633
|
index = j;
|
|
1660
1634
|
break;
|
|
@@ -1663,20 +1637,15 @@ async function getCuxDevices() {
|
|
|
1663
1637
|
// if index is -1 than the newDevices doesn't have the
|
|
1664
1638
|
// device with address val.ADDRESS anymore, thus we can delete it
|
|
1665
1639
|
if (index === -1) {
|
|
1666
|
-
/** @ts-expect-error types needed */
|
|
1667
1640
|
if (val.ADDRESS && !adapter.config.dontDelete) {
|
|
1668
|
-
|
|
1669
|
-
if (val.ADDRESS.indexOf(':') !== -1) {
|
|
1670
|
-
/** @ts-expect-error types needed */
|
|
1641
|
+
if (val.ADDRESS.includes(':')) {
|
|
1671
1642
|
const address = val.ADDRESS.replace(':', '.').replace(adapter.FORBIDDEN_CHARS, '_');
|
|
1672
1643
|
const parts = address.split('.');
|
|
1673
1644
|
adapter.deleteChannel(parts[parts.length - 2], parts[parts.length - 1]);
|
|
1674
1645
|
adapter.log.info(`obsolete channel ${address} ${JSON.stringify(address)} deleted`);
|
|
1675
1646
|
}
|
|
1676
1647
|
else {
|
|
1677
|
-
/** @ts-expect-error types needed */
|
|
1678
1648
|
adapter.deleteDevice(val.ADDRESS);
|
|
1679
|
-
/** @ts-expect-error types needed */
|
|
1680
1649
|
adapter.log.info(`obsolete device ${val.ADDRESS} deleted`);
|
|
1681
1650
|
}
|
|
1682
1651
|
}
|
package/io-package.json
CHANGED
|
@@ -14,8 +14,20 @@
|
|
|
14
14
|
"pl": "Łączy procesy HomeMatic-Interface (BidCos-Services, Homegear i CUxD) za pośrednictwem XML-RPC lub BIN-RPC z ioBroker",
|
|
15
15
|
"zh-cn": "通过 XML-RPC 或 BIN-RPC 将 HomeMatic 接口进程(BidCos-Services、Homegear 和 CUxD)连接到 ioBroker"
|
|
16
16
|
},
|
|
17
|
-
"version": "1.15.
|
|
17
|
+
"version": "1.15.7",
|
|
18
18
|
"news": {
|
|
19
|
+
"1.15.7": {
|
|
20
|
+
"en": "fixed new devices beeing created as `undefined`",
|
|
21
|
+
"de": "Behoben, dass neue Geräte als „undefiniert“ erstellt wurden",
|
|
22
|
+
"ru": "исправлено создание новых устройств как `undefined`",
|
|
23
|
+
"pt": "corrigidos novos dispositivos sendo criados como 'indefinidos'",
|
|
24
|
+
"nl": "vaste nieuwe apparaten die zijn gemaakt als `undefined`",
|
|
25
|
+
"fr": "correction de nouveaux appareils créés comme \"indéfinis\"",
|
|
26
|
+
"it": "corretto il problema con la creazione di nuovi dispositivi come \"non definiti\".",
|
|
27
|
+
"es": "Se corrigieron nuevos dispositivos creados como `indefinidos`",
|
|
28
|
+
"pl": "naprawiono nowe urządzenia tworzone jako `undefined`",
|
|
29
|
+
"zh-cn": "修复了创建为“未定义”的新设备"
|
|
30
|
+
},
|
|
19
31
|
"1.15.6": {
|
|
20
32
|
"en": "implemented workaround for the RSSI_DEVICE 128 bug if devices connect to HMIP-HAP (fixes #346, #469, #402)",
|
|
21
33
|
"de": "Workaround für den Fehler RSSI_DEVICE 128 implementiert, wenn sich Geräte mit HMIP-HAP verbinden (Fixes Nr. 346, Nr. 469, Nr. 402)",
|
|
@@ -87,18 +99,6 @@
|
|
|
87
99
|
"es": "fijamos el tipo de valor predeterminado y min/max de grupos de calefacción (cierra #443)",
|
|
88
100
|
"pl": "ustaliliśmy typ wartości domyślnej oraz min/max grup grzewczych (zamyka #443)",
|
|
89
101
|
"zh-cn": "我们固定了默认值的类型和加热组的最小值/最大值(关闭 #443)"
|
|
90
|
-
},
|
|
91
|
-
"1.15.0": {
|
|
92
|
-
"en": "added image for `HmIP-STE2-PCB`\nwe now handle `replaceDevice` requests by deleting old device and creating new one (closes #420)",
|
|
93
|
-
"de": "Bild hinzugefügt für `HmIP-STE2-PCB`\nWir verarbeiten jetzt `replaceDevice`-Anfragen, indem wir das alte Gerät löschen und ein neues erstellen (schließt #420)",
|
|
94
|
-
"ru": "добавлен образ для `HmIP-STE2-PCB`\nТеперь мы обрабатываем запросы replaceDevice, удаляя старое устройство и создавая новое (закрывает # 420)",
|
|
95
|
-
"pt": "adicionada imagem para `HmIP-STE2-PCB`\nagora lidamos com solicitações `replaceDevice` excluindo o dispositivo antigo e criando um novo (fecha # 420)",
|
|
96
|
-
"nl": "afbeelding toegevoegd voor `HmIP-STE2-PCB`\nwe behandelen nu `replaceDevice`-verzoeken door het oude apparaat te verwijderen en een nieuw te maken (sluit #420)",
|
|
97
|
-
"fr": "image ajoutée pour `HmIP-STE2-PCB`\nnous gérons maintenant les requêtes `replaceDevice` en supprimant l'ancien appareil et en en créant un nouveau (ferme le #420)",
|
|
98
|
-
"it": "aggiunta immagine per `HmIP-STE2-PCB`\nora gestiamo le richieste `replaceDevice` eliminando il vecchio dispositivo e creandone uno nuovo (chiude #420)",
|
|
99
|
-
"es": "imagen agregada para `HmIP-STE2-PCB`\nahora manejamos las solicitudes de `replaceDevice` eliminando el dispositivo antiguo y creando uno nuevo (cierra # 420)",
|
|
100
|
-
"pl": "dodany obraz dla `HmIP-STE2-PCB`\nteraz obsługujemy żądania `replaceDevice`, usuwając stare urządzenie i tworząc nowe (zamyka #420)",
|
|
101
|
-
"zh-cn": "添加了“HmIP-STE2-PCB”的图片\n我们现在通过删除旧设备并创建新设备来处理 `replaceDevice` 请求(关闭 #420)"
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"authors": [
|
package/package.json
CHANGED