iobroker.hm-rpc 2.0.2 → 3.0.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/build/main.js CHANGED
@@ -15,16 +15,26 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.HomematicRpc = void 0;
27
- const utils = __importStar(require("@iobroker/adapter-core"));
37
+ const adapter_core_1 = require("@iobroker/adapter-core");
28
38
  const images_1 = require("./lib/images");
29
39
  const tools = __importStar(require("./lib/tools"));
30
40
  const roles_1 = require("./lib/roles");
@@ -36,7 +46,7 @@ let clientId;
36
46
  let rpc;
37
47
  let rpcClient;
38
48
  let rpcServer;
39
- class HomematicRpc extends utils.Adapter {
49
+ class HomematicRpc extends adapter_core_1.Adapter {
40
50
  constructor(options = {}) {
41
51
  super({
42
52
  ...options,
@@ -49,7 +59,7 @@ class HomematicRpc extends utils.Adapter {
49
59
  }
50
60
  // don't know how to handle, so let it burn ;-)
51
61
  return false;
52
- }
62
+ },
53
63
  });
54
64
  /** On failed rpc call retry in X ms */
55
65
  this.RETRY_DELAY_MS = 150;
@@ -70,7 +80,7 @@ class HomematicRpc extends utils.Adapter {
70
80
  EPAPER_TONE: 'string',
71
81
  EPAPER_SIGNAL: 'string',
72
82
  EPAPER_TONE_INTERVAL: 'number',
73
- EPAPER_TONE_REPETITIONS: 'number'
83
+ EPAPER_TONE_REPETITIONS: 'number',
74
84
  };
75
85
  this.methods = {
76
86
  event: (err, params) => {
@@ -110,9 +120,9 @@ class HomematicRpc extends utils.Adapter {
110
120
  val = tools.fixEvent({ val, dpType: this.dpTypes[name] });
111
121
  this.log.debug(`${name} ==> UNIT: "${this.dpTypes[name] ? this.dpTypes[name].UNIT : 'none'}" (min: ${this.dpTypes[name] ? this.dpTypes[name].MIN : 'none'}, max: ${this.dpTypes[name] ? this.dpTypes[name].MAX : 'none'}) From "${params[3]}" => "${val}"`);
112
122
  this.setState(`${channel}.${params[2]}`, { val: val, ack: true });
113
- // unfortunately this is necessary
123
+ // unfortunately, this is necessary
114
124
  return '';
115
- }
125
+ },
116
126
  };
117
127
  this.on('ready', this.onReady.bind(this));
118
128
  this.on('stateChange', this.onStateChange.bind(this));
@@ -136,21 +146,26 @@ class HomematicRpc extends utils.Adapter {
136
146
  this.log.error('Check init interval is less than 10 seconds. Set init interval to 10 seconds.');
137
147
  this.config.checkInitInterval = 10;
138
148
  }
139
- this.setState('info.connection', false, true);
149
+ await this.setState('info.connection', false, true);
140
150
  if (this.config.type === 'bin') {
141
- rpc = require('binrpc');
151
+ // @ts-expect-error no types
152
+ rpc = await Promise.resolve().then(() => __importStar(require('binrpc')));
142
153
  this.daemonProto = 'xmlrpc_bin://';
143
154
  }
144
155
  else {
145
- rpc = require('homematic-xmlrpc');
156
+ // @ts-expect-error no types
157
+ rpc = await Promise.resolve().then(() => __importStar(require('homematic-xmlrpc')));
146
158
  this.config.type = 'xml';
147
159
  this.daemonProto = 'http://';
148
160
  }
161
+ if (rpc.default) {
162
+ rpc = rpc.default;
163
+ }
149
164
  // Clean up objects if still hm-rpc.meta exist
150
165
  try {
151
166
  const doc = await this.getObjectListAsync({
152
167
  startkey: 'hm-rpc.meta',
153
- endkey: 'hm-rpc.meta\u9999'
168
+ endkey: 'hm-rpc.meta\u9999',
154
169
  });
155
170
  if (doc && doc.rows) {
156
171
  if (doc.rows.length >= 50) {
@@ -172,7 +187,7 @@ class HomematicRpc extends utils.Adapter {
172
187
  try {
173
188
  const res = await this.getObjectViewAsync('system', 'state', {
174
189
  startkey: `${this.namespace}.`,
175
- endkey: `${this.namespace}.\u9999`
190
+ endkey: `${this.namespace}.\u9999`,
176
191
  });
177
192
  if (res.rows) {
178
193
  for (const row of res.rows) {
@@ -187,7 +202,7 @@ class HomematicRpc extends utils.Adapter {
187
202
  else {
188
203
  this.dpTypes[row.id] = {
189
204
  UNIT: obj.native.UNIT,
190
- TYPE: obj.native.TYPE
205
+ TYPE: obj.native.TYPE,
191
206
  };
192
207
  if (typeof obj.native.MIN === 'number') {
193
208
  this.dpTypes[row.id].MIN = obj.native.MIN;
@@ -213,7 +228,7 @@ class HomematicRpc extends utils.Adapter {
213
228
  this.log.error(`Could not get state view on start: ${e.message}`);
214
229
  }
215
230
  // Start Adapter
216
- this.initRpcServer();
231
+ await this.initRpcServer();
217
232
  }
218
233
  /**
219
234
  * Is called when adapter shuts down - callback has to be called under any circumstances!
@@ -238,7 +253,7 @@ class HomematicRpc extends utils.Adapter {
238
253
  if (connected) {
239
254
  this.log.info('Disconnected');
240
255
  connected = false;
241
- this.setState('info.connection', false, true);
256
+ await this.setState('info.connection', false, true);
242
257
  }
243
258
  if (rpcServer && rpcServer.server) {
244
259
  try {
@@ -344,7 +359,7 @@ class HomematicRpc extends utils.Adapter {
344
359
  }
345
360
  if (type === 'EPAPER_LINE' || type === 'EPAPER_ICON') {
346
361
  const _id = `${tmp[0]}.${tmp[1]}.${tmp[2]}`;
347
- if (displays[_id] && displays[_id].timer) {
362
+ if (displays[_id]?.timer) {
348
363
  clearTimeout(displays[_id].timer);
349
364
  if (displays[_id].withTone) {
350
365
  displays[_id] = { timer: this.setTimeout(() => this.readSignals(_id), 300), withTone: true };
@@ -409,13 +424,14 @@ class HomematicRpc extends utils.Adapter {
409
424
  this.log.error(`${this.config.type}rpc -> setValue ${JSON.stringify([
410
425
  `${tmp[2]}:${tmp[3]}`,
411
426
  tmp[4],
412
- state.val
427
+ state.val,
413
428
  ])} ${type}`);
414
429
  this.log.error(`Cannot call setValue: ${e.message}`);
415
430
  }
416
431
  }
417
432
  /**
418
433
  * Handle messages send to this instance
434
+ *
419
435
  * @param obj the message object
420
436
  */
421
437
  async onMessage(obj) {
@@ -441,7 +457,7 @@ class HomematicRpc extends utils.Adapter {
441
457
  if (obj.callback) {
442
458
  this.sendTo(obj.from, obj.command, {
443
459
  result: data,
444
- error: null
460
+ error: null,
445
461
  }, obj.callback);
446
462
  }
447
463
  }
@@ -463,12 +479,12 @@ class HomematicRpc extends utils.Adapter {
463
479
  const data = await this.rpcMethodCallAsync(obj.command, [
464
480
  obj.message.ID,
465
481
  obj.message.paramType,
466
- obj.message.params
482
+ obj.message.params,
467
483
  ]);
468
484
  if (obj.callback) {
469
485
  this.sendTo(obj.from, obj.command, {
470
486
  result: data,
471
- error: null
487
+ error: null,
472
488
  }, obj.callback);
473
489
  }
474
490
  }
@@ -497,7 +513,7 @@ class HomematicRpc extends utils.Adapter {
497
513
  host: this.config.homematicAddress,
498
514
  port: this.config.homematicPort,
499
515
  path: this.homematicPath,
500
- reconnectTimeout: this.config.reconnectInterval * 1000
516
+ reconnectTimeout: this.config.reconnectInterval * 1000,
501
517
  });
502
518
  }
503
519
  catch (e) {
@@ -519,7 +535,7 @@ class HomematicRpc extends utils.Adapter {
519
535
  path: this.homematicPath,
520
536
  reconnectTimeout: this.config.reconnectInterval * 1_000,
521
537
  basic_auth: { user: this.config.username, pass: this.config.password },
522
- rejectUnauthorized: false
538
+ rejectUnauthorized: false,
523
539
  });
524
540
  }
525
541
  catch (e) {
@@ -632,7 +648,7 @@ class HomematicRpc extends utils.Adapter {
632
648
  // somehow we cannot catch EADDRNOTAVAIL, also not with a cb here
633
649
  rpcServer = rpc.createServer({
634
650
  host: this.config.adapterAddress,
635
- port: adapterPort
651
+ port: adapterPort,
636
652
  });
637
653
  }
638
654
  catch (e) {
@@ -717,7 +733,7 @@ class HomematicRpc extends utils.Adapter {
717
733
  'replaceDevice',
718
734
  'system.listMethods',
719
735
  'system.multicall',
720
- 'setReadyConfig'
736
+ 'setReadyConfig',
721
737
  ]);
722
738
  });
723
739
  rpcServer.on('event', (err, params, callback) => {
@@ -750,7 +766,7 @@ class HomematicRpc extends utils.Adapter {
750
766
  try {
751
767
  doc = await this.getObjectViewAsync('hm-rpc', 'listDevices', {
752
768
  startkey: `${this.namespace}.`,
753
- endkey: `${this.namespace}.\u9999`
769
+ endkey: `${this.namespace}.\u9999`,
754
770
  });
755
771
  }
756
772
  catch (e) {
@@ -826,7 +842,7 @@ class HomematicRpc extends utils.Adapter {
826
842
  try {
827
843
  doc = await this.getObjectViewAsync('hm-rpc', 'listDevices', {
828
844
  startkey: `${this.namespace}.`,
829
- endkey: `${this.namespace}.\u9999`
845
+ endkey: `${this.namespace}.\u9999`,
830
846
  });
831
847
  }
832
848
  catch (e) {
@@ -902,7 +918,7 @@ class HomematicRpc extends utils.Adapter {
902
918
  * Adds the paramset objects of the given paramset to the given channel
903
919
  *
904
920
  * @param channel - channel object with at least "_id" property
905
- * @param paramset - paramset object retrived by CCU
921
+ * @param paramset - a paramset object retrieved by CCU
906
922
  */
907
923
  async addParamsetObjects(channel, paramset) {
908
924
  for (const [key, paramObj] of Object.entries(paramset)) {
@@ -915,9 +931,9 @@ class HomematicRpc extends utils.Adapter {
915
931
  def: paramObj.DEFAULT,
916
932
  type: this.COMMON_TYPE_MAPPING[paramObj.TYPE] || 'mixed',
917
933
  read: !!(paramObj.OPERATIONS & 1),
918
- write: !!(paramObj.OPERATIONS & 2)
934
+ write: !!(paramObj.OPERATIONS & 2),
919
935
  },
920
- native: paramObj
936
+ native: paramObj,
921
937
  };
922
938
  // Heating groups are send everything as string
923
939
  if (typeof obj.common.def === 'string' && obj.common.type === 'number') {
@@ -1037,7 +1053,7 @@ class HomematicRpc extends utils.Adapter {
1037
1053
  const dpID = `${this.namespace}.${channel._id}.${key}`;
1038
1054
  this.dpTypes[dpID] = {
1039
1055
  UNIT: paramObj.UNIT,
1040
- TYPE: paramObj.TYPE
1056
+ TYPE: paramObj.TYPE,
1041
1057
  };
1042
1058
  if (typeof paramObj.MIN === 'number') {
1043
1059
  this.dpTypes[dpID].MIN = paramObj.MIN;
@@ -1069,7 +1085,7 @@ class HomematicRpc extends utils.Adapter {
1069
1085
  return new Promise((resolve, reject) => {
1070
1086
  rpcClient.methodCall(method, params, (err, res) => {
1071
1087
  if (err) {
1072
- reject(err);
1088
+ reject(new Error(err));
1073
1089
  }
1074
1090
  else {
1075
1091
  resolve(res);
@@ -1078,7 +1094,7 @@ class HomematicRpc extends utils.Adapter {
1078
1094
  });
1079
1095
  }
1080
1096
  /**
1081
- * Async variant of method call which also performs a retry on first error of "setValue"
1097
+ * Async variant of method call which also performs a retry on the first error of "setValue"
1082
1098
  *
1083
1099
  * @param method the method name
1084
1100
  * @param params the method specific parameters
@@ -1089,22 +1105,18 @@ class HomematicRpc extends utils.Adapter {
1089
1105
  return res;
1090
1106
  }
1091
1107
  catch (e) {
1092
- if (method === 'setValue' && (e.message.endsWith('Failure') || e.message.endsWith('(UNREACH)'))) {
1108
+ if (method === 'setValue' &&
1109
+ (e.message.endsWith('Failure') || e.message.endsWith('(UNREACH)'))) {
1093
1110
  this.log.info(`Temporary error occurred for "${method}" with "${JSON.stringify(params)}": ${e.message}`);
1094
- // on random error due to temporary communication issues try again once after some ms
1111
+ // on random error due to temporary communication issues, try again once after some ms
1095
1112
  await this.delay(this.RETRY_DELAY_MS);
1096
1113
  return this.rpcMethodCallAsyncHelper(method, params);
1097
1114
  }
1098
- else {
1099
- throw e;
1100
- }
1115
+ throw e;
1101
1116
  }
1102
1117
  }
1103
1118
  /**
1104
1119
  * Control the EPAPER display
1105
- *
1106
- * @param id
1107
- * @param data
1108
1120
  */
1109
1121
  async controlEPaper(id, data) {
1110
1122
  const tmp = id.split('.');
@@ -1126,136 +1138,130 @@ class HomematicRpc extends utils.Adapter {
1126
1138
  }
1127
1139
  /**
1128
1140
  * Read signal from EPAPER display
1129
- *
1130
- * @param id
1131
1141
  */
1132
1142
  async readSignals(id) {
1133
1143
  displays[id] = null;
1134
1144
  const data = {
1135
- lines: [{}, {}, {}],
1145
+ lines: [
1146
+ { line: '', icon: '' },
1147
+ { line: '', icon: '' },
1148
+ { line: '', icon: '' },
1149
+ ],
1136
1150
  signal: '0xF0',
1137
- tone: '0xC0'
1151
+ tone: '0xC0',
1138
1152
  };
1139
1153
  const promises = [];
1140
- promises.push(new Promise(resolve => {
1141
- this.getForeignState(`${id}.0.EPAPER_LINE2`, (err, state) => {
1142
- data.lines[0].line = state ? state.val || '' : '';
1143
- resolve();
1144
- });
1145
- }));
1146
- promises.push(new Promise(resolve => {
1147
- this.getForeignState(`${id}.0.EPAPER_ICON2`, (err, state) => {
1148
- data.lines[0].icon = state ? state.val || '' : '';
1149
- resolve();
1150
- });
1151
- }));
1152
- promises.push(new Promise(resolve => {
1153
- this.getForeignState(`${id}.0.EPAPER_LINE3`, (err, state) => {
1154
- data.lines[1].line = state ? state.val || '' : '';
1155
- resolve();
1156
- });
1157
- }));
1158
- promises.push(new Promise(resolve => {
1159
- this.getForeignState(`${id}.0.EPAPER_ICON3`, (err, state) => {
1160
- data.lines[1].icon = state ? state.val || '' : '';
1161
- resolve();
1162
- });
1163
- }));
1164
- promises.push(new Promise(resolve => {
1165
- this.getForeignState(`${id}.0.EPAPER_LINE4`, (err, state) => {
1166
- data.lines[2].line = state ? state.val || '' : '';
1167
- resolve();
1168
- });
1169
- }));
1170
- promises.push(new Promise(resolve => {
1171
- this.getForeignState(`${id}.0.EPAPER_ICON4`, (err, state) => {
1172
- data.lines[2].icon = state ? state.val || '' : '';
1173
- resolve();
1174
- });
1175
- }));
1176
- promises.push(new Promise(resolve => {
1177
- this.getForeignState(`${id}.0.EPAPER_SIGNAL`, (err, state) => {
1178
- data.signal = state ? state.val || '0xF0' : '0xF0';
1179
- resolve();
1180
- });
1181
- }));
1182
- promises.push(new Promise(resolve => {
1183
- this.getForeignState(`${id}.0.EPAPER_TONE`, (err, state) => {
1184
- data.tone = state ? state.val || '0xC0' : '0xC0';
1185
- resolve();
1186
- });
1187
- }));
1188
- promises.push(new Promise(resolve => {
1189
- this.getForeignState(`${id}.0.EPAPER_TONE_INTERVAL`, (err, state) => {
1190
- data.offset = state ? state.val : 10;
1191
- resolve();
1192
- });
1193
- }));
1194
- promises.push(new Promise(resolve => {
1195
- this.getForeignState(`${id}.0.EPAPER_TONE_REPETITIONS`, (err, state) => {
1196
- data.repeats = state ? state.val : 1;
1197
- resolve();
1198
- });
1199
- }));
1154
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_LINE2`)
1155
+ .then(state => {
1156
+ data.lines[0].line = state ? state.val || '' : '';
1157
+ })
1158
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_LINE2: ${e.message}`)));
1159
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_ICON2`)
1160
+ .then(state => {
1161
+ data.lines[0].icon = state ? state.val || '' : '';
1162
+ })
1163
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_ICON2: ${e.message}`)));
1164
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_LINE3`)
1165
+ .then(state => {
1166
+ data.lines[1].line = state ? state.val || '' : '';
1167
+ })
1168
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_LINE3: ${e.message}`)));
1169
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_ICON3`)
1170
+ .then(state => {
1171
+ data.lines[1].icon = state ? state.val || '' : '';
1172
+ })
1173
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_ICON3: ${e.message}`)));
1174
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_LINE4`)
1175
+ .then(state => {
1176
+ data.lines[2].line = state ? state.val || '' : '';
1177
+ })
1178
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_LINE4: ${e.message}`)));
1179
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_ICON4`)
1180
+ .then(state => {
1181
+ data.lines[2].icon = state ? state.val || '' : '';
1182
+ })
1183
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_ICON4: ${e.message}`)));
1184
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_SIGNAL`)
1185
+ .then(state => {
1186
+ data.signal = state ? state.val || '0xF0' : '0xF0';
1187
+ })
1188
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_SIGNAL: ${e.message}`)));
1189
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_TONE`)
1190
+ .then(state => {
1191
+ data.tone = state ? state.val || '0xC0' : '0xC0';
1192
+ })
1193
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_TONE: ${e.message}`)));
1194
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_TONE_INTERVAL`)
1195
+ .then(state => {
1196
+ data.offset = state
1197
+ ? state.val === undefined || state.val === null || state.val === ''
1198
+ ? 10
1199
+ : parseInt(state.val, 10)
1200
+ : 10;
1201
+ })
1202
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_TONE_INTERVAL: ${e.message}`)));
1203
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_TONE_REPETITIONS`)
1204
+ .then(state => {
1205
+ data.repeats = state
1206
+ ? state.val === undefined || state.val === null || state.val === ''
1207
+ ? 1
1208
+ : parseInt(state.val, 10)
1209
+ : 1;
1210
+ })
1211
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_TONE_REPETITIONS: ${e.message}`)));
1200
1212
  await Promise.all(promises);
1201
- this.controlEPaper(id, data);
1213
+ await this.controlEPaper(id, data);
1202
1214
  }
1203
1215
  /**
1204
1216
  * Read the settings from EPAPER display
1205
- *
1206
- * @param id
1207
1217
  */
1208
1218
  async readSettings(id) {
1209
1219
  displays[id] = null;
1210
1220
  const data = {
1211
- lines: [{}, {}, {}],
1221
+ lines: [
1222
+ { line: '', icon: '' },
1223
+ { line: '', icon: '' },
1224
+ { line: '', icon: '' },
1225
+ ],
1212
1226
  signal: '0xF0',
1213
- tone: '0xC0'
1227
+ tone: '0xC0',
1214
1228
  };
1215
1229
  const promises = [];
1216
- promises.push(new Promise(resolve => {
1217
- this.getForeignState(`${id}.0.EPAPER_LINE2`, (err, state) => {
1218
- data.lines[0].line = state ? state.val || '' : '';
1219
- resolve();
1220
- });
1221
- }));
1222
- promises.push(new Promise(resolve => {
1223
- this.getForeignState(`${id}.0.EPAPER_ICON2`, (err, state) => {
1224
- data.lines[0].icon = state ? state.val || '' : '';
1225
- resolve();
1226
- });
1227
- }));
1228
- promises.push(new Promise(resolve => {
1229
- this.getForeignState(`${id}.0.EPAPER_LINE3`, (err, state) => {
1230
- data.lines[1].line = state ? state.val || '' : '';
1231
- resolve();
1232
- });
1233
- }));
1234
- promises.push(new Promise(resolve => {
1235
- this.getForeignState(`${id}.0.EPAPER_ICON3`, (err, state) => {
1236
- data.lines[1].icon = state ? state.val || '' : '';
1237
- resolve();
1238
- });
1239
- }));
1240
- promises.push(new Promise(resolve => {
1241
- this.getForeignState(`${id}.0.EPAPER_LINE4`, (err, state) => {
1242
- data.lines[2].line = state ? state.val || '' : '';
1243
- resolve();
1244
- });
1245
- }));
1246
- promises.push(new Promise(resolve => {
1247
- this.getForeignState(`${id}.0.EPAPER_ICON4`, (err, state) => {
1248
- data.lines[2].icon = state ? state.val || '' : '';
1249
- resolve();
1250
- });
1251
- }));
1230
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_LINE2`)
1231
+ .then(state => {
1232
+ data.lines[0].line = state ? state.val || '' : '';
1233
+ })
1234
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_LINE2: ${e.message}`)));
1235
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_ICON2`)
1236
+ .then(state => {
1237
+ data.lines[0].icon = state ? state.val || '' : '';
1238
+ })
1239
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_ICON2: ${e.message}`)));
1240
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_LINE3`)
1241
+ .then(state => {
1242
+ data.lines[1].line = state ? state.val || '' : '';
1243
+ })
1244
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_LINE3: ${e.message}`)));
1245
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_ICON3`)
1246
+ .then(state => {
1247
+ data.lines[1].icon = state ? state.val || '' : '';
1248
+ })
1249
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_ICON3: ${e.message}`)));
1250
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_LINE4`)
1251
+ .then(state => {
1252
+ data.lines[2].line = state ? state.val || '' : '';
1253
+ })
1254
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_LINE4: ${e.message}`)));
1255
+ promises.push(this.getForeignStateAsync(`${id}.0.EPAPER_ICON4`)
1256
+ .then(state => {
1257
+ data.lines[2].icon = state ? state.val || '' : '';
1258
+ })
1259
+ .catch(e => this.log.error(`Cannot read state ${id}.0.EPAPER_ICON4: ${e.message}`)));
1252
1260
  await Promise.all(promises);
1253
- this.controlEPaper(id, data);
1261
+ await this.controlEPaper(id, data);
1254
1262
  }
1255
1263
  /**
1256
1264
  * Get value paramsets and add them
1257
- *
1258
- * @param valueParamsets
1259
1265
  */
1260
1266
  async getValueParamsets(valueParamsets) {
1261
1267
  for (const obj of valueParamsets) {
@@ -1269,7 +1275,7 @@ class HomematicRpc extends utils.Adapter {
1269
1275
  this.log.info(`${this.config.type}rpc -> getParamsetDescription ${JSON.stringify([obj.native.ADDRESS, 'VALUES'])}`);
1270
1276
  this.metaValues[cid] = await this.rpcMethodCallAsync('getParamsetDescription', [
1271
1277
  obj.native.ADDRESS,
1272
- 'VALUES'
1278
+ 'VALUES',
1273
1279
  ]);
1274
1280
  if (obj.native && obj.native.PARENT_TYPE === 'HM-Dis-EP-WM55' && obj.native.TYPE === 'MAINTENANCE') {
1275
1281
  this.addEPaperToMeta();
@@ -1295,7 +1301,7 @@ class HomematicRpc extends utils.Adapter {
1295
1301
  this.log.info('Restarting now, because we had a forced reinitialization run');
1296
1302
  try {
1297
1303
  await this.extendForeignObjectAsync(`system.adapter.${this.namespace}`, {
1298
- native: { forceReInit: false }
1304
+ native: { forceReInit: false },
1299
1305
  });
1300
1306
  }
1301
1307
  catch (e) {
@@ -1319,7 +1325,7 @@ class HomematicRpc extends utils.Adapter {
1319
1325
  obj.EPAPER_LINE2 = {
1320
1326
  TYPE: 'EPAPER_LINE',
1321
1327
  ID: 'LINE2',
1322
- OPERATIONS: 2
1328
+ OPERATIONS: 2,
1323
1329
  };
1324
1330
  obj.EPAPER_ICON2 = {
1325
1331
  TYPE: 'EPAPER_ICON',
@@ -1334,14 +1340,14 @@ class HomematicRpc extends utils.Adapter {
1334
1340
  '0x85': 'All OK',
1335
1341
  '0x86': 'Information',
1336
1342
  '0x87': 'New message',
1337
- '0x88': 'Service message'
1343
+ '0x88': 'Service message',
1338
1344
  },
1339
- OPERATIONS: 2
1345
+ OPERATIONS: 2,
1340
1346
  };
1341
1347
  obj.EPAPER_LINE3 = {
1342
1348
  TYPE: 'EPAPER_LINE',
1343
1349
  ID: 'LINE3',
1344
- OPERATIONS: 2
1350
+ OPERATIONS: 2,
1345
1351
  };
1346
1352
  obj.EPAPER_ICON3 = {
1347
1353
  TYPE: 'EPAPER_ICON',
@@ -1356,14 +1362,14 @@ class HomematicRpc extends utils.Adapter {
1356
1362
  '0x85': 'All OK',
1357
1363
  '0x86': 'Information',
1358
1364
  '0x87': 'New message',
1359
- '0x88': 'Service message'
1365
+ '0x88': 'Service message',
1360
1366
  },
1361
- OPERATIONS: 2
1367
+ OPERATIONS: 2,
1362
1368
  };
1363
1369
  obj.EPAPER_LINE4 = {
1364
1370
  TYPE: 'EPAPER_LINE',
1365
1371
  ID: 'LINE4',
1366
- OPERATIONS: 2
1372
+ OPERATIONS: 2,
1367
1373
  };
1368
1374
  obj.EPAPER_ICON4 = {
1369
1375
  TYPE: 'EPAPER_ICON',
@@ -1378,9 +1384,9 @@ class HomematicRpc extends utils.Adapter {
1378
1384
  '0x85': 'All OK',
1379
1385
  '0x86': 'Information',
1380
1386
  '0x87': 'New message',
1381
- '0x88': 'Service message'
1387
+ '0x88': 'Service message',
1382
1388
  },
1383
- OPERATIONS: 2
1389
+ OPERATIONS: 2,
1384
1390
  };
1385
1391
  obj.EPAPER_SIGNAL = {
1386
1392
  TYPE: 'EPAPER_SIGNAL',
@@ -1389,9 +1395,9 @@ class HomematicRpc extends utils.Adapter {
1389
1395
  '0xF0': 'OFF',
1390
1396
  '0xF1': 'Red blink',
1391
1397
  '0xF2': 'Green blink',
1392
- '0xF3': 'Orange blink'
1398
+ '0xF3': 'Orange blink',
1393
1399
  },
1394
- OPERATIONS: 2
1400
+ OPERATIONS: 2,
1395
1401
  };
1396
1402
  obj.EPAPER_TONE = {
1397
1403
  TYPE: 'EPAPER_TONE',
@@ -1403,9 +1409,9 @@ class HomematicRpc extends utils.Adapter {
1403
1409
  '0xC3': 'Long Short Short',
1404
1410
  '0xC4': 'Short',
1405
1411
  '0xC5': 'Short Short',
1406
- '0xC6': 'Long'
1412
+ '0xC6': 'Long',
1407
1413
  },
1408
- OPERATIONS: 2
1414
+ OPERATIONS: 2,
1409
1415
  };
1410
1416
  obj.EPAPER_TONE_INTERVAL = {
1411
1417
  TYPE: 'EPAPER_TONE_INTERVAL',
@@ -1413,7 +1419,7 @@ class HomematicRpc extends utils.Adapter {
1413
1419
  MIN: 10,
1414
1420
  MAX: 160,
1415
1421
  OPERATIONS: 2,
1416
- DEFAULT: 10
1422
+ DEFAULT: 10,
1417
1423
  };
1418
1424
  obj.EPAPER_TONE_REPETITIONS = {
1419
1425
  TYPE: 'EPAPER_TONE_REPETITIONS',
@@ -1421,7 +1427,7 @@ class HomematicRpc extends utils.Adapter {
1421
1427
  MIN: 0,
1422
1428
  MAX: 15,
1423
1429
  OPERATIONS: 2,
1424
- DEFAULT: 1
1430
+ DEFAULT: 1,
1425
1431
  };
1426
1432
  }
1427
1433
  }
@@ -1462,9 +1468,9 @@ class HomematicRpc extends utils.Adapter {
1462
1468
  type: type,
1463
1469
  common: {
1464
1470
  name: device.ADDRESS,
1465
- role: role
1471
+ role: role,
1466
1472
  },
1467
- native: device
1473
+ native: device,
1468
1474
  };
1469
1475
  if (icon) {
1470
1476
  obj.common.icon = icon;
@@ -1472,7 +1478,7 @@ class HomematicRpc extends utils.Adapter {
1472
1478
  const dpID = `${this.namespace}.${obj._id}`;
1473
1479
  this.dpTypes[dpID] = {
1474
1480
  UNIT: device.UNIT,
1475
- TYPE: device.TYPE
1481
+ TYPE: device.TYPE,
1476
1482
  };
1477
1483
  if (typeof device.MIN === 'number') {
1478
1484
  this.dpTypes[dpID].MIN = device.MIN;
@@ -1516,7 +1522,7 @@ class HomematicRpc extends utils.Adapter {
1516
1522
  try {
1517
1523
  doc = await this.getObjectViewAsync('hm-rpc', 'listDevices', {
1518
1524
  startkey: `${this.namespace}.`,
1519
- endkey: `${this.namespace}.\u9999`
1525
+ endkey: `${this.namespace}.\u9999`,
1520
1526
  });
1521
1527
  }
1522
1528
  catch (e) {