homebridge-smartsystem 6.2.2 → 6.2.3

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,7 @@ 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
274
275
 
275
276
 
276
277
  ## Hardware
package/duotecno/types.js CHANGED
@@ -380,31 +380,32 @@ exports.Sanitizers = {
380
380
  if (!config) {
381
381
  config = {};
382
382
  }
383
- config = exports.Sanitizers.unitDef(config);
384
- config.active = config.active || 'N';
385
- config.used = config.used || config.active;
383
+ const cfg = exports.Sanitizers.unitDef(config);
384
+ cfg.active = config.active || 'N';
385
+ cfg.used = config.used || config.active;
386
386
  if (typeof config.group === 'string') {
387
387
  config.group = parseInt(config.group);
388
388
  }
389
- config.group = config.group || 0;
390
- return config;
389
+ cfg.group = config.group || 0;
390
+ return cfg;
391
391
  },
392
392
  unitScene: function (config) {
393
393
  // change + create new clean record for writing to config files
394
394
  if (!config) {
395
395
  config = {};
396
396
  }
397
- config = exports.Sanitizers.unitDef(config);
397
+ const cfg = exports.Sanitizers.unitDef(config);
398
398
  if (typeof config.value === "undefined")
399
- config.value = 0;
399
+ cfg.value = 0;
400
400
  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 };
401
+ cfg.value = parseInt(config.value);
402
+ cfg.name = config.name || "New scene";
403
+ return { logicalNodeAddress: cfg.logicalNodeAddress,
404
+ logicalAddress: cfg.logicalAddress,
405
+ masterAddress: cfg.masterAddress,
406
+ masterPort: cfg.masterPort,
407
+ value: cfg.value,
408
+ name: cfg.name };
408
409
  },
409
410
  ////////////
410
411
  // Scenes //
package/duotecno/types.ts CHANGED
@@ -570,31 +570,32 @@ export const Sanitizers = {
570
570
 
571
571
  unitConfig: function(config?: UnitConfig) { // unitDef + active + group
572
572
  if (!config) { config = <UnitConfig>{}; }
573
- config = <UnitConfig>Sanitizers.unitDef(config);
573
+ const cfg = <UnitConfig>Sanitizers.unitDef(config);
574
574
 
575
- config.active = config.active || 'N';
576
- config.used = config.used || config.active;
575
+ cfg.active = config.active || 'N';
576
+ cfg.used = config.used || config.active;
577
577
 
578
578
  if (typeof config.group === 'string') { config.group = parseInt(config.group); }
579
- config.group = config.group || 0;
579
+ cfg.group = config.group || 0;
580
580
 
581
- return config;
581
+ return cfg;
582
582
  },
583
583
 
584
584
 
585
585
  unitScene: function(config?: UnitScene) { // unitDef + value
586
586
  // change + create new clean record for writing to config files
587
587
  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 };
588
+ const cfg = <UnitScene>Sanitizers.unitDef(config);
589
+ if (typeof config.value === "undefined") cfg.value = 0;
590
+ if (typeof config.value === "string") cfg.value = parseInt(config.value);
591
+ cfg.name = config.name || "New scene";
592
+
593
+ return { logicalNodeAddress: cfg.logicalNodeAddress,
594
+ logicalAddress: cfg.logicalAddress,
595
+ masterAddress: cfg.masterAddress,
596
+ masterPort: cfg.masterPort,
597
+ value: cfg.value,
598
+ name: cfg.name };
598
599
  },
599
600
 
600
601
 
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.3",
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",