homebridge-smartsystem 6.2.6 → 6.3.2
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 +4 -0
- package/config.json +21 -194
- package/duotecno/logger.js +1 -0
- package/duotecno/logger.ts +1 -0
- package/duotecno/master.js +1 -1
- package/duotecno/master.ts +2 -1
- package/duotecno/system.js +7 -2
- package/duotecno/system.ts +11 -2
- package/duotecno/types.js +13 -4
- package/duotecno/types.ts +21 -9
- package/package.json +1 -1
- package/server/base.js +3 -1
- package/server/base.ts +3 -1
- package/server/p1.js +22 -22
- package/server/p1.ts +15 -13
- package/server/powerbase.js +7 -6
- package/server/powerbase.ts +10 -8
- package/server/shelly.js +144 -11
- package/server/shelly.ts +161 -15
- package/server/smappee.js +4 -3
- package/server/smappee.ts +6 -3
- package/server/smartapp.js +5 -5
- package/server/smartapp.ts +5 -5
- package/server/views/power.ejs +20 -11
package/server/smartapp.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { setToken } from "../duotecno/config";
|
|
|
26
26
|
|
|
27
27
|
const kMaster = {name: "master", type: "string", default: "0.0.0.0:5001"} as const;
|
|
28
28
|
const kAddress = {name: "address", type: "string", default: "0.0.0.0"} as const;
|
|
29
|
+
const kAddresses = {name: "addresses", type: "string", default: "[0.0.0.0]"} as const;
|
|
29
30
|
const kAddressOld = {name: "addressX", type: "string", default: "0.0.0.0"} as const;
|
|
30
31
|
const kPort = {name: "port", type: "integer", default: 80} as const;
|
|
31
32
|
const kPortOld = {name: "portX", type: "integer", default: 80} as const;
|
|
@@ -357,7 +358,7 @@ export class SmartApp extends WebApp {
|
|
|
357
358
|
power.updateRule( id, this.scrapeRule(context) );
|
|
358
359
|
|
|
359
360
|
} else if (context.action === "save") {
|
|
360
|
-
power.updateConfig({address: context.getParam(kAddress), uid: context.getParam(kUID)});
|
|
361
|
+
power.updateConfig({address: context.getParam(kAddress), uid: context.getParam(kUID), addresses: context.getParam(kAddresses), });
|
|
361
362
|
|
|
362
363
|
|
|
363
364
|
} else if (context.action === "badd") {
|
|
@@ -879,7 +880,6 @@ export class SmartApp extends WebApp {
|
|
|
879
880
|
|
|
880
881
|
async updateNodes(master: Master, nodes, params) {
|
|
881
882
|
if (nodes) {
|
|
882
|
-
// let nodeArr = nodes.split(",").map(s => parseInt(s));
|
|
883
883
|
let nodeArr = nodes.map(s => parseInt(s));
|
|
884
884
|
nodeArr.forEach(adr => {
|
|
885
885
|
let node = this.system.findNode(master, adr);
|
|
@@ -935,7 +935,7 @@ export class SmartApp extends WebApp {
|
|
|
935
935
|
} else { // context.action === "node"
|
|
936
936
|
// reponding to /units/[master ip address:port]/[logical node address]
|
|
937
937
|
const nodeLogicalAddress = parseInt(context.id);
|
|
938
|
-
let response = await this.getNodeInfo(master, nodeLogicalAddress);
|
|
938
|
+
let response = await this.getNodeInfo(master, nodeLogicalAddress, true);
|
|
939
939
|
let N = this.sortCopy(response.node, context);
|
|
940
940
|
return this.ejs("nodeDetail", context, { message: response.message, node: N });
|
|
941
941
|
}
|
|
@@ -970,14 +970,14 @@ export class SmartApp extends WebApp {
|
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
972
|
|
|
973
|
-
async getNodeInfo(master: Master, nodeLogicalAddress: number) {
|
|
973
|
+
async getNodeInfo(master: Master, nodeLogicalAddress: number, doFetch = false) {
|
|
974
974
|
let node = this.system.findNode(master, nodeLogicalAddress);
|
|
975
975
|
if (! node) {
|
|
976
976
|
// if no node found, make some dummy node for the display system. (should not occur !)
|
|
977
977
|
return { node: new Node(this.system.masters[0], {name: "No node"}), message: "Node not found" };
|
|
978
978
|
|
|
979
979
|
} else {
|
|
980
|
-
if (node.nrUnits != node.units.length)
|
|
980
|
+
if ((node.nrUnits != node.units.length) || doFetch)
|
|
981
981
|
await master.fetchAllUnits(node);
|
|
982
982
|
await node.master.requestNodeStatus(node);
|
|
983
983
|
return { node };
|
package/server/views/power.ejs
CHANGED
|
@@ -38,6 +38,14 @@
|
|
|
38
38
|
</div>
|
|
39
39
|
<% } %>
|
|
40
40
|
|
|
41
|
+
<% if (type === "shelly") { %>
|
|
42
|
+
<div class="row">
|
|
43
|
+
<div class="input-field col s12">
|
|
44
|
+
<input placeholder="xx.xx.xx.xx, ..." id="addresses" name="addresses" type="text" value="<%= config.addresses %>">
|
|
45
|
+
<label for="addresses">Addresses (komma separated)</label>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<% } %>
|
|
41
49
|
|
|
42
50
|
<h1>Rules
|
|
43
51
|
<button class="right btn waves-effect waves-light" type="submit" name="action" value="add">Add rule</button>
|
|
@@ -91,17 +99,17 @@
|
|
|
91
99
|
<h1>Info</h1>
|
|
92
100
|
<% if (realtime) { %>
|
|
93
101
|
<table>
|
|
94
|
-
<tr><th>
|
|
95
|
-
<th>
|
|
96
|
-
<th>
|
|
102
|
+
<tr><th>Total Power</th><th>Total Reactive</th>
|
|
103
|
+
<th>Total Export</th><th>Total Import</th>
|
|
104
|
+
<th>Status</th></tr>
|
|
97
105
|
<tr><td><%= realtime.totalPower %></td><td><%= realtime.totalReactivePower %></td>
|
|
98
106
|
<td><%= watt(realtime.totalExportEnergy) %>h</td><td><%= watt(realtime.totalImportEnergy) %>h</td>
|
|
99
107
|
<td><%= realtime.monitorStatus %></td></tr>
|
|
100
|
-
<tr><th>
|
|
108
|
+
<tr><th>Time</th>
|
|
101
109
|
<% for (let inx in voltages) { %>
|
|
102
110
|
<th>Phase <%= inx %></th>
|
|
103
111
|
<% } %>
|
|
104
|
-
<th>
|
|
112
|
+
<th>Poll Counter</th>
|
|
105
113
|
</tr>
|
|
106
114
|
<tr><td><%= datetime(new Date(realtime.utcTimeStamp)) %></td>
|
|
107
115
|
<% for (let inx in voltages) { %>
|
|
@@ -114,16 +122,17 @@
|
|
|
114
122
|
|
|
115
123
|
<h1>Channels</h1>
|
|
116
124
|
<table>
|
|
117
|
-
<tr><th>
|
|
118
|
-
<th>
|
|
119
|
-
<th>
|
|
120
|
-
<th>cosPhi</th><th>
|
|
125
|
+
<tr><th>Index</th><th>Name</th>
|
|
126
|
+
<th>Power</th><th>Total Export</th><th>Total Import</th>
|
|
127
|
+
<th>Phase</th><th>Current</th><th>Voltage</th><th>Apparent Power</th>
|
|
128
|
+
<th>cosPhi</th><th>Type</th><th>Flow</th><th>Formula</th></tr>
|
|
121
129
|
<% for (let inx in channels) { const ch = channels[inx]; %>
|
|
122
130
|
<tr><td><%= inx %></td>
|
|
123
131
|
<td><%= ch.name %></td>
|
|
124
|
-
<td><%= ch.power %></td>
|
|
132
|
+
<td><%= watt(ch.power) %></td>
|
|
125
133
|
<td><%= watt(ch.exportEnergy) %></td><td><%= watt(ch.importEnergy) %></td>
|
|
126
|
-
<td><%= ch.phaseId %></td><td><%= ch.current
|
|
134
|
+
<td><%= (ch.phaseId >= 0) ? ch.phaseId : "-" %></td><td><%= Math.round(ch.current*100)/100 %>A</td>
|
|
135
|
+
<td><%= ch.voltage %>V</td>
|
|
127
136
|
<td><%= ch.apparentPower %></td><td><%= ch.cosPhi %></td>
|
|
128
137
|
<td><%= ch.type %></td><td><%= ch.flow %></td><td><%= ch.formula %></td>
|
|
129
138
|
</tr>
|