iobroker.hm-rpc 1.15.7 → 1.15.8

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 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.8 (2022-02-23)
156
+ * (foxriver76) we now ensure, that the `uuid` used for connection is really unique
157
+
155
158
  ### 1.15.7 (2022-02-20)
156
159
  * (foxriver76) fixed new devices beeing created as `undefined`
157
160
 
package/build/main.js CHANGED
@@ -48,6 +48,7 @@ const utils = __importStar(require("@iobroker/adapter-core"));
48
48
  const images_1 = require("./lib/images");
49
49
  const tools = __importStar(require("./lib/tools"));
50
50
  const roles_1 = require("./lib/roles");
51
+ const crypto_1 = require("crypto");
51
52
  let connected = false;
52
53
  const displays = {};
53
54
  let adapter;
@@ -400,7 +401,7 @@ async function readSettings(id) {
400
401
  controlEPaper(id, data);
401
402
  } // endReadSettings
402
403
  function startAdapter(options = {}) {
403
- options = {
404
+ adapter = new utils.Adapter({
404
405
  ...options,
405
406
  name: 'hm-rpc',
406
407
  error: (e) => {
@@ -676,9 +677,7 @@ function startAdapter(options = {}) {
676
677
  callback = null;
677
678
  }
678
679
  }
679
- };
680
- /** @ts-expect-error fix it */
681
- adapter = new utils.Adapter(options);
680
+ });
682
681
  return adapter;
683
682
  }
684
683
  /**
@@ -749,18 +748,11 @@ async function main() {
749
748
  else {
750
749
  dpTypes[row.id] = {
751
750
  UNIT: obj.native.UNIT,
752
- TYPE: obj.native.TYPE,
753
- MIN: obj.native.MIN,
754
- MAX: obj.native.MAX
751
+ TYPE: obj.native.TYPE
755
752
  };
756
- if (typeof dpTypes[row.id].MIN === 'number') {
757
- dpTypes[row.id].MIN = parseFloat(dpTypes[row.id].MIN);
758
- dpTypes[row.id].MAX = parseFloat(dpTypes[row.id].MAX);
759
- /*
760
- if (dpTypes[row.id].UNIT === '100%') {
761
- dpTypes[row.id].UNIT = '%';
762
- }
763
- */
753
+ if (typeof obj.native.MIN === 'number') {
754
+ dpTypes[row.id].MIN = obj.native.MIN;
755
+ dpTypes[row.id].MAX = obj.native.MAX;
764
756
  if (dpTypes[row.id].MAX === 99) {
765
757
  dpTypes[row.id].MAX = 100;
766
758
  }
@@ -858,7 +850,7 @@ const methods = {
858
850
  adapter.log.debug(`${adapter.config.type}rpc <- event ${JSON.stringify(params)}`);
859
851
  let val;
860
852
  // CUxD ignores all prefixes!!
861
- if (params[0] === 'CUxD' || params[0].indexOf(adapter.name) === -1) {
853
+ if (params[0] === 'CUxD' || !params[0].includes(adapter.name)) {
862
854
  params[0] = adapter.namespace;
863
855
  }
864
856
  const channel = params[1].replace(':', '.').replace(adapter.FORBIDDEN_CHARS, '_');
@@ -918,12 +910,12 @@ async function initRpcServer() {
918
910
  clientId = adapter.namespace;
919
911
  try {
920
912
  const obj = await adapter.getForeignObjectAsync(`system.adapter.${adapter.namespace}`);
921
- /** @ts-expect-error bug already reported */
922
913
  clientId = `${(_a = obj === null || obj === void 0 ? void 0 : obj.common) === null || _a === void 0 ? void 0 : _a.host}:${clientId}`;
923
914
  }
924
915
  catch (e) {
925
916
  adapter.log.warn(`Could not get hostname, using default id "${clientId}" to register: ${e.message}`);
926
917
  }
918
+ clientId += `:${(0, crypto_1.randomBytes)(16).toString('hex')}`;
927
919
  adapter.log.info(`${adapter.config.type}rpc server is trying to listen on ${adapter.config.adapterAddress}:${port}`);
928
920
  adapter.log.info(`${adapter.config.type}rpc client is trying to connect to ${adapter.config.homematicAddress}:${adapter.config.homematicPort}${homematicPath} with ${JSON.stringify([daemonURL, clientId])}`);
929
921
  connect(true);
@@ -1028,7 +1020,6 @@ async function initRpcServer() {
1028
1020
  continue;
1029
1021
  }
1030
1022
  // lets get the device description
1031
- /** @ts-expect-error bug reported */
1032
1023
  const val = row.value;
1033
1024
  if (typeof val.ADDRESS === 'undefined') {
1034
1025
  continue;
@@ -1107,7 +1098,6 @@ async function initRpcServer() {
1107
1098
  if (row.id === `${adapter.namespace}.updated`) {
1108
1099
  continue;
1109
1100
  }
1110
- /** @ts-expect-error bug reported */
1111
1101
  const val = row.value;
1112
1102
  if (val.ADDRESS) {
1113
1103
  response.push({ ADDRESS: val.ADDRESS, VERSION: val.VERSION });
@@ -1135,7 +1125,7 @@ async function initRpcServer() {
1135
1125
  }
1136
1126
  adapter.log.info(`${adapter.config.type}rpc <- deleteDevices ${params[1].length}`);
1137
1127
  for (let deviceName of params[1]) {
1138
- if (deviceName.indexOf(':') !== -1) {
1128
+ if (deviceName.includes(':')) {
1139
1129
  deviceName = deviceName.replace(':', '.').replace(adapter.FORBIDDEN_CHARS, '_');
1140
1130
  adapter.log.info(`channel ${deviceName} ${JSON.stringify(deviceName)} deleted`);
1141
1131
  const parts = deviceName.split('.');
@@ -1217,7 +1207,7 @@ async function addParamsetObjects(channel, paramset) {
1217
1207
  }
1218
1208
  } // endIf
1219
1209
  if (paramObj.SPECIAL) {
1220
- if (typeof obj.common.states !== 'object') {
1210
+ if (typeof obj.common.states !== 'object' || Array.isArray(obj.common.states)) {
1221
1211
  obj.common.states = {};
1222
1212
  }
1223
1213
  for (let i = 0; i < paramObj.SPECIAL.length; i++) {
@@ -1318,13 +1308,11 @@ async function addParamsetObjects(channel, paramset) {
1318
1308
  const dpID = `${adapter.namespace}.${channel._id}.${key}`;
1319
1309
  dpTypes[dpID] = {
1320
1310
  UNIT: paramObj.UNIT,
1321
- TYPE: paramObj.TYPE,
1322
- MIN: paramObj.MIN,
1323
- MAX: paramObj.MAX
1311
+ TYPE: paramObj.TYPE
1324
1312
  };
1325
- if (typeof dpTypes[dpID].MIN === 'number') {
1326
- dpTypes[dpID].MIN = parseFloat(dpTypes[dpID].MIN);
1327
- dpTypes[dpID].MAX = parseFloat(dpTypes[dpID].MAX);
1313
+ if (paramObj.MIN === 'number') {
1314
+ dpTypes[dpID].MIN = paramObj.MIN;
1315
+ dpTypes[dpID].MAX = paramObj.MAX;
1328
1316
  // Humidity is from 0 to 99. It is wrong.
1329
1317
  if (dpTypes[dpID].MAX === 99) {
1330
1318
  dpTypes[dpID].MAX = 100;
@@ -1559,14 +1547,11 @@ async function createDevices(deviceArr) {
1559
1547
  const dpID = `${adapter.namespace}.${obj._id}`;
1560
1548
  dpTypes[dpID] = {
1561
1549
  UNIT: device.UNIT,
1562
- TYPE: device.TYPE,
1563
- MAX: device.MAX,
1564
- MIN: device.MIN,
1565
- role: role
1550
+ TYPE: device.TYPE
1566
1551
  };
1567
- if (typeof dpTypes[dpID].MIN === 'number') {
1568
- dpTypes[dpID].MIN = parseFloat(dpTypes[dpID].MIN);
1569
- dpTypes[dpID].MAX = parseFloat(dpTypes[dpID].MAX);
1552
+ if (typeof device.MIN === 'number') {
1553
+ dpTypes[dpID].MIN = device.MIN;
1554
+ dpTypes[dpID].MAX = device.MAX;
1570
1555
  // e. g. Humidity is from 0 to 99. It is wrong. todo: logically ok, but is it? Can a sensor deliver 100 % humidity?
1571
1556
  if (dpTypes[dpID].MAX === 99) {
1572
1557
  dpTypes[dpID].MAX = 100;
@@ -1620,7 +1605,6 @@ async function getCuxDevices() {
1620
1605
  continue;
1621
1606
  }
1622
1607
  // lets get the device description
1623
- /** @ts-expect-error bug reported */
1624
1608
  const val = row.value;
1625
1609
  if (typeof val.ADDRESS === 'undefined') {
1626
1610
  continue;
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.7",
17
+ "version": "1.15.8",
18
18
  "news": {
19
+ "1.15.8": {
20
+ "en": "we now ensure, that the `uuid` used for connection is really unique",
21
+ "de": "wir stellen nun sicher, dass die für die Verbindung verwendete `uuid` wirklich eindeutig ist",
22
+ "ru": "теперь мы гарантируем, что `uuid`, используемый для соединения, действительно уникален.",
23
+ "pt": "agora garantimos que o `uuid` usado para conexão é realmente único",
24
+ "nl": "we zorgen er nu voor dat de `uuid` die wordt gebruikt voor verbinding echt uniek is",
25
+ "fr": "nous nous assurons maintenant que le `uuid` utilisé pour la connexion est vraiment unique",
26
+ "it": "ora ci assicuriamo che l'uuid usato per la connessione sia davvero unico",
27
+ "es": "ahora nos aseguramos de que el `uuid` utilizado para la conexión sea realmente único",
28
+ "pl": "teraz upewniamy się, że `uuid` używany do połączenia jest naprawdę unikalny",
29
+ "zh-cn": "我们现在确保用于连接的 `uuid` 确实是唯一的"
30
+ },
19
31
  "1.15.7": {
20
32
  "en": "fixed new devices beeing created as `undefined`",
21
33
  "de": "Behoben, dass neue Geräte als „undefiniert“ erstellt wurden",
@@ -87,18 +99,6 @@
87
99
  "es": "también arreglamos el tipo de valor predeterminado si es booleano en los grupos de calentamiento",
88
100
  "pl": "poprawiliśmy również typ wartości domyślnej, jeśli wartość logiczna na grupach grzewczych",
89
101
  "zh-cn": "如果加热组上的布尔值,我们还修复了默认值的类型"
90
- },
91
- "1.15.1": {
92
- "en": "we fixxed type of default value and min/max of heating groups (closes #443)",
93
- "de": "Wir haben die Art des Standardwerts und das Minimum/Maximum der Heizgruppen korrigiert (schließt #443)",
94
- "ru": "мы зафиксировали тип значения по умолчанию и мин/макс группы нагрева (закрывает #443)",
95
- "pt": "fixamos o tipo de valor padrão e min/max de grupos de aquecimento (fecha #443)",
96
- "nl": "we hebben het type standaardwaarde en min/max van verwarmingsgroepen vastgelegd (sluit #443)",
97
- "fr": "nous fixons le type de valeur par défaut et le min/max des groupes de chauffage (ferme #443)",
98
- "it": "abbiamo fissato il tipo di valore predefinito e min/max dei gruppi di riscaldamento (chiude #443)",
99
- "es": "fijamos el tipo de valor predeterminado y min/max de grupos de calefacción (cierra #443)",
100
- "pl": "ustaliliśmy typ wartości domyślnej oraz min/max grup grzewczych (zamyka #443)",
101
- "zh-cn": "我们固定了默认值的类型和加热组的最小值/最大值(关闭 #443)"
102
102
  }
103
103
  },
104
104
  "authors": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iobroker.hm-rpc",
3
- "version": "1.15.7",
3
+ "version": "1.15.8",
4
4
  "description": "Connects HomeMatic Interface-Processes (BidCos-Services, Homegear and CUxD) via XML-RPC or BIN-RPC to ioBroker",
5
5
  "author": {
6
6
  "name": "hobbyquaker",
@@ -37,7 +37,7 @@
37
37
  "url": "https://github.com/ioBroker/ioBroker.hm-rpc"
38
38
  },
39
39
  "dependencies": {
40
- "@iobroker/adapter-core": "^2.5.1",
40
+ "@iobroker/adapter-core": "^2.6.0",
41
41
  "binrpc": "^3.3.1",
42
42
  "homematic-xmlrpc": "^1.0.2"
43
43
  },