homebridge-smartsystem 6.2.2 → 6.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -271,6 +271,9 @@ Homebridge UI version
271
271
  ### v6.2.x - 11-08-2022 - P1 release
272
272
  - 1: always write config to file too (next to sending through the HB-UI API)
273
273
  - 2: added headers to http calls from switches, dimmers and up/down's (including OH stuff)
274
+ - 3: fixed bug in Sanitizer of UnitConfig preventing from publishing units to homebridge
275
+ - 4: fixed empty name bug in unit-def / new accessory()
276
+ - 5: fixed bad displayNames in published units
274
277
 
275
278
 
276
279
  ## Hardware
@@ -9,9 +9,9 @@ const logger_1 = require("../duotecno/logger");
9
9
  class Accessory {
10
10
  constructor(api, unit) {
11
11
  this.homebridge = api.hap;
12
- this.unit = unit; // : Duotecno Unit
13
- this.name = unit.getDisplayName();
14
12
  this.uuid_base = unit.getSerialNr();
13
+ this.unit = unit; // : Duotecno Unit
14
+ this.name = unit.getDisplayName() || this.uuid_base;
15
15
  // get all services and add ours
16
16
  this.services = this.getAccessoryServices();
17
17
  this.services.push(this.getInformationService());
@@ -33,10 +33,10 @@ class Accessory {
33
33
  throw new Error('The getSystemServices method must be overridden.');
34
34
  }
35
35
  getModelName() {
36
- return this.name;
36
+ return this.name || this.unit.getSerialNr();
37
37
  }
38
38
  getName() {
39
- return this.name;
39
+ return this.name || this.unit.getSerialNr();
40
40
  }
41
41
  getSerialNumber() {
42
42
  if (this.unit)
@@ -18,9 +18,10 @@ export class Accessory {
18
18
 
19
19
  constructor(api: API, unit: Unit) {
20
20
  this.homebridge = api.hap;
21
- this.unit = unit; // : Duotecno Unit
22
- this.name = unit.getDisplayName();
21
+
23
22
  this.uuid_base = unit.getSerialNr();
23
+ this.unit = unit; // : Duotecno Unit
24
+ this.name = unit.getDisplayName() || this.uuid_base;
24
25
 
25
26
  // get all services and add ours
26
27
  this.services = this.getAccessoryServices();
@@ -47,10 +48,10 @@ export class Accessory {
47
48
  }
48
49
 
49
50
  getModelName(): string {
50
- return this.name;
51
+ return this.name || this.unit.getSerialNr();
51
52
  }
52
53
  getName(): string {
53
- return this.name;
54
+ return this.name || this.unit.getSerialNr();
54
55
  }
55
56
 
56
57
  getSerialNumber(): string {
package/duotecno/types.js CHANGED
@@ -373,38 +373,42 @@ exports.Sanitizers = {
373
373
  logicalNodeAddress: info.logicalNodeAddress || 0,
374
374
  logicalAddress: info.logicalAddress || 0,
375
375
  masterAddress: info.masterAddress || '',
376
- masterPort: info.masterPort || 5001
376
+ masterPort: info.masterPort || 5001,
377
+ name: info.name || ('unit ' + info.logicalNodeAddress + ":" + info.logicalAddress),
378
+ displayName: info.displayName || info.name || ('unit ' + info.logicalNodeAddress + ":" + info.logicalAddress),
379
+ extendedType: info.extendedType || UnitExtendedType.kNoType
377
380
  };
378
381
  },
379
382
  unitConfig: function (config) {
380
383
  if (!config) {
381
384
  config = {};
382
385
  }
383
- config = exports.Sanitizers.unitDef(config);
384
- config.active = config.active || 'N';
385
- config.used = config.used || config.active;
386
+ const cfg = exports.Sanitizers.unitDef(config);
387
+ cfg.active = config.active || 'N';
388
+ cfg.used = config.used || config.active;
386
389
  if (typeof config.group === 'string') {
387
390
  config.group = parseInt(config.group);
388
391
  }
389
- config.group = config.group || 0;
390
- return config;
392
+ cfg.group = config.group || 0;
393
+ return cfg;
391
394
  },
392
395
  unitScene: function (config) {
393
396
  // change + create new clean record for writing to config files
394
397
  if (!config) {
395
398
  config = {};
396
399
  }
397
- config = exports.Sanitizers.unitDef(config);
400
+ const cfg = exports.Sanitizers.unitDef(config);
398
401
  if (typeof config.value === "undefined")
399
- config.value = 0;
402
+ cfg.value = 0;
400
403
  if (typeof config.value === "string")
401
- config.value = parseInt(config.value);
402
- return { logicalNodeAddress: config.logicalNodeAddress,
403
- logicalAddress: config.logicalAddress,
404
- masterAddress: config.masterAddress,
405
- masterPort: config.masterPort,
406
- value: config.value,
407
- name: config.name };
404
+ cfg.value = parseInt(config.value);
405
+ cfg.name = config.name || "New scene";
406
+ return { logicalNodeAddress: cfg.logicalNodeAddress,
407
+ logicalAddress: cfg.logicalAddress,
408
+ masterAddress: cfg.masterAddress,
409
+ masterPort: cfg.masterPort,
410
+ value: cfg.value,
411
+ name: cfg.name };
408
412
  },
409
413
  ////////////
410
414
  // Scenes //
package/duotecno/types.ts CHANGED
@@ -563,38 +563,44 @@ export const Sanitizers = {
563
563
  logicalNodeAddress: info.logicalNodeAddress || 0,
564
564
  logicalAddress: info.logicalAddress || 0,
565
565
  masterAddress: info.masterAddress || '',
566
- masterPort: info.masterPort || 5001
566
+ masterPort: info.masterPort || 5001,
567
+
568
+ name: info.name || ('unit '+info.logicalNodeAddress+":"+info.logicalAddress),
569
+ displayName: info.displayName || info.name || ('unit '+info.logicalNodeAddress+":"+info.logicalAddress),
570
+
571
+ extendedType: info.extendedType || UnitExtendedType.kNoType
567
572
  };
568
573
  },
569
574
 
570
575
 
571
576
  unitConfig: function(config?: UnitConfig) { // unitDef + active + group
572
577
  if (!config) { config = <UnitConfig>{}; }
573
- config = <UnitConfig>Sanitizers.unitDef(config);
578
+ const cfg = <UnitConfig>Sanitizers.unitDef(config);
574
579
 
575
- config.active = config.active || 'N';
576
- config.used = config.used || config.active;
580
+ cfg.active = config.active || 'N';
581
+ cfg.used = config.used || config.active;
577
582
 
578
583
  if (typeof config.group === 'string') { config.group = parseInt(config.group); }
579
- config.group = config.group || 0;
584
+ cfg.group = config.group || 0;
580
585
 
581
- return config;
586
+ return cfg;
582
587
  },
583
588
 
584
589
 
585
590
  unitScene: function(config?: UnitScene) { // unitDef + value
586
591
  // change + create new clean record for writing to config files
587
592
  if (!config) { config = <UnitScene>{}; }
588
- config = <UnitScene>Sanitizers.unitDef(config);
589
- if (typeof config.value === "undefined") config.value = 0;
590
- if (typeof config.value === "string") config.value = parseInt(config.value);
591
-
592
- return { logicalNodeAddress: config.logicalNodeAddress,
593
- logicalAddress: config.logicalAddress,
594
- masterAddress: config.masterAddress,
595
- masterPort: config.masterPort,
596
- value: config.value,
597
- name: config.name };
593
+ const cfg = <UnitScene>Sanitizers.unitDef(config);
594
+ if (typeof config.value === "undefined") cfg.value = 0;
595
+ if (typeof config.value === "string") cfg.value = parseInt(config.value);
596
+ cfg.name = config.name || "New scene";
597
+
598
+ return { logicalNodeAddress: cfg.logicalNodeAddress,
599
+ logicalAddress: cfg.logicalAddress,
600
+ masterAddress: cfg.masterAddress,
601
+ masterPort: cfg.masterPort,
602
+ value: cfg.value,
603
+ name: cfg.name };
598
604
  },
599
605
 
600
606
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-smartsystem",
3
3
  "displayname": "Duotecno Bridge",
4
- "version": "6.2.2",
4
+ "version": "6.2.5",
5
5
  "description": "SmartServer (Proxy Websockets to TCP sockets, Smappee MQTT, Duotecno IP Nodes, Homekit interface)",
6
6
  "main": "index.js",
7
7
  "author": "Johan Coppieters",
@@ -20,7 +20,6 @@
20
20
  Settings<button class="right btn waves-effect waves-light" type="submit" name="action" value="reset">Reset to DHCP</button>
21
21
  <button class="right btn waves-effect waves-light" type="submit" name="action" value="install">Install IP Settings</button>
22
22
  <button class="right btn waves-effect waves-light" type="submit" name="action" value="reboot">Reboot PI</button>
23
- <button class="right btn waves-effect waves-light" type="submit" name="action" value="restart">Restart Homebridge</button>
24
23
  </h1>
25
24
 
26
25
  <div class="row">
@@ -41,7 +40,7 @@
41
40
  </div>
42
41
  </div>
43
42
 
44
- <div class="row">
43
+ <!-- div class="row">
45
44
  <div class="input-field col s6">
46
45
  <input placeholder="" id="ip2" name="ip2" type="text" value="<%= config.network.ip2 %>">
47
46
  <label for="ip2">Secondary Fixed IP Address / netmask</label>
@@ -50,7 +49,7 @@
50
49
  <input placeholder="" id="gateway2" name="gateway2" type="text" value="<%= config.network.gateway2 %>">
51
50
  <label for="gateway2">Secondary Gateway</label>
52
51
  </div>
53
- </div>
52
+ </div -->
54
53
 
55
54
  </form>
56
55