iobroker.device-watcher 2.13.1 → 2.15.0-alpha.1
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/LICENSE +1 -1
- package/README.md +26 -415
- package/admin/jsonConfig.json5 +1524 -2856
- package/io-package.json +544 -225
- package/lib/{arrApart.js → adapterArray.js} +809 -669
- package/lib/crud.js +1985 -1932
- package/lib/tools.js +158 -155
- package/lib/translations.js +26 -0
- package/main.js +384 -438
- package/package.json +16 -20
package/lib/crud.js
CHANGED
|
@@ -1,1932 +1,1985 @@
|
|
|
1
|
-
const translations = require(
|
|
2
|
-
const tools = require(
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @param
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
*
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
</
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
</
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
<
|
|
768
|
-
</
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
/**
|
|
1033
|
-
*
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
=
|
|
1108
|
-
=============================================*/
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
};
|
|
1932
|
-
|
|
1
|
+
const translations = require('./translations');
|
|
2
|
+
const tools = require('./tools');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param adaptr
|
|
6
|
+
* @param {object} adptName - Adaptername of devices
|
|
7
|
+
*/
|
|
8
|
+
async function createDPsForEachAdapter(adaptr, adptName) {
|
|
9
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}`, {
|
|
10
|
+
type: 'channel',
|
|
11
|
+
common: {
|
|
12
|
+
name: adptName,
|
|
13
|
+
},
|
|
14
|
+
native: {},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.offlineCount`, {
|
|
18
|
+
type: 'state',
|
|
19
|
+
common: {
|
|
20
|
+
name: {
|
|
21
|
+
en: 'Number of devices offline',
|
|
22
|
+
de: 'Anzahl der Geräte offline',
|
|
23
|
+
ru: 'Количество устройств оффлайн',
|
|
24
|
+
pt: 'Número de dispositivos offline',
|
|
25
|
+
nl: 'Aantal offline apparaten',
|
|
26
|
+
fr: 'Nombre de dispositifs hors ligne',
|
|
27
|
+
it: 'Numero di dispositivi offline',
|
|
28
|
+
es: 'Número de dispositivos sin conexión',
|
|
29
|
+
pl: 'Liczba urządzeń offline',
|
|
30
|
+
'zh-cn': '离线设备数量',
|
|
31
|
+
},
|
|
32
|
+
type: 'number',
|
|
33
|
+
role: 'value',
|
|
34
|
+
read: true,
|
|
35
|
+
write: false,
|
|
36
|
+
},
|
|
37
|
+
native: {},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.offlineList`, {
|
|
41
|
+
type: 'state',
|
|
42
|
+
common: {
|
|
43
|
+
name: {
|
|
44
|
+
en: 'List of offline devices',
|
|
45
|
+
de: 'Liste der Offline-Geräte',
|
|
46
|
+
ru: 'Список оффлайн устройств',
|
|
47
|
+
pt: 'Lista de dispositivos offline',
|
|
48
|
+
nl: 'Lijst van offline apparaten',
|
|
49
|
+
fr: 'Liste des dispositifs hors ligne',
|
|
50
|
+
it: 'Elenco dei dispositivi offline',
|
|
51
|
+
es: 'Lista de dispositivos sin conexión',
|
|
52
|
+
pl: 'Lista urządzeń offline',
|
|
53
|
+
'zh-cn': '离线设备列表',
|
|
54
|
+
},
|
|
55
|
+
type: 'array',
|
|
56
|
+
role: 'json',
|
|
57
|
+
read: true,
|
|
58
|
+
write: false,
|
|
59
|
+
},
|
|
60
|
+
native: {},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.oneDeviceOffline`, {
|
|
64
|
+
type: 'state',
|
|
65
|
+
common: {
|
|
66
|
+
name: {
|
|
67
|
+
en: 'Is one device offline',
|
|
68
|
+
de: 'Ist ein Gerät offline',
|
|
69
|
+
ru: 'Есть ли одно устройство оффлайн',
|
|
70
|
+
pt: 'Há um dispositivo offline',
|
|
71
|
+
nl: 'Is er een apparaat offline',
|
|
72
|
+
fr: 'Y a-t-il un appareil hors ligne',
|
|
73
|
+
it: "C'è un dispositivo offline",
|
|
74
|
+
es: '¿Hay un dispositivo sin conexión?',
|
|
75
|
+
pl: 'Czy jedno urządzenie jest offline',
|
|
76
|
+
uk: 'Чи є один пристрій офлайн',
|
|
77
|
+
'zh-cn': '是否有一台设备离线',
|
|
78
|
+
},
|
|
79
|
+
type: 'boolean',
|
|
80
|
+
role: 'state',
|
|
81
|
+
read: true,
|
|
82
|
+
write: false,
|
|
83
|
+
def: false,
|
|
84
|
+
},
|
|
85
|
+
native: {},
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.listAllRawJSON`, {
|
|
89
|
+
type: 'state',
|
|
90
|
+
common: {
|
|
91
|
+
name: {
|
|
92
|
+
en: 'JSON RAW List of all devices',
|
|
93
|
+
de: 'JSON RAW Liste aller Geräte',
|
|
94
|
+
ru: 'JSON RAW Список всех устройств',
|
|
95
|
+
pt: 'JSON RAW Lista de todos os dispositivos',
|
|
96
|
+
nl: 'JSON RAW Lijst van alle apparaten',
|
|
97
|
+
fr: 'JSON RAW Liste de tous les dispositifs',
|
|
98
|
+
it: 'JSON RAW Elenco di tutti i dispositivi',
|
|
99
|
+
es: 'JSON RAW Lista de todos los dispositivos',
|
|
100
|
+
pl: 'JSON RAW Lista wszystkich urządzeń',
|
|
101
|
+
uk: 'JSON RAW Список усіх пристроїв',
|
|
102
|
+
'zh-cn': 'JSON RAW 所有设备列表',
|
|
103
|
+
},
|
|
104
|
+
type: 'array',
|
|
105
|
+
role: 'json',
|
|
106
|
+
read: true,
|
|
107
|
+
write: false,
|
|
108
|
+
},
|
|
109
|
+
native: {},
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.listAll`, {
|
|
113
|
+
type: 'state',
|
|
114
|
+
common: {
|
|
115
|
+
name: {
|
|
116
|
+
en: 'List of all devices',
|
|
117
|
+
de: 'Liste aller Geräte',
|
|
118
|
+
ru: 'Список всех устройств',
|
|
119
|
+
pt: 'Lista de todos os dispositivos',
|
|
120
|
+
nl: 'Lijst van alle apparaten',
|
|
121
|
+
fr: 'Liste de tous les dispositifs',
|
|
122
|
+
it: 'Elenco di tutti i dispositivi',
|
|
123
|
+
es: 'Lista de todos los dispositivos',
|
|
124
|
+
pl: 'Lista wszystkich urządzeń',
|
|
125
|
+
'zh-cn': '所有设备的列表',
|
|
126
|
+
},
|
|
127
|
+
type: 'array',
|
|
128
|
+
role: 'json',
|
|
129
|
+
read: true,
|
|
130
|
+
write: false,
|
|
131
|
+
},
|
|
132
|
+
native: {},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.linkQualityList`, {
|
|
136
|
+
type: 'state',
|
|
137
|
+
common: {
|
|
138
|
+
name: {
|
|
139
|
+
en: 'List of devices with signal strength',
|
|
140
|
+
de: 'Liste der Geräte mit Signalstärke',
|
|
141
|
+
ru: 'Список устройств с уровнем сигнала',
|
|
142
|
+
pt: 'Lista de dispositivos com força de sinal',
|
|
143
|
+
nl: 'Lijst van apparaten met signaalkracht',
|
|
144
|
+
fr: 'Liste des dispositifs avec force de signal',
|
|
145
|
+
it: 'Elenco dei dispositivi con forza del segnale',
|
|
146
|
+
es: 'Lista de dispositivos con fuerza de señal',
|
|
147
|
+
pl: 'Lista urządzeń z siłą sygnału',
|
|
148
|
+
'zh-cn': '具有信号强度的设备列表',
|
|
149
|
+
},
|
|
150
|
+
type: 'array',
|
|
151
|
+
role: 'json',
|
|
152
|
+
read: true,
|
|
153
|
+
write: false,
|
|
154
|
+
},
|
|
155
|
+
native: {},
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.countAll`, {
|
|
159
|
+
type: 'state',
|
|
160
|
+
common: {
|
|
161
|
+
name: {
|
|
162
|
+
en: 'Number of all devices',
|
|
163
|
+
de: 'Anzahl aller Geräte',
|
|
164
|
+
ru: 'Количество всех устройств',
|
|
165
|
+
pt: 'Número de todos os dispositivos',
|
|
166
|
+
nl: 'Aantal van alle apparaten',
|
|
167
|
+
fr: 'Nombre de tous les appareils',
|
|
168
|
+
it: 'Numero di tutti i dispositivi',
|
|
169
|
+
es: 'Número de todos los dispositivos',
|
|
170
|
+
pl: 'Liczba wszystkich urządzeń',
|
|
171
|
+
'zh-cn': '所有设备的数量',
|
|
172
|
+
},
|
|
173
|
+
type: 'number',
|
|
174
|
+
role: 'value',
|
|
175
|
+
read: true,
|
|
176
|
+
write: false,
|
|
177
|
+
},
|
|
178
|
+
native: {},
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.batteryList`, {
|
|
182
|
+
type: 'state',
|
|
183
|
+
common: {
|
|
184
|
+
name: {
|
|
185
|
+
en: 'List of devices with battery state',
|
|
186
|
+
de: 'Liste der Geräte mit Batteriezustand',
|
|
187
|
+
ru: 'Список устройств с состоянием батареи',
|
|
188
|
+
pt: 'Lista de dispositivos com estado da bateria',
|
|
189
|
+
nl: 'Lijst van apparaten met batterijstatus',
|
|
190
|
+
fr: 'Liste des appareils avec état de batterie',
|
|
191
|
+
it: 'Elenco dei dispositivi con stato della batteria',
|
|
192
|
+
es: 'Lista de dispositivos con estado de batería',
|
|
193
|
+
pl: 'Lista urządzeń ze stanem baterii',
|
|
194
|
+
'zh-cn': '具有电池状态的设备列表',
|
|
195
|
+
},
|
|
196
|
+
type: 'array',
|
|
197
|
+
role: 'json',
|
|
198
|
+
read: true,
|
|
199
|
+
write: false,
|
|
200
|
+
},
|
|
201
|
+
native: {},
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.lowBatteryList`, {
|
|
205
|
+
type: 'state',
|
|
206
|
+
common: {
|
|
207
|
+
name: {
|
|
208
|
+
en: 'List of devices with low battery state',
|
|
209
|
+
de: 'Liste der Geräte mit niedrigem Batteriezustand',
|
|
210
|
+
ru: 'Список устройств с низким уровнем заряда батареи',
|
|
211
|
+
pt: 'Lista de dispositivos com baixo estado da bateria',
|
|
212
|
+
nl: 'Lijst van apparaten met lage batterijstatus',
|
|
213
|
+
fr: 'Liste des appareils à faible état de batterie',
|
|
214
|
+
it: 'Elenco di dispositivi con stato di batteria basso',
|
|
215
|
+
es: 'Lista de dispositivos con estado de batería bajo',
|
|
216
|
+
pl: 'Lista urządzeń o niskim stanie baterii',
|
|
217
|
+
'zh-cn': '低电量设备列表',
|
|
218
|
+
},
|
|
219
|
+
type: 'array',
|
|
220
|
+
role: 'json',
|
|
221
|
+
read: true,
|
|
222
|
+
write: false,
|
|
223
|
+
},
|
|
224
|
+
native: {},
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.lowBatteryCount`, {
|
|
228
|
+
type: 'state',
|
|
229
|
+
common: {
|
|
230
|
+
name: {
|
|
231
|
+
en: 'Number of devices with low battery',
|
|
232
|
+
de: 'Anzahl der Geräte mit niedriger Batterie',
|
|
233
|
+
ru: 'Количество устройств с низким зарядом батареи',
|
|
234
|
+
pt: 'Número de dispositivos com bateria baixa',
|
|
235
|
+
nl: 'Aantal apparaten met lage batterij',
|
|
236
|
+
fr: 'Nombre de dispositifs avec batterie faible',
|
|
237
|
+
it: 'Numero di dispositivi con batteria scarica',
|
|
238
|
+
es: 'Número de dispositivos con batería baja',
|
|
239
|
+
pl: 'Liczba urządzeń z niskim poziomem baterii',
|
|
240
|
+
'zh-cn': '低电量设备的数量',
|
|
241
|
+
},
|
|
242
|
+
type: 'number',
|
|
243
|
+
role: 'value',
|
|
244
|
+
read: true,
|
|
245
|
+
write: false,
|
|
246
|
+
},
|
|
247
|
+
native: {},
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.oneDeviceLowBat`, {
|
|
251
|
+
type: 'state',
|
|
252
|
+
common: {
|
|
253
|
+
name: {
|
|
254
|
+
en: 'Is one device with low battery',
|
|
255
|
+
de: 'Ist ein Gerät mit niedrigem Akku',
|
|
256
|
+
ru: 'Есть ли устройство с низким зарядом батареи',
|
|
257
|
+
pt: 'É um dispositivo com bateria baixa',
|
|
258
|
+
nl: 'Is er een apparaat met lage batterij',
|
|
259
|
+
fr: 'Y a-t-il un appareil avec batterie faible',
|
|
260
|
+
it: "C'è un dispositivo con batteria scarica",
|
|
261
|
+
es: '¿Hay un dispositivo con batería baja?',
|
|
262
|
+
pl: 'Czy jest jedno urządzenie z niskim poziomem baterii',
|
|
263
|
+
uk: 'Чи є пристрій з низьким зарядом батареї',
|
|
264
|
+
'zh-cn': '是否有设备电量低',
|
|
265
|
+
},
|
|
266
|
+
type: 'boolean',
|
|
267
|
+
role: 'state',
|
|
268
|
+
read: true,
|
|
269
|
+
write: false,
|
|
270
|
+
def: false,
|
|
271
|
+
},
|
|
272
|
+
native: {},
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.batteryCount`, {
|
|
276
|
+
type: 'state',
|
|
277
|
+
common: {
|
|
278
|
+
name: {
|
|
279
|
+
en: 'Number of devices with battery',
|
|
280
|
+
de: 'Anzahl der Geräte mit Batterie',
|
|
281
|
+
ru: 'Количество устройств с батареей',
|
|
282
|
+
pt: 'Número de dispositivos com bateria',
|
|
283
|
+
nl: 'Aantal apparaten met batterij',
|
|
284
|
+
fr: 'Nombre de dispositifs avec batterie',
|
|
285
|
+
it: 'Numero di dispositivi con batteria',
|
|
286
|
+
es: 'Número de dispositivos con batería',
|
|
287
|
+
pl: 'Liczba urządzeń z baterią',
|
|
288
|
+
'zh-cn': '带电池的设备数量',
|
|
289
|
+
},
|
|
290
|
+
type: 'number',
|
|
291
|
+
role: 'value',
|
|
292
|
+
read: true,
|
|
293
|
+
write: false,
|
|
294
|
+
},
|
|
295
|
+
native: {},
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.upgradableCount`, {
|
|
299
|
+
type: 'state',
|
|
300
|
+
common: {
|
|
301
|
+
name: {
|
|
302
|
+
en: 'Number of devices with available updates',
|
|
303
|
+
de: 'Anzahl der Geräte mit verfügbaren Updates',
|
|
304
|
+
ru: 'Количество устройств с доступными обновлениями',
|
|
305
|
+
pt: 'Número de dispositivos com atualizações disponíveis',
|
|
306
|
+
nl: 'Aantal apparaten met beschikbare updates',
|
|
307
|
+
fr: 'Nombre de dispositifs avec mises à jour disponibles',
|
|
308
|
+
it: 'Numero di dispositivi con aggiornamenti disponibili',
|
|
309
|
+
es: 'Número de dispositivos con actualizaciones disponibles',
|
|
310
|
+
pl: 'Liczba urządzeń z dostępnymi aktualizacjami',
|
|
311
|
+
uk: 'Кількість пристроїв з доступними оновленнями',
|
|
312
|
+
'zh-cn': '具有可用更新的设备数量',
|
|
313
|
+
},
|
|
314
|
+
type: 'number',
|
|
315
|
+
role: 'value',
|
|
316
|
+
read: true,
|
|
317
|
+
write: false,
|
|
318
|
+
},
|
|
319
|
+
native: {},
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.upgradableList`, {
|
|
323
|
+
type: 'state',
|
|
324
|
+
common: {
|
|
325
|
+
name: {
|
|
326
|
+
en: 'JSON List of devices with available updates',
|
|
327
|
+
de: 'JSON Liste der Geräte mit verfügbaren Updates',
|
|
328
|
+
ru: 'JSON список устройств с доступными обновлениями',
|
|
329
|
+
pt: 'JSON Lista de dispositivos com atualizações disponíveis',
|
|
330
|
+
nl: 'JSON Lijst van apparaten met beschikbare updates',
|
|
331
|
+
fr: 'JSON Liste des appareils avec mises à jour disponibles',
|
|
332
|
+
it: 'JSON Elenco dei dispositivi con aggiornamenti disponibili',
|
|
333
|
+
es: 'JSON Lista de dispositivos con actualizaciones disponibles',
|
|
334
|
+
pl: 'JSON Lista urządzeń z dostępnymi aktualizacjami',
|
|
335
|
+
uk: 'JSON список пристроїв з доступними оновленнями',
|
|
336
|
+
'zh-cn': '具有可用更新的设备的 JSON 列表',
|
|
337
|
+
},
|
|
338
|
+
type: 'array',
|
|
339
|
+
role: 'json',
|
|
340
|
+
read: true,
|
|
341
|
+
write: false,
|
|
342
|
+
},
|
|
343
|
+
native: {},
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
await adaptr.setObjectNotExistsAsync(`devices.${adptName}.oneDeviceUpdatable`, {
|
|
347
|
+
type: 'state',
|
|
348
|
+
common: {
|
|
349
|
+
name: {
|
|
350
|
+
en: 'Is one device updatable',
|
|
351
|
+
de: 'Ist ein Gerät aktualisierbar',
|
|
352
|
+
ru: 'Можно ли обновить одно устройство',
|
|
353
|
+
pt: 'É um dispositivo atualizável',
|
|
354
|
+
nl: 'Is er een apparaat dat kan worden bijgewerkt',
|
|
355
|
+
fr: 'Y a-t-il un appareil qui peut être mis à jour',
|
|
356
|
+
it: "C'è un dispositivo aggiornabile",
|
|
357
|
+
es: '¿Hay un dispositivo actualizable?',
|
|
358
|
+
pl: 'Czy jest jedno urządzenie do zaktualizowania',
|
|
359
|
+
uk: 'Чи є пристрій, який можна оновити',
|
|
360
|
+
'zh-cn': '是否有设备可更新',
|
|
361
|
+
},
|
|
362
|
+
type: 'boolean',
|
|
363
|
+
role: 'state',
|
|
364
|
+
read: true,
|
|
365
|
+
write: false,
|
|
366
|
+
def: false,
|
|
367
|
+
},
|
|
368
|
+
native: {},
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* delete datapoints for each adapter
|
|
374
|
+
*
|
|
375
|
+
* @param adaptr
|
|
376
|
+
* @param {object} adptName - Adaptername of devices
|
|
377
|
+
*/
|
|
378
|
+
async function deleteDPsForEachAdapter(adaptr, adptName) {
|
|
379
|
+
await adaptr.delObjectAsync(`devices.${adptName}`);
|
|
380
|
+
await adaptr.delObjectAsync(`devices.${adptName}.offlineCount`);
|
|
381
|
+
await adaptr.delObjectAsync(`devices.${adptName}.offlineList`);
|
|
382
|
+
await adaptr.delObjectAsync(`devices.${adptName}.oneDeviceOffline`);
|
|
383
|
+
await adaptr.delObjectAsync(`devices.${adptName}.listAllRawJSON`);
|
|
384
|
+
await adaptr.delObjectAsync(`devices.${adptName}.listAll`);
|
|
385
|
+
await adaptr.delObjectAsync(`devices.${adptName}.linkQualityList`);
|
|
386
|
+
await adaptr.delObjectAsync(`devices.${adptName}.countAll`);
|
|
387
|
+
await adaptr.delObjectAsync(`devices.${adptName}.batteryList`);
|
|
388
|
+
await adaptr.delObjectAsync(`devices.${adptName}.lowBatteryList`);
|
|
389
|
+
await adaptr.delObjectAsync(`devices.${adptName}.lowBatteryCount`);
|
|
390
|
+
await adaptr.delObjectAsync(`devices.${adptName}.oneDeviceLowBat`);
|
|
391
|
+
await adaptr.delObjectAsync(`devices.${adptName}.batteryCount`);
|
|
392
|
+
await adaptr.delObjectAsync(`devices.${adptName}.upgradableCount`);
|
|
393
|
+
await adaptr.delObjectAsync(`devices.${adptName}.upgradableList`);
|
|
394
|
+
await adaptr.delObjectAsync(`devices.${adptName}.oneDeviceUpdatable`);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* create HTML list datapoints
|
|
399
|
+
*
|
|
400
|
+
* @param adaptr
|
|
401
|
+
* @param {object} [adptName] - Adaptername of devices
|
|
402
|
+
*/
|
|
403
|
+
async function createHtmlListDatapoints(adaptr, adptName) {
|
|
404
|
+
let dpSubFolder;
|
|
405
|
+
//write the datapoints in subfolders with the adaptername otherwise write the dP's in the root folder
|
|
406
|
+
if (adptName) {
|
|
407
|
+
dpSubFolder = `${adptName}.`;
|
|
408
|
+
} else {
|
|
409
|
+
dpSubFolder = '';
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
await adaptr.setObjectNotExistsAsync(`devices.${dpSubFolder}offlineListHTML`, {
|
|
413
|
+
type: 'state',
|
|
414
|
+
common: {
|
|
415
|
+
name: {
|
|
416
|
+
en: 'HTML List of offline devices',
|
|
417
|
+
de: 'HTML Liste der Offline-Geräte',
|
|
418
|
+
ru: 'HTML список оффлайн устройств',
|
|
419
|
+
pt: 'HTML Lista de dispositivos offline',
|
|
420
|
+
nl: 'HTML Lijst van offline apparaten',
|
|
421
|
+
fr: 'HTML Liste des dispositifs hors ligne',
|
|
422
|
+
it: 'HTML Elenco dei dispositivi offline',
|
|
423
|
+
es: 'HTML Lista de dispositivos sin conexión',
|
|
424
|
+
pl: 'HTML Lista urządzeń offline',
|
|
425
|
+
'zh-cn': 'HTML 离线设备列表',
|
|
426
|
+
},
|
|
427
|
+
type: 'string',
|
|
428
|
+
role: 'html',
|
|
429
|
+
read: true,
|
|
430
|
+
write: false,
|
|
431
|
+
},
|
|
432
|
+
native: {},
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
await adaptr.setObjectNotExistsAsync(`devices.${dpSubFolder}linkQualityListHTML`, {
|
|
436
|
+
type: 'state',
|
|
437
|
+
common: {
|
|
438
|
+
name: {
|
|
439
|
+
en: 'HTML List of devices with signal strength',
|
|
440
|
+
de: 'HTML Liste der Geräte mit Signalstärke',
|
|
441
|
+
ru: 'HTML список устройств с уровнем сигнала',
|
|
442
|
+
pt: 'HTML Lista de dispositivos com força de sinal',
|
|
443
|
+
nl: 'HTML Lijst van apparaten met signaalkracht',
|
|
444
|
+
fr: 'HTML Liste des dispositifs avec force de signal',
|
|
445
|
+
it: 'HTML Elenco dei dispositivi con forza del segnale',
|
|
446
|
+
es: 'HTML Lista de dispositivos con fuerza de señal',
|
|
447
|
+
pl: 'HTML Lista urządzeń z siłą sygnału',
|
|
448
|
+
'zh-cn': 'HTML 具有信号强度的设备列表',
|
|
449
|
+
},
|
|
450
|
+
type: 'string',
|
|
451
|
+
role: 'value',
|
|
452
|
+
read: true,
|
|
453
|
+
write: false,
|
|
454
|
+
},
|
|
455
|
+
native: {},
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
await adaptr.setObjectNotExistsAsync(`devices.${dpSubFolder}batteryListHTML`, {
|
|
459
|
+
type: 'state',
|
|
460
|
+
common: {
|
|
461
|
+
name: {
|
|
462
|
+
en: 'HTML List of devices with battery state',
|
|
463
|
+
de: 'HTML Liste der Geräte mit Batteriezustand',
|
|
464
|
+
ru: 'HTML список устройств с состоянием батареи',
|
|
465
|
+
pt: 'HTML Lista de dispositivos com estado da bateria',
|
|
466
|
+
nl: 'HTML Lijst van apparaten met batterijstatus',
|
|
467
|
+
fr: 'HTML Liste des appareils avec état de batterie',
|
|
468
|
+
it: 'HTML Elenco dei dispositivi con stato della batteria',
|
|
469
|
+
es: 'HTML Lista de dispositivos con estado de batería',
|
|
470
|
+
pl: 'HTML Lista urządzeń ze stanem baterii',
|
|
471
|
+
'zh-cn': 'HTML 具有电池状态的设备列表',
|
|
472
|
+
},
|
|
473
|
+
type: 'string',
|
|
474
|
+
role: 'html',
|
|
475
|
+
read: true,
|
|
476
|
+
write: false,
|
|
477
|
+
},
|
|
478
|
+
native: {},
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
await adaptr.setObjectNotExistsAsync(`devices.${dpSubFolder}lowBatteryListHTML`, {
|
|
482
|
+
type: 'state',
|
|
483
|
+
common: {
|
|
484
|
+
name: {
|
|
485
|
+
en: 'HTML List of devices with low battery state',
|
|
486
|
+
de: 'HTML Liste der Geräte mit niedrigem Batteriezustand',
|
|
487
|
+
ru: 'HTML список устройств с низким уровнем заряда батареи',
|
|
488
|
+
pt: 'HTML Lista de dispositivos com baixo estado da bateria',
|
|
489
|
+
nl: 'HTML Lijst van apparaten met lage batterijstatus',
|
|
490
|
+
fr: 'HTML Liste des appareils à faible état de batterie',
|
|
491
|
+
it: 'HTML Elenco di dispositivi con stato di batteria basso',
|
|
492
|
+
es: 'HTML Lista de dispositivos con estado de batería bajo',
|
|
493
|
+
pl: 'HTML Lista urządzeń o niskim stanie baterii',
|
|
494
|
+
'zh-cn': 'HTML 低电量设备列表',
|
|
495
|
+
},
|
|
496
|
+
type: 'string',
|
|
497
|
+
role: 'html',
|
|
498
|
+
read: true,
|
|
499
|
+
write: false,
|
|
500
|
+
},
|
|
501
|
+
native: {},
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* delete html datapoints
|
|
507
|
+
*
|
|
508
|
+
* @param adaptr
|
|
509
|
+
* @param {object} [adptName] - Adaptername of devices
|
|
510
|
+
*/
|
|
511
|
+
async function deleteHtmlListDatapoints(adaptr, adptName) {
|
|
512
|
+
// delete the datapoints in subfolders with the adaptername otherwise delete the dP's in the root folder
|
|
513
|
+
let dpSubFolder;
|
|
514
|
+
if (adptName) {
|
|
515
|
+
dpSubFolder = `${adptName}.`;
|
|
516
|
+
} else {
|
|
517
|
+
dpSubFolder = '';
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
await adaptr.delObjectAsync(`devices.${dpSubFolder}offlineListHTML`);
|
|
521
|
+
await adaptr.delObjectAsync(`devices.${dpSubFolder}linkQualityListHTML`);
|
|
522
|
+
await adaptr.delObjectAsync(`devices.${dpSubFolder}batteryListHTML`);
|
|
523
|
+
await adaptr.delObjectAsync(`devices.${dpSubFolder}lowBatteryListHTML`);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* create HTML list datapoints for instances
|
|
528
|
+
*
|
|
529
|
+
* @param adaptr
|
|
530
|
+
*/
|
|
531
|
+
async function createHtmlListDatapointsInstances(adaptr) {
|
|
532
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.HTML_Lists`, {
|
|
533
|
+
type: 'channel',
|
|
534
|
+
common: {
|
|
535
|
+
name: {
|
|
536
|
+
en: 'HTML lists for adapter and instances',
|
|
537
|
+
de: 'HTML-Listen für Adapter und Instanzen',
|
|
538
|
+
ru: 'HTML списки для адаптера и экземпляров',
|
|
539
|
+
pt: 'Listas HTML para adaptador e instâncias',
|
|
540
|
+
nl: 'HTML lijsten voor adapter en instanties',
|
|
541
|
+
fr: "Listes HTML pour l'adaptateur et les instances",
|
|
542
|
+
it: 'Elenchi HTML per adattatore e istanze',
|
|
543
|
+
es: 'Listas HTML para adaptador e instancias',
|
|
544
|
+
pl: 'Listy HTML dla adaptera i instancji',
|
|
545
|
+
uk: 'HTML списки для адаптера та екземплярів',
|
|
546
|
+
'zh-cn': '适配器和实例的 HTML 列表',
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
native: {},
|
|
550
|
+
});
|
|
551
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.HTML_Lists.listAllInstancesHTML`, {
|
|
552
|
+
type: 'state',
|
|
553
|
+
common: {
|
|
554
|
+
name: {
|
|
555
|
+
en: 'HTML List of all instances',
|
|
556
|
+
de: 'HTML Liste aller Instanzen',
|
|
557
|
+
ru: 'HTML список всех экземпляров',
|
|
558
|
+
pt: 'HTML Lista de todas as instâncias',
|
|
559
|
+
nl: 'HTML Lijst van alle instanties',
|
|
560
|
+
fr: 'HTML Liste de toutes les instances',
|
|
561
|
+
it: 'HTML Elenco di tutte le istanze',
|
|
562
|
+
es: 'HTML Lista de todas las instancias',
|
|
563
|
+
pl: 'HTML Lista wszystkich instancji',
|
|
564
|
+
uk: 'HTML список усіх екземплярів',
|
|
565
|
+
'zh-cn': 'HTML 所有实例的列表',
|
|
566
|
+
},
|
|
567
|
+
type: 'string',
|
|
568
|
+
role: 'html',
|
|
569
|
+
read: true,
|
|
570
|
+
write: false,
|
|
571
|
+
},
|
|
572
|
+
native: {},
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.HTML_Lists.listAllActiveInstancesHTML`, {
|
|
576
|
+
type: 'state',
|
|
577
|
+
common: {
|
|
578
|
+
name: {
|
|
579
|
+
en: 'HTML List of all active instances',
|
|
580
|
+
de: 'HTML Liste aller aktiven Instanzen',
|
|
581
|
+
ru: 'HTML список всех активных экземпляров',
|
|
582
|
+
pt: 'HTML Lista de todas as instâncias ativas',
|
|
583
|
+
nl: 'HTML Lijst van alle actieve instanties',
|
|
584
|
+
fr: 'HTML Liste de toutes les instances actives',
|
|
585
|
+
it: 'HTML Elenco di tutte le istanze attive',
|
|
586
|
+
es: 'HTML Lista de todas las instancias activas',
|
|
587
|
+
pl: 'HTML Lista wszystkich aktywnych instancji',
|
|
588
|
+
uk: 'HTML список усіх активних екземплярів',
|
|
589
|
+
'zh-cn': 'HTML 所有活动实例的列表',
|
|
590
|
+
},
|
|
591
|
+
type: 'string',
|
|
592
|
+
role: 'value',
|
|
593
|
+
read: true,
|
|
594
|
+
write: false,
|
|
595
|
+
},
|
|
596
|
+
native: {},
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.HTML_Lists.listDeactivatedInstancesHTML`, {
|
|
600
|
+
type: 'state',
|
|
601
|
+
common: {
|
|
602
|
+
name: {
|
|
603
|
+
en: 'HTML List of all deactivated instances',
|
|
604
|
+
de: 'HTML Liste aller deaktivierten Instanzen',
|
|
605
|
+
ru: 'HTML список всех деактивированных экземпляров',
|
|
606
|
+
pt: 'HTML Lista de todas as instâncias desativadas',
|
|
607
|
+
nl: 'HTML Lijst van alle gedeactiveerde instanties',
|
|
608
|
+
fr: 'HTML Liste de toutes les instances désactivées',
|
|
609
|
+
it: 'HTML Elenco di tutte le istanze disattivate',
|
|
610
|
+
es: 'HTML Lista de todas las instancias desactivadas',
|
|
611
|
+
pl: 'HTML Lista wszystkich dezaktywowanych instancji',
|
|
612
|
+
uk: 'HTML список усіх деактивованих екземплярів',
|
|
613
|
+
'zh-cn': 'HTML 所有已停用实例的列表',
|
|
614
|
+
},
|
|
615
|
+
type: 'string',
|
|
616
|
+
role: 'html',
|
|
617
|
+
read: true,
|
|
618
|
+
write: false,
|
|
619
|
+
},
|
|
620
|
+
native: {},
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.HTML_Lists.listInstancesErrorHTML`, {
|
|
624
|
+
type: 'state',
|
|
625
|
+
common: {
|
|
626
|
+
name: {
|
|
627
|
+
en: 'HTML List of instances with error',
|
|
628
|
+
de: 'HTML Liste der Instanzen mit Fehler',
|
|
629
|
+
ru: 'HTML список экземпляров с ошибкой',
|
|
630
|
+
pt: 'HTML Lista de instâncias com erro',
|
|
631
|
+
nl: 'HTML Lijst van instanties met fouten',
|
|
632
|
+
fr: 'HTML Liste des instances avec erreur',
|
|
633
|
+
it: 'HTML Elenco delle istanze con errore',
|
|
634
|
+
es: 'HTML Lista de instancias con error',
|
|
635
|
+
pl: 'HTML Lista instancji z błędem',
|
|
636
|
+
uk: 'HTML список екземплярів з помилкою',
|
|
637
|
+
'zh-cn': 'HTML 含错误实例的列表',
|
|
638
|
+
},
|
|
639
|
+
type: 'string',
|
|
640
|
+
role: 'html',
|
|
641
|
+
read: true,
|
|
642
|
+
write: false,
|
|
643
|
+
},
|
|
644
|
+
native: {},
|
|
645
|
+
});
|
|
646
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.HTML_Lists.listAdapterUpdatesHTML`, {
|
|
647
|
+
type: 'state',
|
|
648
|
+
common: {
|
|
649
|
+
name: {
|
|
650
|
+
en: 'HTML list of adapters with available updates',
|
|
651
|
+
de: 'HTML-Liste der Adapter mit verfügbaren Updates',
|
|
652
|
+
ru: 'HTML список адаптеров с доступными обновлениями',
|
|
653
|
+
pt: 'Lista HTML de adaptadores com atualizações disponíveis',
|
|
654
|
+
nl: 'HTML lijst van adapters met beschikbare updates',
|
|
655
|
+
fr: 'Liste HTML des adaptateurs avec mises à jour disponibles',
|
|
656
|
+
it: 'Elenco HTML degli adattatori con aggiornamenti disponibili',
|
|
657
|
+
es: 'Lista HTML de adaptadores con actualizaciones disponibles',
|
|
658
|
+
pl: 'Lista adapterów HTML z dostępnymi aktualizacjami',
|
|
659
|
+
uk: 'HTML список адаптерів з доступними оновленнями',
|
|
660
|
+
'zh-cn': 'HTML 具有可用更新的适配器列表',
|
|
661
|
+
},
|
|
662
|
+
type: 'string',
|
|
663
|
+
role: 'html',
|
|
664
|
+
read: true,
|
|
665
|
+
write: false,
|
|
666
|
+
},
|
|
667
|
+
native: {},
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* delete html datapoints for instances
|
|
673
|
+
*
|
|
674
|
+
* @param adaptr
|
|
675
|
+
*/
|
|
676
|
+
async function deleteHtmlListDatapointsInstances(adaptr) {
|
|
677
|
+
await adaptr.delObjectAsync(`adapterAndInstances.HTML_Lists.listAllInstancesHTML`);
|
|
678
|
+
await adaptr.delObjectAsync(`adapterAndInstances.HTML_Lists.listAllActiveInstancesHTML`);
|
|
679
|
+
await adaptr.delObjectAsync(`adapterAndInstances.HTML_Lists.listDeactivatedInstancesHTML`);
|
|
680
|
+
await adaptr.delObjectAsync(`adapterAndInstances.HTML_Lists.listInstancesErrorHTML`);
|
|
681
|
+
await adaptr.delObjectAsync(`adapterAndInstances.HTML_Lists.listAdapterUpdatesHTML`);
|
|
682
|
+
await adaptr.delObjectAsync(`adapterAndInstances.HTML_Lists`);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/*=============================================
|
|
686
|
+
= functions to create html lists =
|
|
687
|
+
=============================================*/
|
|
688
|
+
/**
|
|
689
|
+
* @param adaptr
|
|
690
|
+
* @param {string} type - type of list
|
|
691
|
+
* @param {object} devices - Device
|
|
692
|
+
* @param {number} deviceCount - Counted devices
|
|
693
|
+
* @param {object} isLowBatteryList - list Low Battery Devices
|
|
694
|
+
*/
|
|
695
|
+
async function createListHTML(adaptr, type, devices, deviceCount, isLowBatteryList) {
|
|
696
|
+
let html;
|
|
697
|
+
switch (type) {
|
|
698
|
+
case 'linkQualityList':
|
|
699
|
+
devices = devices.sort((a, b) => {
|
|
700
|
+
a = a.Device || '';
|
|
701
|
+
b = b.Device || '';
|
|
702
|
+
return a.localeCompare(b);
|
|
703
|
+
});
|
|
704
|
+
html = `<center>
|
|
705
|
+
<b>${[translations.Link_quality_devices[adaptr.config.userSelectedLanguage]]}:<font> ${deviceCount}</b><small></small></font>
|
|
706
|
+
<p></p>
|
|
707
|
+
</center>
|
|
708
|
+
<table width=100%>
|
|
709
|
+
<tr>
|
|
710
|
+
<th align=left>${[translations.Device[adaptr.config.userSelectedLanguage]]}</th>
|
|
711
|
+
<th align=center width=120>${[translations.Adapter[adaptr.config.userSelectedLanguage]]}</th>
|
|
712
|
+
<th align=right>${[translations.Signal_strength[adaptr.config.userSelectedLanguage]]}</th>
|
|
713
|
+
</tr>
|
|
714
|
+
<tr>
|
|
715
|
+
<td colspan="5"><hr></td>
|
|
716
|
+
</tr>`;
|
|
717
|
+
|
|
718
|
+
for (const device of devices) {
|
|
719
|
+
html += `<tr>
|
|
720
|
+
<td><font>${device[translations.Device[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
721
|
+
<td align=center><font>${device[translations.Adapter[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
722
|
+
<td align=right><font>${device[translations.Signal_strength[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
723
|
+
</tr>`;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
html += '</table>';
|
|
727
|
+
break;
|
|
728
|
+
|
|
729
|
+
case 'offlineList':
|
|
730
|
+
devices = devices.sort((a, b) => {
|
|
731
|
+
a = a.Device || '';
|
|
732
|
+
b = b.Device || '';
|
|
733
|
+
return a.localeCompare(b);
|
|
734
|
+
});
|
|
735
|
+
html = `<center>
|
|
736
|
+
<b>${[translations.offline_devices[adaptr.config.userSelectedLanguage]]}: <font color=${deviceCount === 0 ? '#3bcf0e' : 'orange'}>${deviceCount}</b><small></small></font>
|
|
737
|
+
<p></p>
|
|
738
|
+
</center>
|
|
739
|
+
<table width=100%>
|
|
740
|
+
<tr>
|
|
741
|
+
<th align=left>${[translations.Device[adaptr.config.userSelectedLanguage]]}</th>
|
|
742
|
+
<th align=center width=120>${[translations.Adapter[adaptr.config.userSelectedLanguage]]}</th>
|
|
743
|
+
<th align=center>${[translations.Last_Contact[adaptr.config.userSelectedLanguage]]}</th>
|
|
744
|
+
</tr>
|
|
745
|
+
<tr>
|
|
746
|
+
<td colspan="5"><hr></td>
|
|
747
|
+
</tr>`;
|
|
748
|
+
|
|
749
|
+
for (const device of devices) {
|
|
750
|
+
html += `<tr>
|
|
751
|
+
<td><font>${device[translations.Device[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
752
|
+
<td align=center><font>${device[translations.Adapter[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
753
|
+
<td align=center><font color=orange>${device[translations.Last_Contact[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
754
|
+
</tr>`;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
html += '</table>';
|
|
758
|
+
break;
|
|
759
|
+
|
|
760
|
+
case 'batteryList':
|
|
761
|
+
devices = devices.sort((a, b) => {
|
|
762
|
+
a = a.Device || '';
|
|
763
|
+
b = b.Device || '';
|
|
764
|
+
return a.localeCompare(b);
|
|
765
|
+
});
|
|
766
|
+
html = `<center>
|
|
767
|
+
<b>${isLowBatteryList === true ? `${[translations.low[adaptr.config.userSelectedLanguage]]} ` : ''}${[translations.battery_devices[adaptr.config.userSelectedLanguage]]}:
|
|
768
|
+
<font color=${isLowBatteryList === true ? (deviceCount > 0 ? 'orange' : '#3bcf0e') : ''}>${deviceCount}</b></font>
|
|
769
|
+
<p></p>
|
|
770
|
+
</center>
|
|
771
|
+
<table width=100%>
|
|
772
|
+
<tr>
|
|
773
|
+
<th align=left>${[translations.Device[adaptr.config.userSelectedLanguage]]}</th>
|
|
774
|
+
<th align=center width=120>${[translations.Adapter[adaptr.config.userSelectedLanguage]]}</th>
|
|
775
|
+
<th align=${isLowBatteryList ? 'center' : 'right'}>${[translations.Battery[adaptr.config.userSelectedLanguage]]}</th>
|
|
776
|
+
</tr>
|
|
777
|
+
<tr>
|
|
778
|
+
<td colspan="5"><hr></td>
|
|
779
|
+
</tr>`;
|
|
780
|
+
for (const device of devices) {
|
|
781
|
+
html += `<tr>
|
|
782
|
+
<td><font>${device[translations.Device[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
783
|
+
<td align=center><font>${device[translations.Adapter[adaptr.config.userSelectedLanguage]]}</font></td>`;
|
|
784
|
+
|
|
785
|
+
if (isLowBatteryList) {
|
|
786
|
+
html += `<td align=center><font color=orange>${device[translations.Battery[adaptr.config.userSelectedLanguage]]}</font></td>`;
|
|
787
|
+
} else {
|
|
788
|
+
html += `<td align=right><font color=#3bcf0e>${device[translations.Battery[adaptr.config.userSelectedLanguage]]}</font></td>`;
|
|
789
|
+
}
|
|
790
|
+
html += `</tr>`;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
html += '</table>';
|
|
794
|
+
break;
|
|
795
|
+
}
|
|
796
|
+
return html;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* @param adaptr
|
|
801
|
+
* @param {string} type - type of list
|
|
802
|
+
* @param {object} instances - Instance
|
|
803
|
+
* @param {number} instancesCount - Counted devices
|
|
804
|
+
*/
|
|
805
|
+
async function createListHTMLInstances(adaptr, type, instances, instancesCount) {
|
|
806
|
+
let html;
|
|
807
|
+
switch (type) {
|
|
808
|
+
case 'allInstancesList':
|
|
809
|
+
instances = instances.sort((a, b) => {
|
|
810
|
+
a = a.Instance || '';
|
|
811
|
+
b = b.Instance || '';
|
|
812
|
+
return a.localeCompare(b);
|
|
813
|
+
});
|
|
814
|
+
html = `<center>
|
|
815
|
+
<b>${[translations.All_Instances[adaptr.config.userSelectedLanguage]]}:<font> ${instancesCount}</b><small></small></font>
|
|
816
|
+
<p></p>
|
|
817
|
+
</center>
|
|
818
|
+
<table width=100%>
|
|
819
|
+
<tr>
|
|
820
|
+
<th align=left>${[translations.Adapter[adaptr.config.userSelectedLanguage]]}</th>
|
|
821
|
+
<th align=center>${[translations.Instance[adaptr.config.userSelectedLanguage]]}</th>
|
|
822
|
+
<th align=center width=180>${[translations.Status[adaptr.config.userSelectedLanguage]]}</th>
|
|
823
|
+
</tr>
|
|
824
|
+
<tr>
|
|
825
|
+
<td colspan="5"><hr></td>
|
|
826
|
+
</tr>`;
|
|
827
|
+
|
|
828
|
+
for (const instanceData of instances) {
|
|
829
|
+
html += `<tr>
|
|
830
|
+
<td><font>${instanceData[translations.Adapter[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
831
|
+
<td align=center><font>${instanceData[translations.Instance[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
832
|
+
<td align=center><font>${instanceData[translations.Status[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
833
|
+
</tr>`;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
html += '</table>';
|
|
837
|
+
break;
|
|
838
|
+
|
|
839
|
+
case 'allActiveInstancesList':
|
|
840
|
+
instances = instances.sort((a, b) => {
|
|
841
|
+
a = a.Instance || '';
|
|
842
|
+
b = b.Instances || '';
|
|
843
|
+
return a.localeCompare(b);
|
|
844
|
+
});
|
|
845
|
+
html = `<center>
|
|
846
|
+
<b>${[translations.Active_Instances[adaptr.config.userSelectedLanguage]]}: <font> ${instancesCount}</b><small></small></font>
|
|
847
|
+
<p></p>
|
|
848
|
+
</center>
|
|
849
|
+
<table width=100%>
|
|
850
|
+
<tr>
|
|
851
|
+
<th align=left>${[translations.Adapter[adaptr.config.userSelectedLanguage]]}</th>
|
|
852
|
+
<th align=center>${[translations.Instance[adaptr.config.userSelectedLanguage]]}</th>
|
|
853
|
+
<th align=center width=180>${[translations.Status[adaptr.config.userSelectedLanguage]]}</th>
|
|
854
|
+
</tr>
|
|
855
|
+
<tr>
|
|
856
|
+
<td colspan="5"><hr></td>
|
|
857
|
+
</tr>`;
|
|
858
|
+
|
|
859
|
+
for (const instanceData of instances) {
|
|
860
|
+
html += `<tr>
|
|
861
|
+
<td><font>${instanceData[translations.Adapter[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
862
|
+
<td align=center><font>${instanceData[translations.Instance[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
863
|
+
<td align=center><font color=orange>${instanceData[translations.Status[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
864
|
+
</tr>`;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
html += '</table>';
|
|
868
|
+
break;
|
|
869
|
+
|
|
870
|
+
case 'errorInstanceList':
|
|
871
|
+
instances = instances.sort((a, b) => {
|
|
872
|
+
a = a.Instance || '';
|
|
873
|
+
b = b.Instances || '';
|
|
874
|
+
return a.localeCompare(b);
|
|
875
|
+
});
|
|
876
|
+
html = `<center>
|
|
877
|
+
<b>${[translations.Error_Instances[adaptr.config.userSelectedLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
|
|
878
|
+
<p></p>
|
|
879
|
+
</center>
|
|
880
|
+
<table width=100%>
|
|
881
|
+
<tr>
|
|
882
|
+
<th align=left>${[translations.Adapter[adaptr.config.userSelectedLanguage]]}</th>
|
|
883
|
+
<th align=center>${[translations.Instance[adaptr.config.userSelectedLanguage]]}</th>
|
|
884
|
+
<th align=center width=180>${[translations.Status[adaptr.config.userSelectedLanguage]]}</th>
|
|
885
|
+
</tr>
|
|
886
|
+
<tr>
|
|
887
|
+
<td colspan="5"><hr></td>
|
|
888
|
+
</tr>`;
|
|
889
|
+
|
|
890
|
+
for (const instanceData of instances) {
|
|
891
|
+
html += `<tr>
|
|
892
|
+
<td><font>${instanceData[translations.Adapter[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
893
|
+
<td align=center><font>${instanceData[translations.Instance[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
894
|
+
<td align=center><font color=orange>${instanceData[translations.Status[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
895
|
+
</tr>`;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
html += '</table>';
|
|
899
|
+
break;
|
|
900
|
+
|
|
901
|
+
case 'deactivatedInstanceList':
|
|
902
|
+
instances = instances.sort((a, b) => {
|
|
903
|
+
a = a.Instance || '';
|
|
904
|
+
b = b.Instances || '';
|
|
905
|
+
return a.localeCompare(b);
|
|
906
|
+
});
|
|
907
|
+
html = `<center>
|
|
908
|
+
<b>${[translations.Deactivated_Instances[adaptr.config.userSelectedLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
|
|
909
|
+
<p></p>
|
|
910
|
+
</center>
|
|
911
|
+
<table width=100%>
|
|
912
|
+
<tr>
|
|
913
|
+
<th align=left>${[translations.Adapter[adaptr.config.userSelectedLanguage]]}</th>
|
|
914
|
+
<th align=center>${[translations.Instance[adaptr.config.userSelectedLanguage]]}</th>
|
|
915
|
+
<th align=center width=180>${[translations.Status[adaptr.config.userSelectedLanguage]]}</th>
|
|
916
|
+
</tr>
|
|
917
|
+
<tr>
|
|
918
|
+
<td colspan="5"><hr></td>
|
|
919
|
+
</tr>`;
|
|
920
|
+
|
|
921
|
+
for (const instanceData of instances) {
|
|
922
|
+
if (!instanceData.isAlive) {
|
|
923
|
+
html += `<tr>
|
|
924
|
+
<td><font>${instanceData[translations.Adapter[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
925
|
+
<td align=center><font>${instanceData[translations.Instance[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
926
|
+
<td align=center><font color=orange>${instanceData[translations.Status[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
927
|
+
</tr>`;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
html += '</table>';
|
|
932
|
+
break;
|
|
933
|
+
|
|
934
|
+
case 'updateAdapterList':
|
|
935
|
+
html = `<center>
|
|
936
|
+
<b>${[translations.Updatable_adapters[adaptr.config.userSelectedLanguage]]}: <font color=${instancesCount === 0 ? '#3bcf0e' : 'orange'}>${instancesCount}</b><small></small></font>
|
|
937
|
+
<p></p>
|
|
938
|
+
</center>
|
|
939
|
+
<table width=100%>
|
|
940
|
+
<tr>
|
|
941
|
+
<th align=left>${[translations.Adapter[adaptr.config.userSelectedLanguage]]}</th>
|
|
942
|
+
<th align=center>${[translations.Installed_Version[adaptr.config.userSelectedLanguage]]}</th>
|
|
943
|
+
<th align=center>${[translations.Available_Version[adaptr.config.userSelectedLanguage]]}</th>
|
|
944
|
+
</tr>
|
|
945
|
+
<tr>
|
|
946
|
+
<td colspan="5"><hr></td>
|
|
947
|
+
</tr>`;
|
|
948
|
+
|
|
949
|
+
for (const instanceData of instances.values()) {
|
|
950
|
+
if (instanceData.updateAvailable !== ' - ') {
|
|
951
|
+
html += `<tr>
|
|
952
|
+
<td><font>${instanceData[translations.Adapter[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
953
|
+
<td align=center><font>${instanceData[translations.Installed_Version[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
954
|
+
<td align=center><font color=orange>${instanceData[translations.Available_Version[adaptr.config.userSelectedLanguage]]}</font></td>
|
|
955
|
+
</tr>`;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
html += '</table>';
|
|
960
|
+
break;
|
|
961
|
+
}
|
|
962
|
+
return html;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* create blacklist
|
|
967
|
+
*
|
|
968
|
+
* @param adaptr
|
|
969
|
+
*/
|
|
970
|
+
async function createBlacklist(adaptr) {
|
|
971
|
+
adaptr.log.debug(`Start the function createBlacklist`);
|
|
972
|
+
|
|
973
|
+
// DEVICES
|
|
974
|
+
const myBlacklist = adaptr.config.tableBlacklist;
|
|
975
|
+
if (myBlacklist.length >= 1) {
|
|
976
|
+
for (const i in myBlacklist) {
|
|
977
|
+
try {
|
|
978
|
+
const blacklistParse = tools.parseData(myBlacklist[i].devices);
|
|
979
|
+
// push devices in list to ignor device in lists
|
|
980
|
+
if (myBlacklist[i].checkIgnorLists) {
|
|
981
|
+
adaptr.blacklistLists.push(blacklistParse.path);
|
|
982
|
+
}
|
|
983
|
+
if (myBlacklist[i].checkIgnorAdapterLists) {
|
|
984
|
+
adaptr.blacklistAdapterLists.push(blacklistParse.path);
|
|
985
|
+
}
|
|
986
|
+
// push devices in list to ignor device in notifications
|
|
987
|
+
if (myBlacklist[i].checkIgnorNotify) {
|
|
988
|
+
adaptr.blacklistNotify.push(blacklistParse.path);
|
|
989
|
+
}
|
|
990
|
+
} catch (error) {
|
|
991
|
+
adaptr.log.error(`[createBlacklist] - ${error}`);
|
|
992
|
+
}
|
|
993
|
+
if (adaptr.blacklistLists.length >= 1) {
|
|
994
|
+
adaptr.log.info(`Found devices/services on blacklist for lists: ${adaptr.blacklistLists}`);
|
|
995
|
+
}
|
|
996
|
+
if (adaptr.blacklistAdapterLists.length >= 1) {
|
|
997
|
+
adaptr.log.info(`Found devices/services on blacklist for own adapter lists: ${adaptr.blacklistAdapterLists}`);
|
|
998
|
+
}
|
|
999
|
+
if (adaptr.blacklistNotify.length >= 1) {
|
|
1000
|
+
adaptr.log.info(`Found devices/services on blacklist for notifications: ${adaptr.blacklistNotify}`);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// INSTANCES
|
|
1006
|
+
const myBlacklistInstances = adaptr.config.tableBlacklistInstances;
|
|
1007
|
+
if (myBlacklistInstances.length >= 1) {
|
|
1008
|
+
for (const i in myBlacklistInstances) {
|
|
1009
|
+
try {
|
|
1010
|
+
const blacklistParse = tools.parseData(myBlacklistInstances[i].instances);
|
|
1011
|
+
// push devices in list to ignor device in lists
|
|
1012
|
+
if (myBlacklistInstances[i].checkIgnorLists) {
|
|
1013
|
+
adaptr.blacklistInstancesLists.push(blacklistParse.instanceID);
|
|
1014
|
+
}
|
|
1015
|
+
// push devices in list to ignor device in notifications
|
|
1016
|
+
if (myBlacklistInstances[i].checkIgnorNotify) {
|
|
1017
|
+
adaptr.blacklistInstancesNotify.push(blacklistParse.instanceID);
|
|
1018
|
+
}
|
|
1019
|
+
} catch (error) {
|
|
1020
|
+
adaptr.log.error(`[createBlacklist] - ${error}`);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
if (adaptr.blacklistInstancesLists.length >= 1) {
|
|
1024
|
+
adaptr.log.info(`Found instances items on blacklist for lists: ${adaptr.blacklistInstancesLists}`);
|
|
1025
|
+
}
|
|
1026
|
+
if (adaptr.blacklistInstancesNotify.length >= 1) {
|
|
1027
|
+
adaptr.log.info(`Found instances items on blacklist for notifications: ${adaptr.blacklistInstancesNotify}`);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* create list with time for instances
|
|
1034
|
+
*
|
|
1035
|
+
* @param adaptr
|
|
1036
|
+
*/
|
|
1037
|
+
async function createTimeListInstances(adaptr) {
|
|
1038
|
+
// INSTANCES
|
|
1039
|
+
const userTimeListInstances = adaptr.config.tableTimeInstance;
|
|
1040
|
+
|
|
1041
|
+
if (userTimeListInstances.length >= 1) {
|
|
1042
|
+
for (const i in userTimeListInstances) {
|
|
1043
|
+
try {
|
|
1044
|
+
const userTimeListparse = tools.parseData(userTimeListInstances[i].instancesTime);
|
|
1045
|
+
// push devices in list to ignor device in lists
|
|
1046
|
+
adaptr.userTimeInstancesList.set(userTimeListparse.instanceName, {
|
|
1047
|
+
deactivationTime: userTimeListInstances[i].deactivationTime,
|
|
1048
|
+
errorTime: userTimeListInstances[i].errorTime,
|
|
1049
|
+
});
|
|
1050
|
+
} catch (error) {
|
|
1051
|
+
adaptr.log.error(`[createTimeListInstances] - ${error}`);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
if (adaptr.userTimeInstancesList.size >= 1) {
|
|
1055
|
+
adaptr.log.info(`Found instances items on lists for timesettings: ${Array.from(adaptr.userTimeInstancesList.keys())}`);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* @param adaptr
|
|
1062
|
+
* @param {object} i - Device Object
|
|
1063
|
+
*/
|
|
1064
|
+
async function createData(adaptr, i) {
|
|
1065
|
+
try {
|
|
1066
|
+
const devices = await adaptr.getForeignStatesAsync(adaptr.selAdapter[i].selektor);
|
|
1067
|
+
const adapterID = adaptr.selAdapter[i].adapterID;
|
|
1068
|
+
|
|
1069
|
+
/*---------- Start of loop ----------*/
|
|
1070
|
+
for (const [id] of Object.entries(devices)) {
|
|
1071
|
+
if (id.endsWith('.')) {
|
|
1072
|
+
continue;
|
|
1073
|
+
}
|
|
1074
|
+
const mainSelector = id;
|
|
1075
|
+
|
|
1076
|
+
/*=============================================
|
|
1077
|
+
= get Instanz =
|
|
1078
|
+
=============================================*/
|
|
1079
|
+
const instance = id.slice(0, id.indexOf('.') + 2);
|
|
1080
|
+
|
|
1081
|
+
let instanceDeviceConnectionDP = `${instance}.info.connection`;
|
|
1082
|
+
let instanceDeviceConnected = await tools.getInitValue(adaptr, instanceDeviceConnectionDP);
|
|
1083
|
+
|
|
1084
|
+
if (instanceDeviceConnected === undefined) {
|
|
1085
|
+
const sysAdmin = `system.adapter.${instanceDeviceConnectionDP.replace('info.connection', 'connected')}`;
|
|
1086
|
+
instanceDeviceConnectionDP = sysAdmin;
|
|
1087
|
+
instanceDeviceConnected = await tools.getInitValue(adaptr, sysAdmin);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
adaptr.subscribeForeignStates(instanceDeviceConnectionDP);
|
|
1091
|
+
adaptr.subscribeForeignObjects(`${adaptr.selAdapter[i].selektor}`);
|
|
1092
|
+
|
|
1093
|
+
const deviceName = await adaptr.getDeviceName(id, i);
|
|
1094
|
+
|
|
1095
|
+
const adapter = adaptr.selAdapter[i].adapter;
|
|
1096
|
+
|
|
1097
|
+
/*=============================================
|
|
1098
|
+
= Get path to datapoints =
|
|
1099
|
+
=============================================*/
|
|
1100
|
+
const currDeviceString = id.slice(0, id.lastIndexOf('.') + 1 - 1);
|
|
1101
|
+
const shortCurrDeviceString = currDeviceString.slice(0, currDeviceString.lastIndexOf('.') + 1 - 1);
|
|
1102
|
+
|
|
1103
|
+
// subscribe to object device path
|
|
1104
|
+
adaptr.subscribeForeignStates(currDeviceString);
|
|
1105
|
+
|
|
1106
|
+
/*=============================================
|
|
1107
|
+
= Get signal strength =
|
|
1108
|
+
=============================================*/
|
|
1109
|
+
let deviceQualityDP = currDeviceString + adaptr.selAdapter[i].rssiState;
|
|
1110
|
+
let deviceQualityState;
|
|
1111
|
+
let linkQuality;
|
|
1112
|
+
let linkQualityRaw;
|
|
1113
|
+
|
|
1114
|
+
if (!deviceQualityDP.includes('undefined')) {
|
|
1115
|
+
switch (adapterID) {
|
|
1116
|
+
case 'mihomeVacuum':
|
|
1117
|
+
deviceQualityDP = shortCurrDeviceString + adaptr.selAdapter[i].rssiState;
|
|
1118
|
+
deviceQualityState = await adaptr.getForeignStateAsync(deviceQualityDP);
|
|
1119
|
+
break;
|
|
1120
|
+
|
|
1121
|
+
case 'netatmo':
|
|
1122
|
+
deviceQualityState = await adaptr.getForeignStateAsync(deviceQualityDP);
|
|
1123
|
+
if (!deviceQualityState) {
|
|
1124
|
+
deviceQualityDP = currDeviceString + adaptr.selAdapter[i].rfState;
|
|
1125
|
+
deviceQualityState = await adaptr.getForeignStateAsync(deviceQualityDP);
|
|
1126
|
+
}
|
|
1127
|
+
break;
|
|
1128
|
+
|
|
1129
|
+
default:
|
|
1130
|
+
deviceQualityState = await adaptr.getForeignStateAsync(deviceQualityDP);
|
|
1131
|
+
}
|
|
1132
|
+
//subscribe to states
|
|
1133
|
+
adaptr.subscribeForeignStates(deviceQualityDP);
|
|
1134
|
+
|
|
1135
|
+
const signalData = await adaptr.calculateSignalStrength(deviceQualityState, adapterID);
|
|
1136
|
+
linkQuality = signalData[0];
|
|
1137
|
+
linkQualityRaw = signalData[1];
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/*=============================================
|
|
1141
|
+
= Get battery data =
|
|
1142
|
+
=============================================*/
|
|
1143
|
+
let deviceBatteryStateDP;
|
|
1144
|
+
let deviceBatteryState;
|
|
1145
|
+
let batteryHealth;
|
|
1146
|
+
let batteryHealthRaw;
|
|
1147
|
+
let batteryUnitRaw;
|
|
1148
|
+
let lowBatIndicator;
|
|
1149
|
+
let isBatteryDevice;
|
|
1150
|
+
let isLowBatDP;
|
|
1151
|
+
let faultReportingDP;
|
|
1152
|
+
let faultReportingState;
|
|
1153
|
+
|
|
1154
|
+
const deviceChargerStateDP = currDeviceString + adaptr.selAdapter[i].charger;
|
|
1155
|
+
const deviceChargerState = await tools.getInitValue(adaptr, deviceChargerStateDP);
|
|
1156
|
+
|
|
1157
|
+
if (deviceChargerState === undefined || deviceChargerState === false) {
|
|
1158
|
+
// Get battery states
|
|
1159
|
+
switch (adapterID) {
|
|
1160
|
+
case 'hmrpc':
|
|
1161
|
+
deviceBatteryStateDP = currDeviceString + adaptr.selAdapter[i].battery;
|
|
1162
|
+
deviceBatteryState = await tools.getInitValue(adaptr, deviceBatteryStateDP);
|
|
1163
|
+
|
|
1164
|
+
if (deviceBatteryState === undefined) {
|
|
1165
|
+
deviceBatteryStateDP = shortCurrDeviceString + adaptr.selAdapter[i].hmDNBattery;
|
|
1166
|
+
deviceBatteryState = await tools.getInitValue(adaptr, deviceBatteryStateDP);
|
|
1167
|
+
}
|
|
1168
|
+
break;
|
|
1169
|
+
case 'hueExt':
|
|
1170
|
+
case 'mihomeVacuum':
|
|
1171
|
+
case 'mqttNuki':
|
|
1172
|
+
case 'loqedSmartLock':
|
|
1173
|
+
deviceBatteryStateDP = shortCurrDeviceString + adaptr.selAdapter[i].battery;
|
|
1174
|
+
deviceBatteryState = await tools.getInitValue(adaptr, deviceBatteryStateDP);
|
|
1175
|
+
|
|
1176
|
+
if (deviceBatteryState === undefined) {
|
|
1177
|
+
deviceBatteryStateDP = shortCurrDeviceString + adaptr.selAdapter[i].battery2;
|
|
1178
|
+
deviceBatteryState = await tools.getInitValue(adaptr, deviceBatteryStateDP);
|
|
1179
|
+
}
|
|
1180
|
+
break;
|
|
1181
|
+
case 'homee': // only battery devices, structure problem like homee.0.*.BatteryLevel-964
|
|
1182
|
+
const devicePrefix = `${currDeviceString}.BatteryLevel-`;
|
|
1183
|
+
const listeDP = await adaptr.getObjectViewAsync('system', 'state', {
|
|
1184
|
+
startkey: `${devicePrefix}`,
|
|
1185
|
+
endkey: `${devicePrefix}\u9999`,
|
|
1186
|
+
});
|
|
1187
|
+
|
|
1188
|
+
if (listeDP.rows.length > 0) {
|
|
1189
|
+
deviceBatteryStateDP = listeDP.rows[0].id;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
deviceBatteryState = await tools.getInitValue(adaptr, deviceBatteryStateDP);
|
|
1193
|
+
break;
|
|
1194
|
+
|
|
1195
|
+
default:
|
|
1196
|
+
deviceBatteryStateDP = currDeviceString + adaptr.selAdapter[i].battery;
|
|
1197
|
+
deviceBatteryState = await tools.getInitValue(adaptr, deviceBatteryStateDP);
|
|
1198
|
+
|
|
1199
|
+
if (deviceBatteryState === undefined) {
|
|
1200
|
+
deviceBatteryStateDP = currDeviceString + adaptr.selAdapter[i].battery2;
|
|
1201
|
+
deviceBatteryState = await tools.getInitValue(adaptr, deviceBatteryStateDP);
|
|
1202
|
+
|
|
1203
|
+
if (deviceBatteryState === undefined) {
|
|
1204
|
+
deviceBatteryStateDP = currDeviceString + adaptr.selAdapter[i].battery3;
|
|
1205
|
+
deviceBatteryState = await tools.getInitValue(adaptr, deviceBatteryStateDP);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
// Get low bat states
|
|
1212
|
+
isLowBatDP = currDeviceString + adaptr.selAdapter[i].isLowBat;
|
|
1213
|
+
let deviceLowBatState = await tools.getInitValue(adaptr, isLowBatDP);
|
|
1214
|
+
|
|
1215
|
+
if (deviceLowBatState === undefined) {
|
|
1216
|
+
isLowBatDP = currDeviceString + adaptr.selAdapter[i].isLowBat2;
|
|
1217
|
+
deviceLowBatState = await tools.getInitValue(adaptr, isLowBatDP);
|
|
1218
|
+
|
|
1219
|
+
if (deviceLowBatState === undefined) {
|
|
1220
|
+
isLowBatDP = currDeviceString + adaptr.selAdapter[i].isLowBat3;
|
|
1221
|
+
deviceLowBatState = await tools.getInitValue(adaptr, isLowBatDP);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
if (deviceLowBatState === undefined) {
|
|
1225
|
+
isLowBatDP = 'none';
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
faultReportingDP = shortCurrDeviceString + adaptr.selAdapter[i].faultReporting;
|
|
1229
|
+
faultReportingState = await tools.getInitValue(adaptr, faultReportingDP);
|
|
1230
|
+
|
|
1231
|
+
//subscribe to states
|
|
1232
|
+
adaptr.subscribeForeignStates(deviceBatteryStateDP);
|
|
1233
|
+
adaptr.subscribeForeignStates(isLowBatDP);
|
|
1234
|
+
adaptr.subscribeForeignStates(faultReportingDP);
|
|
1235
|
+
|
|
1236
|
+
const batteryData = await adaptr.getBatteryData(deviceBatteryState, deviceLowBatState, faultReportingState, adapterID);
|
|
1237
|
+
|
|
1238
|
+
batteryHealth = batteryData[0];
|
|
1239
|
+
batteryHealthRaw = batteryData[2];
|
|
1240
|
+
batteryUnitRaw = batteryData[3];
|
|
1241
|
+
isBatteryDevice = batteryData[1];
|
|
1242
|
+
|
|
1243
|
+
if (isBatteryDevice) {
|
|
1244
|
+
lowBatIndicator = await adaptr.setLowbatIndicator(deviceBatteryState, deviceLowBatState, faultReportingState, adapterID);
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/*=============================================
|
|
1249
|
+
= Get last contact of device =
|
|
1250
|
+
=============================================*/
|
|
1251
|
+
let deviceStateSelectorHMRPC;
|
|
1252
|
+
let rssiPeerSelectorHMRPC;
|
|
1253
|
+
|
|
1254
|
+
// HMRPC
|
|
1255
|
+
if (adaptr.selAdapter[i].stateValue != undefined) {
|
|
1256
|
+
deviceStateSelectorHMRPC = shortCurrDeviceString + adaptr.selAdapter[i].stateValue;
|
|
1257
|
+
rssiPeerSelectorHMRPC = currDeviceString + adaptr.selAdapter[i].rssiPeerState;
|
|
1258
|
+
adaptr.subscribeForeignStates(deviceStateSelectorHMRPC);
|
|
1259
|
+
adaptr.subscribeForeignStates(rssiPeerSelectorHMRPC);
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
let timeSelector = currDeviceString + adaptr.selAdapter[i].timeSelector;
|
|
1263
|
+
const timeSelectorState = await tools.getInitValue(adaptr, timeSelector);
|
|
1264
|
+
|
|
1265
|
+
if (timeSelectorState === undefined) {
|
|
1266
|
+
timeSelector = shortCurrDeviceString + adaptr.selAdapter[i].timeSelector;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
let unreachDP = currDeviceString + adaptr.selAdapter[i].reach;
|
|
1270
|
+
|
|
1271
|
+
let deviceUnreachState = await tools.getInitValue(adaptr, unreachDP);
|
|
1272
|
+
|
|
1273
|
+
if (deviceUnreachState === undefined) {
|
|
1274
|
+
unreachDP = shortCurrDeviceString + adaptr.selAdapter[i].reach;
|
|
1275
|
+
deviceUnreachState = await tools.getInitValue(adaptr, shortCurrDeviceString + adaptr.selAdapter[i].reach);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
// subscribe to states
|
|
1279
|
+
adaptr.subscribeForeignStates(timeSelector);
|
|
1280
|
+
adaptr.subscribeForeignStates(unreachDP);
|
|
1281
|
+
|
|
1282
|
+
const onlineState = await adaptr.getOnlineState(timeSelector, adapterID, unreachDP, linkQuality, deviceUnreachState, deviceStateSelectorHMRPC, rssiPeerSelectorHMRPC);
|
|
1283
|
+
|
|
1284
|
+
let deviceState;
|
|
1285
|
+
let lastContactString;
|
|
1286
|
+
|
|
1287
|
+
if (onlineState !== undefined && onlineState !== null) {
|
|
1288
|
+
lastContactString = onlineState[0];
|
|
1289
|
+
deviceState = onlineState[1];
|
|
1290
|
+
linkQuality = onlineState[2];
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
/*=============================================
|
|
1294
|
+
= Get update data =
|
|
1295
|
+
=============================================*/
|
|
1296
|
+
let isUpgradable = ' - ';
|
|
1297
|
+
let deviceUpdateDP;
|
|
1298
|
+
|
|
1299
|
+
if (adaptr.config.checkSendDeviceUpgrade) {
|
|
1300
|
+
deviceUpdateDP = currDeviceString + adaptr.selAdapter[i].upgrade;
|
|
1301
|
+
let deviceUpdateSelector = await tools.getInitValue(adaptr, deviceUpdateDP);
|
|
1302
|
+
if (deviceUpdateSelector === undefined) {
|
|
1303
|
+
deviceUpdateDP = shortCurrDeviceString + adaptr.selAdapter[i].upgrade;
|
|
1304
|
+
deviceUpdateSelector = await tools.getInitValue(adaptr, deviceUpdateDP);
|
|
1305
|
+
if (deviceUpdateSelector === undefined) {
|
|
1306
|
+
const shortShortCurrDeviceString = shortCurrDeviceString.slice(0, shortCurrDeviceString.lastIndexOf('.') + 1 - 1);
|
|
1307
|
+
deviceUpdateDP = shortShortCurrDeviceString + adaptr.selAdapter[i].upgrade;
|
|
1308
|
+
deviceUpdateSelector = await tools.getInitValue(adaptr, deviceUpdateDP);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
if (deviceUpdateSelector !== undefined) {
|
|
1313
|
+
isUpgradable = await adaptr.checkDeviceUpdate(adapterID, deviceUpdateSelector);
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
adaptr.subscribeForeignStates(deviceUpdateDP);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
/*=============================================
|
|
1320
|
+
= Fill Raw Lists =
|
|
1321
|
+
=============================================*/
|
|
1322
|
+
const setupList = () => {
|
|
1323
|
+
adaptr.listAllDevicesRaw.set(currDeviceString, {
|
|
1324
|
+
Path: id,
|
|
1325
|
+
mainSelector: mainSelector,
|
|
1326
|
+
instanceDeviceConnectionDP: instanceDeviceConnectionDP,
|
|
1327
|
+
instanceDeviceConnected: instanceDeviceConnected,
|
|
1328
|
+
instance: instance,
|
|
1329
|
+
Device: deviceName,
|
|
1330
|
+
adapterID: adapterID,
|
|
1331
|
+
Adapter: adapter,
|
|
1332
|
+
timeSelector: timeSelector,
|
|
1333
|
+
isBatteryDevice: isBatteryDevice,
|
|
1334
|
+
Battery: batteryHealth,
|
|
1335
|
+
BatteryRaw: batteryHealthRaw,
|
|
1336
|
+
BatteryUnitRaw: batteryUnitRaw,
|
|
1337
|
+
batteryDP: deviceBatteryStateDP,
|
|
1338
|
+
LowBat: lowBatIndicator,
|
|
1339
|
+
LowBatDP: isLowBatDP,
|
|
1340
|
+
faultReport: faultReportingState,
|
|
1341
|
+
faultReportDP: faultReportingDP,
|
|
1342
|
+
SignalStrengthDP: deviceQualityDP,
|
|
1343
|
+
SignalStrength: linkQuality,
|
|
1344
|
+
SignalStrengthRaw: linkQualityRaw,
|
|
1345
|
+
UnreachState: deviceUnreachState,
|
|
1346
|
+
UnreachDP: unreachDP,
|
|
1347
|
+
deviceStateSelectorHMRPC: deviceStateSelectorHMRPC,
|
|
1348
|
+
rssiPeerSelectorHMRPC: rssiPeerSelectorHMRPC,
|
|
1349
|
+
LastContact: lastContactString,
|
|
1350
|
+
Status: deviceState,
|
|
1351
|
+
UpdateDP: deviceUpdateDP,
|
|
1352
|
+
Upgradable: isUpgradable,
|
|
1353
|
+
});
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
if (!adaptr.configListOnlyBattery) {
|
|
1357
|
+
// Add all devices
|
|
1358
|
+
setupList();
|
|
1359
|
+
} else {
|
|
1360
|
+
// Add only devices with battery in the rawlist
|
|
1361
|
+
if (!isBatteryDevice) {
|
|
1362
|
+
continue;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
setupList();
|
|
1366
|
+
}
|
|
1367
|
+
} // <-- end of loop
|
|
1368
|
+
} catch (error) {
|
|
1369
|
+
adaptr.log.error(`[createData - create data of devices] - ${error}`);
|
|
1370
|
+
}
|
|
1371
|
+
} // <-- end of createData
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* Create Lists
|
|
1375
|
+
*
|
|
1376
|
+
* @param adaptr
|
|
1377
|
+
* @param {string | undefined} [adptName]
|
|
1378
|
+
*/
|
|
1379
|
+
async function createLists(adaptr, adptName) {
|
|
1380
|
+
adaptr.linkQualityDevices = [];
|
|
1381
|
+
adaptr.batteryPowered = [];
|
|
1382
|
+
adaptr.batteryLowPowered = [];
|
|
1383
|
+
adaptr.listAllDevicesUserRaw = [];
|
|
1384
|
+
adaptr.listAllDevices = [];
|
|
1385
|
+
adaptr.offlineDevices = [];
|
|
1386
|
+
adaptr.batteryLowPoweredRaw = [];
|
|
1387
|
+
adaptr.offlineDevicesRaw = [];
|
|
1388
|
+
adaptr.upgradableDevicesRaw = [];
|
|
1389
|
+
adaptr.upgradableList = [];
|
|
1390
|
+
|
|
1391
|
+
if (adptName === undefined) {
|
|
1392
|
+
adptName = '';
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
for (const deviceData of adaptr.listAllDevicesRaw.values()) {
|
|
1396
|
+
/*---------- fill raw lists ----------*/
|
|
1397
|
+
// low bat list
|
|
1398
|
+
if (deviceData.LowBat && deviceData.Status !== 'Offline') {
|
|
1399
|
+
adaptr.batteryLowPoweredRaw.push({
|
|
1400
|
+
Path: deviceData.Path,
|
|
1401
|
+
Device: deviceData.Device,
|
|
1402
|
+
Adapter: deviceData.Adapter,
|
|
1403
|
+
Battery: deviceData.Battery,
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
// offline raw list
|
|
1407
|
+
if (deviceData.Status === 'Offline') {
|
|
1408
|
+
adaptr.offlineDevicesRaw.push({
|
|
1409
|
+
Path: deviceData.Path,
|
|
1410
|
+
Device: deviceData.Device,
|
|
1411
|
+
Adapter: deviceData.Adapter,
|
|
1412
|
+
LastContact: deviceData.LastContact,
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
// upgradable raw list
|
|
1417
|
+
if (deviceData.Upgradable === true) {
|
|
1418
|
+
adaptr.upgradableDevicesRaw.push({
|
|
1419
|
+
Path: deviceData.Path,
|
|
1420
|
+
Device: deviceData.Device,
|
|
1421
|
+
Adapter: deviceData.Adapter,
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
if (adptName === '' && !adaptr.blacklistLists.includes(deviceData.Path)) {
|
|
1426
|
+
await adaptr.theLists(deviceData);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
if (adaptr.config.createOwnFolder && adptName !== '') {
|
|
1430
|
+
if (!deviceData.adapterID.includes(adptName)) {
|
|
1431
|
+
continue;
|
|
1432
|
+
}
|
|
1433
|
+
/*---------- fill user lists for each adapter ----------*/
|
|
1434
|
+
if (adaptr.blacklistAdapterLists.includes(deviceData.Path)) {
|
|
1435
|
+
continue;
|
|
1436
|
+
}
|
|
1437
|
+
await adaptr.theLists(deviceData);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
await tools.countDevices(adaptr);
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
/**
|
|
1444
|
+
* @param adaptr
|
|
1445
|
+
* @param {string} [adptName] - Adaptername
|
|
1446
|
+
*/
|
|
1447
|
+
async function writeDatapoints(adaptr, adptName) {
|
|
1448
|
+
// fill the datapoints
|
|
1449
|
+
adaptr.log.debug(`Start the function writeDatapoints`);
|
|
1450
|
+
|
|
1451
|
+
try {
|
|
1452
|
+
let dpSubFolder;
|
|
1453
|
+
//write the datapoints in subfolders with the adaptername otherwise write the dP's in the root folder
|
|
1454
|
+
if (adptName) {
|
|
1455
|
+
dpSubFolder = `${adptName}.`;
|
|
1456
|
+
} else {
|
|
1457
|
+
dpSubFolder = '';
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
// Write Datapoints for counts
|
|
1461
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}offlineCount`, { val: adaptr.offlineDevicesCount, ack: true });
|
|
1462
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}countAll`, { val: adaptr.deviceCounter, ack: true });
|
|
1463
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}batteryCount`, { val: adaptr.batteryPoweredCount, ack: true });
|
|
1464
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}lowBatteryCount`, { val: adaptr.lowBatteryPoweredCount, ack: true });
|
|
1465
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}upgradableCount`, { val: adaptr.upgradableDevicesCount, ack: true });
|
|
1466
|
+
// List all devices
|
|
1467
|
+
if (adaptr.deviceCounter === 0) {
|
|
1468
|
+
// if no device is count, write the JSON List with default value
|
|
1469
|
+
adaptr.listAllDevices = [
|
|
1470
|
+
{
|
|
1471
|
+
[translations.Device[adaptr.config.userSelectedLanguage]]: '--none--',
|
|
1472
|
+
[translations.Adapter[adaptr.config.userSelectedLanguage]]: '',
|
|
1473
|
+
[translations.Battery[adaptr.config.userSelectedLanguage]]: '',
|
|
1474
|
+
[translations.Signal_strength[adaptr.config.userSelectedLanguage]]: '',
|
|
1475
|
+
[translations.Last_Contact[adaptr.config.userSelectedLanguage]]: '',
|
|
1476
|
+
[translations.Status[adaptr.config.userSelectedLanguage]]: '',
|
|
1477
|
+
},
|
|
1478
|
+
];
|
|
1479
|
+
adaptr.listAllDevicesUserRaw = [
|
|
1480
|
+
{
|
|
1481
|
+
Device: '--none--',
|
|
1482
|
+
Adapter: '',
|
|
1483
|
+
Instance: '',
|
|
1484
|
+
'Instance connected': '',
|
|
1485
|
+
isBatteryDevice: '',
|
|
1486
|
+
Battery: '',
|
|
1487
|
+
BatteryRaw: '',
|
|
1488
|
+
isLowBat: '',
|
|
1489
|
+
'Signal strength': '',
|
|
1490
|
+
'Last contact': '',
|
|
1491
|
+
UpdateAvailable: '',
|
|
1492
|
+
Status: '',
|
|
1493
|
+
},
|
|
1494
|
+
];
|
|
1495
|
+
}
|
|
1496
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}listAll`, { val: JSON.stringify(adaptr.listAllDevices), ack: true });
|
|
1497
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}listAllRawJSON`, { val: JSON.stringify(adaptr.listAllDevicesUserRaw), ack: true });
|
|
1498
|
+
|
|
1499
|
+
// List link quality
|
|
1500
|
+
if (adaptr.linkQualityCount === 0) {
|
|
1501
|
+
// if no device is count, write the JSON List with default value
|
|
1502
|
+
adaptr.linkQualityDevices = [
|
|
1503
|
+
{
|
|
1504
|
+
[translations.Device[adaptr.config.userSelectedLanguage]]: '--none--',
|
|
1505
|
+
[translations.Adapter[adaptr.config.userSelectedLanguage]]: '',
|
|
1506
|
+
[translations.Signal_strength[adaptr.config.userSelectedLanguage]]: '',
|
|
1507
|
+
},
|
|
1508
|
+
];
|
|
1509
|
+
}
|
|
1510
|
+
//write JSON list
|
|
1511
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}linkQualityList`, {
|
|
1512
|
+
val: JSON.stringify(adaptr.linkQualityDevices),
|
|
1513
|
+
ack: true,
|
|
1514
|
+
});
|
|
1515
|
+
|
|
1516
|
+
// List offline devices
|
|
1517
|
+
if (adaptr.offlineDevicesCount === 0) {
|
|
1518
|
+
// if no device is count, write the JSON List with default value
|
|
1519
|
+
adaptr.offlineDevices = [
|
|
1520
|
+
{
|
|
1521
|
+
[translations.Device[adaptr.config.userSelectedLanguage]]: '--none--',
|
|
1522
|
+
[translations.Adapter[adaptr.config.userSelectedLanguage]]: '',
|
|
1523
|
+
[translations.Last_Contact[adaptr.config.userSelectedLanguage]]: '',
|
|
1524
|
+
},
|
|
1525
|
+
];
|
|
1526
|
+
}
|
|
1527
|
+
//write JSON list
|
|
1528
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}offlineList`, {
|
|
1529
|
+
val: JSON.stringify(adaptr.offlineDevices),
|
|
1530
|
+
ack: true,
|
|
1531
|
+
});
|
|
1532
|
+
|
|
1533
|
+
// List updatable
|
|
1534
|
+
if (adaptr.upgradableDevicesCount === 0) {
|
|
1535
|
+
// if no device is count, write the JSON List with default value
|
|
1536
|
+
adaptr.upgradableList = [
|
|
1537
|
+
{
|
|
1538
|
+
[translations.Device[adaptr.config.userSelectedLanguage]]: '--none--',
|
|
1539
|
+
[translations.Adapter[adaptr.config.userSelectedLanguage]]: '',
|
|
1540
|
+
[translations.Last_Contact[adaptr.config.userSelectedLanguage]]: '',
|
|
1541
|
+
},
|
|
1542
|
+
];
|
|
1543
|
+
}
|
|
1544
|
+
//write JSON list
|
|
1545
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}upgradableList`, {
|
|
1546
|
+
val: JSON.stringify(adaptr.upgradableList),
|
|
1547
|
+
ack: true,
|
|
1548
|
+
});
|
|
1549
|
+
|
|
1550
|
+
// List battery powered
|
|
1551
|
+
if (adaptr.batteryPoweredCount === 0) {
|
|
1552
|
+
// if no device is count, write the JSON List with default value
|
|
1553
|
+
adaptr.batteryPowered = [
|
|
1554
|
+
{
|
|
1555
|
+
[translations.Device[adaptr.config.userSelectedLanguage]]: '--none--',
|
|
1556
|
+
[translations.Adapter[adaptr.config.userSelectedLanguage]]: '',
|
|
1557
|
+
[translations.Battery[adaptr.config.userSelectedLanguage]]: '',
|
|
1558
|
+
},
|
|
1559
|
+
];
|
|
1560
|
+
}
|
|
1561
|
+
//write JSON list
|
|
1562
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}batteryList`, {
|
|
1563
|
+
val: JSON.stringify(adaptr.batteryPowered),
|
|
1564
|
+
ack: true,
|
|
1565
|
+
});
|
|
1566
|
+
|
|
1567
|
+
// list battery low powered
|
|
1568
|
+
if (adaptr.lowBatteryPoweredCount === 0) {
|
|
1569
|
+
// if no device is count, write the JSON List with default value
|
|
1570
|
+
adaptr.batteryLowPowered = [
|
|
1571
|
+
{
|
|
1572
|
+
[translations.Device[adaptr.config.userSelectedLanguage]]: '--none--',
|
|
1573
|
+
[translations.Adapter[adaptr.config.userSelectedLanguage]]: '',
|
|
1574
|
+
[translations.Battery[adaptr.config.userSelectedLanguage]]: '',
|
|
1575
|
+
},
|
|
1576
|
+
];
|
|
1577
|
+
}
|
|
1578
|
+
//write JSON list
|
|
1579
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}lowBatteryList`, {
|
|
1580
|
+
val: JSON.stringify(adaptr.batteryLowPowered),
|
|
1581
|
+
ack: true,
|
|
1582
|
+
});
|
|
1583
|
+
|
|
1584
|
+
// set booleans datapoints
|
|
1585
|
+
if (adaptr.offlineDevicesCount === 0) {
|
|
1586
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}oneDeviceOffline`, {
|
|
1587
|
+
val: false,
|
|
1588
|
+
ack: true,
|
|
1589
|
+
});
|
|
1590
|
+
} else {
|
|
1591
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}oneDeviceOffline`, {
|
|
1592
|
+
val: true,
|
|
1593
|
+
ack: true,
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
if (adaptr.lowBatteryPoweredCount === 0) {
|
|
1598
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}oneDeviceLowBat`, {
|
|
1599
|
+
val: false,
|
|
1600
|
+
ack: true,
|
|
1601
|
+
});
|
|
1602
|
+
} else {
|
|
1603
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}oneDeviceLowBat`, {
|
|
1604
|
+
val: true,
|
|
1605
|
+
ack: true,
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
if (adaptr.upgradableDevicesCount === 0) {
|
|
1610
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}oneDeviceUpdatable`, {
|
|
1611
|
+
val: false,
|
|
1612
|
+
ack: true,
|
|
1613
|
+
});
|
|
1614
|
+
} else {
|
|
1615
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}oneDeviceUpdatable`, {
|
|
1616
|
+
val: true,
|
|
1617
|
+
ack: true,
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
//write HTML list
|
|
1622
|
+
if (adaptr.configCreateHtmlList) {
|
|
1623
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}linkQualityListHTML`, {
|
|
1624
|
+
val: await this.createListHTML(adaptr, 'linkQualityList', adaptr.linkQualityDevices, adaptr.linkQualityCount, null),
|
|
1625
|
+
ack: true,
|
|
1626
|
+
});
|
|
1627
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}offlineListHTML`, {
|
|
1628
|
+
val: await this.createListHTML(adaptr, 'offlineList', adaptr.offlineDevices, adaptr.offlineDevicesCount, null),
|
|
1629
|
+
ack: true,
|
|
1630
|
+
});
|
|
1631
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}batteryListHTML`, {
|
|
1632
|
+
val: await this.createListHTML(adaptr, 'batteryList', adaptr.batteryPowered, adaptr.batteryPoweredCount, false),
|
|
1633
|
+
ack: true,
|
|
1634
|
+
});
|
|
1635
|
+
await adaptr.setStateChangedAsync(`devices.${dpSubFolder}lowBatteryListHTML`, {
|
|
1636
|
+
val: await this.createListHTML(adaptr, 'batteryList', adaptr.batteryLowPowered, adaptr.lowBatteryPoweredCount, true),
|
|
1637
|
+
ack: true,
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
if (adaptr.config.checkAdapterInstances) {
|
|
1641
|
+
await adaptr.setStateChangedAsync(`adapterAndInstances.HTML_Lists.listAllInstancesHTML`, {
|
|
1642
|
+
val: await this.createListHTMLInstances(adaptr, 'allInstancesList', adaptr.listAllInstances, adaptr.countAllInstances),
|
|
1643
|
+
ack: true,
|
|
1644
|
+
});
|
|
1645
|
+
await adaptr.setStateChangedAsync(`adapterAndInstances.HTML_Lists.listAllActiveInstancesHTML`, {
|
|
1646
|
+
val: await this.createListHTMLInstances(adaptr, 'allActiveInstancesList', adaptr.listAllActiveInstances, adaptr.countAllActiveInstances),
|
|
1647
|
+
ack: true,
|
|
1648
|
+
});
|
|
1649
|
+
await adaptr.setStateChangedAsync(`adapterAndInstances.HTML_Lists.listInstancesErrorHTML`, {
|
|
1650
|
+
val: await this.createListHTMLInstances(adaptr, 'errorInstanceList', adaptr.listErrorInstance, adaptr.countErrorInstance),
|
|
1651
|
+
ack: true,
|
|
1652
|
+
});
|
|
1653
|
+
await adaptr.setStateChangedAsync(`adapterAndInstances.HTML_Lists.listDeactivatedInstancesHTML`, {
|
|
1654
|
+
val: await this.createListHTMLInstances(adaptr, 'deactivatedInstanceList', adaptr.listDeactivatedInstances, adaptr.countDeactivatedInstances),
|
|
1655
|
+
ack: true,
|
|
1656
|
+
});
|
|
1657
|
+
await adaptr.setStateChangedAsync(`adapterAndInstances.HTML_Lists.listAdapterUpdatesHTML`, {
|
|
1658
|
+
val: await this.createListHTMLInstances(adaptr, 'updateAdapterList', adaptr.listAdapterUpdates, adaptr.countAdapterUpdates),
|
|
1659
|
+
ack: true,
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
// create timestamp of last run
|
|
1665
|
+
const lastCheck = `${adaptr.formatDate(new Date(), 'DD.MM.YYYY')} - ${adaptr.formatDate(new Date(), 'hh:mm:ss')}`;
|
|
1666
|
+
await adaptr.setStateChangedAsync('lastCheck', lastCheck, true);
|
|
1667
|
+
} catch (error) {
|
|
1668
|
+
adaptr.log.error(`[writeDatapoints] - ${error}`);
|
|
1669
|
+
}
|
|
1670
|
+
} //<--End of writing Datapoints
|
|
1671
|
+
|
|
1672
|
+
/**
|
|
1673
|
+
* create Datapoints for Instances
|
|
1674
|
+
*
|
|
1675
|
+
* @param adaptr
|
|
1676
|
+
*/
|
|
1677
|
+
async function createDPsForInstances(adaptr) {
|
|
1678
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances`, {
|
|
1679
|
+
type: 'channel',
|
|
1680
|
+
common: {
|
|
1681
|
+
name: {
|
|
1682
|
+
en: 'Adapter and Instances',
|
|
1683
|
+
de: 'Adapter und Instanzen',
|
|
1684
|
+
ru: 'Адаптер и экземпляры',
|
|
1685
|
+
pt: 'Adaptador e Instâncias',
|
|
1686
|
+
nl: 'Adapter en Instanties',
|
|
1687
|
+
fr: 'Adaptateur et instances',
|
|
1688
|
+
it: 'Adattatore e istanze',
|
|
1689
|
+
es: 'Adaptador e instancias',
|
|
1690
|
+
pl: 'Adapter i Instancje',
|
|
1691
|
+
uk: 'Адаптер та його екземпляри',
|
|
1692
|
+
'zh-cn': '适配器和实例',
|
|
1693
|
+
},
|
|
1694
|
+
},
|
|
1695
|
+
native: {},
|
|
1696
|
+
});
|
|
1697
|
+
|
|
1698
|
+
// Instances
|
|
1699
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.listAllInstances`, {
|
|
1700
|
+
type: 'state',
|
|
1701
|
+
common: {
|
|
1702
|
+
name: {
|
|
1703
|
+
en: 'JSON List of all instances',
|
|
1704
|
+
de: 'JSON-Liste aller Instanzen',
|
|
1705
|
+
ru: 'JSON-список всех экземпляров',
|
|
1706
|
+
pt: 'Lista JSON de todas as instâncias',
|
|
1707
|
+
nl: 'JSON-lijst van alle instanties',
|
|
1708
|
+
fr: 'Liste JSON de toutes les instances',
|
|
1709
|
+
it: 'Elenco JSON di tutte le istanze',
|
|
1710
|
+
es: 'Lista JSON de todas las instancias',
|
|
1711
|
+
pl: 'Lista JSON wszystkich instancji',
|
|
1712
|
+
uk: 'JSON-список всіх інстанцій',
|
|
1713
|
+
'zh-cn': '所有实例的JSON列表',
|
|
1714
|
+
},
|
|
1715
|
+
type: 'array',
|
|
1716
|
+
role: 'json',
|
|
1717
|
+
read: true,
|
|
1718
|
+
write: false,
|
|
1719
|
+
},
|
|
1720
|
+
native: {},
|
|
1721
|
+
});
|
|
1722
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.countAllInstances`, {
|
|
1723
|
+
type: 'state',
|
|
1724
|
+
common: {
|
|
1725
|
+
name: {
|
|
1726
|
+
en: 'Number of all instances',
|
|
1727
|
+
de: 'Anzahl aller Instanzen',
|
|
1728
|
+
ru: 'Количество всех экземпляров',
|
|
1729
|
+
pt: 'Número de todas as instâncias',
|
|
1730
|
+
nl: 'Aantal van alle instanties',
|
|
1731
|
+
fr: 'Nombre de toutes les instances',
|
|
1732
|
+
it: 'Numero di tutte le istanze',
|
|
1733
|
+
es: 'Número de todas las instancias',
|
|
1734
|
+
pl: 'Liczba wszystkich instancji',
|
|
1735
|
+
uk: 'Кількість усіх інстанцій',
|
|
1736
|
+
'zh-cn': '所有实例的数量',
|
|
1737
|
+
},
|
|
1738
|
+
type: 'number',
|
|
1739
|
+
role: 'value',
|
|
1740
|
+
read: true,
|
|
1741
|
+
write: false,
|
|
1742
|
+
},
|
|
1743
|
+
native: {},
|
|
1744
|
+
});
|
|
1745
|
+
// Instances
|
|
1746
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.listAllActiveInstances`, {
|
|
1747
|
+
type: 'state',
|
|
1748
|
+
common: {
|
|
1749
|
+
name: {
|
|
1750
|
+
en: 'JSON List of all active instances',
|
|
1751
|
+
de: 'JSON-Liste aller aktiven Instanzen',
|
|
1752
|
+
ru: 'JSON список всех активных экземпляров',
|
|
1753
|
+
pt: 'Lista JSON de todas as instâncias ativas',
|
|
1754
|
+
nl: 'JSON-lijst van alle actieve instanties',
|
|
1755
|
+
fr: 'Liste JSON de toutes les instances actives',
|
|
1756
|
+
it: 'Elenco JSON di tutte le istanze attive',
|
|
1757
|
+
es: 'Lista JSON de todas las instancias activas',
|
|
1758
|
+
pl: 'JSON lista wszystkich aktywnych instancji',
|
|
1759
|
+
uk: 'JSON список усіх активних екземплярів',
|
|
1760
|
+
'zh-cn': '所有活动实例的 JSON 列表',
|
|
1761
|
+
},
|
|
1762
|
+
type: 'array',
|
|
1763
|
+
role: 'json',
|
|
1764
|
+
read: true,
|
|
1765
|
+
write: false,
|
|
1766
|
+
},
|
|
1767
|
+
native: {},
|
|
1768
|
+
});
|
|
1769
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.countAllActiveInstances`, {
|
|
1770
|
+
type: 'state',
|
|
1771
|
+
common: {
|
|
1772
|
+
name: {
|
|
1773
|
+
en: 'Number of all active instances',
|
|
1774
|
+
de: 'Anzahl aller aktiven Instanzen',
|
|
1775
|
+
ru: 'Количество всех активных экземпляров',
|
|
1776
|
+
pt: 'Número de todas as instâncias ativas',
|
|
1777
|
+
nl: 'Aantal van alle actieve instanties',
|
|
1778
|
+
fr: 'Nombre de toutes les instances actives',
|
|
1779
|
+
it: 'Numero di tutte le istanze attive',
|
|
1780
|
+
es: 'Número de todas las instancias activas',
|
|
1781
|
+
pl: 'Liczba wszystkich aktywnych instancji',
|
|
1782
|
+
uk: 'Кількість усіх активних екземплярів',
|
|
1783
|
+
'zh-cn': '所有活动实例的数量',
|
|
1784
|
+
},
|
|
1785
|
+
type: 'number',
|
|
1786
|
+
role: 'value',
|
|
1787
|
+
read: true,
|
|
1788
|
+
write: false,
|
|
1789
|
+
},
|
|
1790
|
+
native: {},
|
|
1791
|
+
});
|
|
1792
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.listDeactivatedInstances`, {
|
|
1793
|
+
type: 'state',
|
|
1794
|
+
common: {
|
|
1795
|
+
name: {
|
|
1796
|
+
en: 'JSON List of deactivated instances',
|
|
1797
|
+
de: 'JSON-Liste der deaktivierten Instanzen',
|
|
1798
|
+
ru: 'JSON список деактивированных экземпляров',
|
|
1799
|
+
pt: 'JSON Lista de instâncias desativadas',
|
|
1800
|
+
nl: 'JSON-lijst van gedeactiveerde instanties',
|
|
1801
|
+
fr: 'Liste JSON des instances désactivées',
|
|
1802
|
+
it: 'JSON Elenco delle istanze disattivate',
|
|
1803
|
+
es: 'Lista JSON de instancias desactivadas',
|
|
1804
|
+
pl: 'JSON lista dezaktywowanych instancji',
|
|
1805
|
+
uk: 'JSON список деактивованих екземплярів',
|
|
1806
|
+
'zh-cn': '已停用实例的 JSON 列表',
|
|
1807
|
+
},
|
|
1808
|
+
type: 'array',
|
|
1809
|
+
role: 'json',
|
|
1810
|
+
read: true,
|
|
1811
|
+
write: false,
|
|
1812
|
+
},
|
|
1813
|
+
native: {},
|
|
1814
|
+
});
|
|
1815
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.countDeactivatedInstances`, {
|
|
1816
|
+
type: 'state',
|
|
1817
|
+
common: {
|
|
1818
|
+
name: {
|
|
1819
|
+
en: 'Number of deactivated instances',
|
|
1820
|
+
de: 'Anzahl deaktivierter Instanzen',
|
|
1821
|
+
ru: 'Количество деактивированных экземпляров',
|
|
1822
|
+
pt: 'Número de instâncias desativadas',
|
|
1823
|
+
nl: 'Aantal gedeactiveerde instanties',
|
|
1824
|
+
fr: "Nombre d'instances désactivées",
|
|
1825
|
+
it: 'Numero di istanze disattivate',
|
|
1826
|
+
es: 'Número de instancias desactivadas',
|
|
1827
|
+
pl: 'Liczba deaktywowanych instancji',
|
|
1828
|
+
uk: 'Кількість деактивованих екземплярів',
|
|
1829
|
+
'zh-cn': '已停用实例的数量',
|
|
1830
|
+
},
|
|
1831
|
+
type: 'number',
|
|
1832
|
+
role: 'value',
|
|
1833
|
+
read: true,
|
|
1834
|
+
write: false,
|
|
1835
|
+
},
|
|
1836
|
+
native: {},
|
|
1837
|
+
});
|
|
1838
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.listInstancesError`, {
|
|
1839
|
+
type: 'state',
|
|
1840
|
+
common: {
|
|
1841
|
+
name: {
|
|
1842
|
+
en: 'JSON list of instances with error',
|
|
1843
|
+
de: 'JSON-Liste von Instanzen mit Fehler',
|
|
1844
|
+
ru: 'JSON список экземпляров с ошибкой',
|
|
1845
|
+
pt: 'Lista de instâncias JSON com erro',
|
|
1846
|
+
nl: 'JSON lijst met fouten',
|
|
1847
|
+
fr: 'Liste des instances avec erreur',
|
|
1848
|
+
it: 'Elenco JSON delle istanze con errore',
|
|
1849
|
+
es: 'JSON lista de casos con error',
|
|
1850
|
+
pl: 'JSON lista instancji z błędem',
|
|
1851
|
+
uk: 'JSON список інстанцій з помилкою',
|
|
1852
|
+
'zh-cn': '含错误实例的 JSON 列表',
|
|
1853
|
+
},
|
|
1854
|
+
type: 'array',
|
|
1855
|
+
role: 'json',
|
|
1856
|
+
read: true,
|
|
1857
|
+
write: false,
|
|
1858
|
+
},
|
|
1859
|
+
native: {},
|
|
1860
|
+
});
|
|
1861
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.countInstancesError`, {
|
|
1862
|
+
type: 'state',
|
|
1863
|
+
common: {
|
|
1864
|
+
name: {
|
|
1865
|
+
en: 'Count of instances with error',
|
|
1866
|
+
de: 'Anzahl der Instanzen mit Fehler',
|
|
1867
|
+
ru: 'Количество экземпляров с ошибкой',
|
|
1868
|
+
pt: 'Contagem de instâncias com erro',
|
|
1869
|
+
nl: 'Aantal instanties met fouten',
|
|
1870
|
+
fr: "Nombre d'instances avec erreur",
|
|
1871
|
+
it: 'Conteggio delle istanze con errore',
|
|
1872
|
+
es: 'Recuento de instancias con error',
|
|
1873
|
+
pl: 'Liczba instancji z błędem',
|
|
1874
|
+
uk: 'Кількість інстанцій з помилкою',
|
|
1875
|
+
'zh-cn': '出错实例的数量',
|
|
1876
|
+
},
|
|
1877
|
+
type: 'number',
|
|
1878
|
+
role: 'value',
|
|
1879
|
+
read: true,
|
|
1880
|
+
write: false,
|
|
1881
|
+
},
|
|
1882
|
+
native: {},
|
|
1883
|
+
});
|
|
1884
|
+
|
|
1885
|
+
// Adapter
|
|
1886
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.listAdapterUpdates`, {
|
|
1887
|
+
type: 'state',
|
|
1888
|
+
common: {
|
|
1889
|
+
name: {
|
|
1890
|
+
en: 'JSON list of adapters with available updates',
|
|
1891
|
+
de: 'JSON-Liste der Adapter mit verfügbaren Updates',
|
|
1892
|
+
ru: 'JSON список адаптеров с доступными обновлениями',
|
|
1893
|
+
pt: 'Lista de adaptadores JSON com atualizações disponíveis',
|
|
1894
|
+
nl: 'JSON lijst van adapters met beschikbare updates',
|
|
1895
|
+
fr: 'Liste JSON des adaptateurs avec mises à jour disponibles',
|
|
1896
|
+
it: 'Elenco JSON degli adattatori con aggiornamenti disponibili',
|
|
1897
|
+
es: 'JSON lista de adaptadores con actualizaciones disponibles',
|
|
1898
|
+
pl: 'JSON lista adapterów z dostępnymi aktualizacjami',
|
|
1899
|
+
uk: 'JSON список адаптерів з доступними оновленнями',
|
|
1900
|
+
'zh-cn': '具有可用更新的适配器的 JSON 列表',
|
|
1901
|
+
},
|
|
1902
|
+
type: 'array',
|
|
1903
|
+
role: 'json',
|
|
1904
|
+
read: true,
|
|
1905
|
+
write: false,
|
|
1906
|
+
},
|
|
1907
|
+
native: {},
|
|
1908
|
+
});
|
|
1909
|
+
await adaptr.setObjectNotExistsAsync(`adapterAndInstances.countAdapterUpdates`, {
|
|
1910
|
+
type: 'state',
|
|
1911
|
+
common: {
|
|
1912
|
+
name: {
|
|
1913
|
+
en: 'Number of adapters with available updates',
|
|
1914
|
+
de: 'Anzahl der Adapter mit verfügbaren Updates',
|
|
1915
|
+
ru: 'Количество адаптеров с доступными обновлениями',
|
|
1916
|
+
pt: 'Número de adaptadores com atualizações disponíveis',
|
|
1917
|
+
nl: 'Aantal adapters met beschikbare updates',
|
|
1918
|
+
fr: "Nombre d'adaptateurs avec mises à jour disponibles",
|
|
1919
|
+
it: 'Numero di adattatori con aggiornamenti disponibili',
|
|
1920
|
+
es: 'Número de adaptadores con actualizaciones disponibles',
|
|
1921
|
+
pl: 'Liczba adapterów z dostępnymi aktualizacjami',
|
|
1922
|
+
uk: 'Кількість адаптерів з доступними оновленнями',
|
|
1923
|
+
'zh-cn': '具有可用更新的适配器数量',
|
|
1924
|
+
},
|
|
1925
|
+
type: 'number',
|
|
1926
|
+
role: 'value',
|
|
1927
|
+
read: true,
|
|
1928
|
+
write: false,
|
|
1929
|
+
},
|
|
1930
|
+
native: {},
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* delete Datapoints for Instances
|
|
1936
|
+
*
|
|
1937
|
+
* @param adaptr
|
|
1938
|
+
*/
|
|
1939
|
+
async function deleteDPsForInstances(adaptr) {
|
|
1940
|
+
await adaptr.delObjectAsync(`adapterAndInstances`);
|
|
1941
|
+
await adaptr.delObjectAsync(`adapterAndInstances.listAllInstances`);
|
|
1942
|
+
await adaptr.delObjectAsync(`adapterAndInstances.countAllInstances`);
|
|
1943
|
+
await adaptr.delObjectAsync(`adapterAndInstances.listAllActiveInstances`);
|
|
1944
|
+
await adaptr.delObjectAsync(`adapterAndInstances.countAllActiveInstances`);
|
|
1945
|
+
await adaptr.delObjectAsync(`adapterAndInstances.listDeactivatedInstances`);
|
|
1946
|
+
await adaptr.delObjectAsync(`adapterAndInstances.countDeactivatedInstances`);
|
|
1947
|
+
await adaptr.delObjectAsync(`adapterAndInstances.listInstancesError`);
|
|
1948
|
+
await adaptr.delObjectAsync(`adapterAndInstances.countInstancesError`);
|
|
1949
|
+
await adaptr.delObjectAsync(`adapterAndInstances.listAdapterUpdates`);
|
|
1950
|
+
await adaptr.delObjectAsync(`adapterAndInstances.countAdapterUpdates`);
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* create adapter update data
|
|
1955
|
+
*
|
|
1956
|
+
* @param adaptr
|
|
1957
|
+
* @param adapterUpdateListDP
|
|
1958
|
+
*/
|
|
1959
|
+
async function createAdapterUpdateData(adaptr, adapterUpdateListDP) {
|
|
1960
|
+
// subscribe to datapoint
|
|
1961
|
+
adaptr.subscribeForeignStates(adapterUpdateListDP);
|
|
1962
|
+
|
|
1963
|
+
await adaptr.getAdapterUpdateData(adapterUpdateListDP);
|
|
1964
|
+
|
|
1965
|
+
await adaptr.createAdapterUpdateList();
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
module.exports = {
|
|
1969
|
+
createDPsForEachAdapter,
|
|
1970
|
+
deleteDPsForEachAdapter,
|
|
1971
|
+
createHtmlListDatapoints,
|
|
1972
|
+
deleteHtmlListDatapoints,
|
|
1973
|
+
createHtmlListDatapointsInstances,
|
|
1974
|
+
deleteHtmlListDatapointsInstances,
|
|
1975
|
+
createListHTML,
|
|
1976
|
+
createListHTMLInstances,
|
|
1977
|
+
createBlacklist,
|
|
1978
|
+
createTimeListInstances,
|
|
1979
|
+
createData,
|
|
1980
|
+
createLists,
|
|
1981
|
+
writeDatapoints,
|
|
1982
|
+
createDPsForInstances,
|
|
1983
|
+
deleteDPsForInstances,
|
|
1984
|
+
createAdapterUpdateData,
|
|
1985
|
+
};
|