homebridge-smartsystem 6.4.5 → 6.4.6

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/config.json CHANGED
@@ -315,7 +315,7 @@
315
315
  "masterPort": 5001,
316
316
  "name": "<Solar Panels",
317
317
  "displayName": "<Solar Panels",
318
- "extendedType": 0,
318
+ "extendedType": 4,
319
319
  "active": "N",
320
320
  "used": "Y",
321
321
  "group": 0
@@ -327,7 +327,7 @@
327
327
  "masterPort": 5001,
328
328
  "name": ">Cars",
329
329
  "displayName": ">Cars",
330
- "extendedType": 0,
330
+ "extendedType": 4,
331
331
  "active": "N",
332
332
  "used": "Y",
333
333
  "group": 0
@@ -339,7 +339,7 @@
339
339
  "masterPort": 5001,
340
340
  "name": ">Grid",
341
341
  "displayName": ">Grid",
342
- "extendedType": 0,
342
+ "extendedType": 4,
343
343
  "active": "N",
344
344
  "used": "Y",
345
345
  "group": 0
@@ -351,7 +351,7 @@
351
351
  "masterPort": 5001,
352
352
  "name": ">Swimmingpool",
353
353
  "displayName": ">Swimmingpool",
354
- "extendedType": 0,
354
+ "extendedType": 4,
355
355
  "active": "N",
356
356
  "used": "Y",
357
357
  "group": 0
@@ -268,7 +268,7 @@ export class Unit {
268
268
  if (this.type === UnitType.kSwitchingMotor)
269
269
  return (((this.value == UnitState.kOpening) && (value == 4)) ||
270
270
  ((this.value == UnitState.kClosing) && (value == 5)) ||
271
- ((this.value <= UnitState.kOpen) && (value == 3)));
271
+ ((this.value as number <= UnitState.kOpen) && (value == 3)));
272
272
  else
273
273
  return this.value == value;
274
274
  }
@@ -803,7 +803,7 @@ export const Protocol = {
803
803
 
804
804
  case UnitType.kInput:
805
805
  case UnitType.kMood:
806
- if (value < 0)
806
+ if (value as number < 0)
807
807
  return { cmd: Cmd.SetControl, method: 2 }; // short pulse
808
808
  else
809
809
  return { cmd: Cmd.SetControl, method: 3, value: (value) ? 1 : 0 }; // long event + 0/1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-smartsystem",
3
3
  "displayname": "Duotecno Bridge",
4
- "version": "6.4.5",
4
+ "version": "6.4.6",
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",
@@ -881,11 +881,32 @@ class SmartApp extends webapp_1.WebApp {
881
881
  // reponding to /units/[master ip address:port]/[logical node address]
882
882
  const nodeLogicalAddress = parseInt(context.id);
883
883
  let response = yield this.getNodeInfo(master, nodeLogicalAddress, true);
884
+ this.adjustUnitsToConfig(response.node);
884
885
  let N = this.sortCopy(response.node, context);
885
886
  return this.ejs("nodeDetail", context, { message: response.message, node: N });
886
887
  }
887
888
  });
888
889
  }
890
+ adjustUnitsToConfig(node) {
891
+ // check if units are still in config
892
+ node.units.forEach(unit => {
893
+ //console.log("Searching: ", unit.node.master.config.address, unit.node.master.config.port, unit.logicalNodeAddress, unit.logicalAddress)
894
+ const config = this.system.config.cunits.find(u => {
895
+ // console.log(u.masterAddress, u.masterPort, u.logicalNodeAddress, u.logicalAddress, ((unit.node.master.hasAddress(u.masterAddress) &&
896
+ // unit.node.master.hasPort(u.masterPort) &&
897
+ // (u.logicalNodeAddress == unit.logicalNodeAddress) &&
898
+ // (u.logicalAddress === unit.logicalAddress))));
899
+ return (unit.node.master.hasAddress(u.masterAddress) &&
900
+ unit.node.master.hasPort(u.masterPort) &&
901
+ (u.logicalNodeAddress == unit.logicalNodeAddress) &&
902
+ (u.logicalAddress === unit.logicalAddress));
903
+ });
904
+ if (config) {
905
+ unit.extendedType = config.extendedType;
906
+ unit.name = config.displayName;
907
+ }
908
+ });
909
+ }
889
910
  sortCopy(N, context) {
890
911
  // only need to re-sort if onAddress is requested, units should always be sorted on name
891
912
  const S = context["sortOnAddr"] = context.getParam({ name: "sortOnAddr", type: "string", default: "N" });
@@ -943,11 +943,34 @@ export class SmartApp extends WebApp {
943
943
  // reponding to /units/[master ip address:port]/[logical node address]
944
944
  const nodeLogicalAddress = parseInt(context.id);
945
945
  let response = await this.getNodeInfo(master, nodeLogicalAddress, true);
946
+ this.adjustUnitsToConfig(response.node);
946
947
  let N = this.sortCopy(response.node, context);
947
948
  return this.ejs("nodeDetail", context, { message: response.message, node: N });
948
949
  }
949
950
  }
950
951
 
952
+ adjustUnitsToConfig(node: Node) {
953
+ // check if units are still in config
954
+ node.units.forEach(unit => {
955
+ //console.log("Searching: ", unit.node.master.config.address, unit.node.master.config.port, unit.logicalNodeAddress, unit.logicalAddress)
956
+ const config = this.system.config.cunits.find(u => {
957
+ // console.log(u.masterAddress, u.masterPort, u.logicalNodeAddress, u.logicalAddress, ((unit.node.master.hasAddress(u.masterAddress) &&
958
+ // unit.node.master.hasPort(u.masterPort) &&
959
+ // (u.logicalNodeAddress == unit.logicalNodeAddress) &&
960
+ // (u.logicalAddress === unit.logicalAddress))));
961
+
962
+ return (unit.node.master.hasAddress(u.masterAddress) &&
963
+ unit.node.master.hasPort(u.masterPort) &&
964
+ (u.logicalNodeAddress == unit.logicalNodeAddress) &&
965
+ (u.logicalAddress === unit.logicalAddress));
966
+ });
967
+ if (config) {
968
+ unit.extendedType = config.extendedType;
969
+ unit.name = config.displayName;
970
+ }
971
+ });
972
+ }
973
+
951
974
 
952
975
  sortCopy(N: Node, context: Context): Node {
953
976
  // only need to re-sort if onAddress is requested, units should always be sorted on name
@@ -8,7 +8,7 @@
8
8
  <% if (hasP1) { %><li <%= ((request === "power") && (type === "p1")) ? 'class="active"' : '' %></li><a href="/power?type=p1">P1</a></li><% } %>
9
9
  <% if (hasShelly) { %><li <%= ((request === "power") && (type === "shelly")) ? 'class="active"' : '' %></li><a href="/power?type=shelly">Shelly PM</a></li><% } %>
10
10
  <li <%= (request === "switches") ? 'class="active"' : '' %></li><a href="/switches">Switches</a></li>
11
- <li <%= (request === "settings") ? 'class="active"' : '' %></li><a href="/settings">Settings</a></li>
11
+ <!-- li <%= (request === "settings") ? 'class="active"' : '' %></li><a href="/settings">Settings</a></li -->
12
12
  </ul>
13
13
  </div>
14
14
  </nav>
@@ -23,7 +23,7 @@
23
23
  <table>
24
24
  <thead>
25
25
  <tr>
26
- <th>Name</th><th>Plug/Http</th><th>Addr</th><th>State</th>
26
+ <th>Name</th><th>Plug/Http</th><th>Addr</th><!-- th>State</th -->
27
27
  </tr>
28
28
  </thead>
29
29
 
@@ -33,7 +33,7 @@
33
33
  <td><a href="/switches/edit/<%= inx %>"><%= swtch.name %></a><br><small><%= swtch.type %></small></td>
34
34
  <td><a href="/switches/edit/<%= inx %>"><%= swtch.plug %></a></td>
35
35
  <td><a href="/switches/edit/<%= inx %>"><%= hex(swtch.logicalNodeAddress) %>/<%= hex(swtch.logicalAddress) %></a></td>
36
- <td>
36
+ <!--td>
37
37
  <div class="switch">
38
38
  <label>Off
39
39
  <input name="status_<%= swtch.name %>" <%= (swtch.status) ? 'checked' : '' %>
@@ -41,7 +41,7 @@
41
41
  <span class="lever"></span>On
42
42
  </label>
43
43
  </div>
44
- </td>
44
+ </td -->
45
45
  </tr>
46
46
  <% } %>
47
47
  </tbody>