-
Notifications
You must be signed in to change notification settings - Fork 2
/
powertag.html
239 lines (193 loc) · 12.7 KB
/
powertag.html
1
2
3
4
5
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
<script type="text/javascript">
RED.nodes.registerType('powertag',{
category: 'PowerLogic',
color: '#009E4D',
defaults: {
name: {value:""},
unitId: {value: "1",required:true},
device: {value: "",required:true},
data: {value: "", required: true}
},
inputs:1,
outputs:1,
icon: "serial.png",
label: function() {
return this.name||"powertag";
},
<!--When the config screen is opened-->
oneditprepare: function() {
<!--Previous data set-->
const myData = this.data;
$("#node-input-device").on("change",function() {
if (this.value === "") {
$("#node-input-data-energy-x63").hide();
$("#node-input-data-energy-m250-m630").hide();
$("#node-input-data-energy-f160-rope").hide();
}
else if (this.value === "powertag-energy-x63") {
$("#node-input-data-energy-x63").show();
$("#node-input-data-energy-m250-m630").hide();
$("#node-input-data-energy-f160-rope").hide();
$("#node-input-data-energy-x63 option[value=" + myData + "]").attr("selected", true);
}
else if (this.value === "powertag-energy-m250-m630") {
$("#node-input-data-energy-x63").hide();
$("#node-input-data-energy-m250-m630").show();
$("#node-input-data-energy-f160-rope").hide();
$("#node-input-data-energy-m250-m630 option[value=" + myData + "]").attr("selected", true);
}
else if (this.value === "powertag-energy-f16-rope") {
$("#node-input-data-energy-x63").hide();
$("#node-input-data-energy-m250-m630").hide();
$("#node-input-data-energy-f160-rope").show();
$("#node-input-data-energy-f160-rope option[value=" + myData + "]").attr("selected", true);
}
}).trigger("change");
},
<!--When the config screen is closed ('done' button)-->
oneditsave: function () {
<!--Check wich device type is selected-->
let deviceType = $("#node-input-device option:selected");
<!--PowerTag Energy x63-->
if(deviceType.val() == "powertag-energy-x63") {
let dataValue = $("#node-input-data-energy-x63 option:selected");
this.data = dataValue.val();
console.log('deviceType ' + deviceType.val());
console.log(this.data);
}
<!--PowerTag Energy M250/M630-->
if(deviceType.val() == "powertag-energy-m250-m630") {
let dataValue = $("#node-input-data-energy-m250-m630 option:selected");
this.data = dataValue.val();
console.log('deviceType ' + deviceType.val());
console.log(this.data);
}
<!--PowerTag Energy F160/Rope-->
if(deviceType.val() == "powertag-energy-f16-rope") {
let dataValue = $("#node-input-data-energy-f160-rope option:selected");
this.data = dataValue.val();
console.log('deviceType ' + deviceType.val());
console.log(this.data);
}
}
});
</script>
<script type="text/x-red" data-template-name="powertag">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-unitId"><i class="icon-tag"></i> Unit ID</label>
<input type="text" id="node-input-unitId" placeholder=" 123">
</div>
<div class="form-row">
<label for="node-input-device"><i class="icon-tag"></i> Device</label>
<select id="node-input-device" name="node-input-device">
<option value="powertag-energy-x63">PowerTag Energy x63</option>
<option value="powertag-energy-m250-m630">PowerTag Energy M250/M630</option>
<option value="powertag-energy-f16-rope">PowerTag Energy F160/Rope</option>
</select>
</div>
<div id="node-input-data-energy-x63" class="form-row">
<label for="node-input-data-energy-x63"><i class="icon-list"></i> Measure</label>
<select id="node-input-data-energy-x63">
<option value="rms-current-phase-a">RMS current phase A</option>
<option value="rms-current-phase-b">RMS current phase B</option>
<option value="rms-current-phase-c">RMS current phase C</option>
<option value="rms-voltage-a-b">RMS phase-to-phase voltage A-B</option>
<option value="rms-voltage-b-c">RMS phase-to-phase voltage B-C</option>
<option value="rms-voltage-c-a">RMS phase-to-phase voltage C-A</option>
<option value="rms-voltage-a-n">RMS phase-to-neutral voltage A-N</option>
<option value="rms-voltage-b-n">RMS phase-to-neutral voltage B-N</option>
<option value="rms-voltage-c-n">RMS phase-to-neutral voltage C-N</option>
<option value="active-power-phase-a">Active power phase A</option>
<option value="active-power-phase-b">Active power phase B</option>
<option value="active-power-phase-c">Active power phase C</option>
<option value="active-power-total">Total active power</option>
<option value="apparent-power-total">Total apparent power</option>
<option value="power-factor-total">Total power factor</option>
<option value="total-active-energy-delivered-received">Total active energy delivered + received</option>
<option value="partial-active-energy-delivered-received">Partial active energy delivered + received</option>
<option value="total-active-power-demand">Demand total active power</option>
<option value="max-demand-total-active-power">Maximum demand total active power</option>
</select>
</div>
<div id="node-input-data-energy-m250-m630" class="form-row">
<label for="node-input-data-energy-m250-m630"><i class="icon-list"></i> Measure</label>
<select id="node-input-data-energy-m250-m630">
<option value="rms-current-phase-a">RMS current phase A</option>
<option value="rms-current-phase-b">RMS current phase B</option>
<option value="rms-current-phase-c">RMS current phase C</option>
<option value="rms-voltage-a-b">RMS phase-to-phase voltage A-B</option>
<option value="rms-voltage-b-c">RMS phase-to-phase voltage B-C</option>
<option value="rms-voltage-c-a">RMS phase-to-phase voltage C-A</option>
<option value="rms-voltage-a-n">RMS phase-to-neutral voltage A-N</option>
<option value="rms-voltage-b-n">RMS phase-to-neutral voltage B-N</option>
<option value="rms-voltage-c-n">RMS phase-to-neutral voltage C-N</option>
<option value="active-power-phase-a">Active power phase A</option>
<option value="active-power-phase-b">Active power phase B</option>
<option value="active-power-phase-c">Active power phase C</option>
<option value="active-power-total">Total active power</option>
<option value="reactive-power-total">Total reactive power</option>
<option value="apparent-power-total">Total apparent power</option>
<option value="power-factor-total">Total power factor</option>
<option value="frequency">Frequency</option>
<option value="device-temperature">Device temperature</option
<option value="total-active-energy-delivered-count-positively">Total active energy delivered count positively</option>
<option value="total-active-energy-received">Total active energy received</option>
<option value="active-energy-phase-a-delivered">Active energy phase A delivered</option>
<option value="active-energy-phase-b-delivered">Active energy phase B delivered</option>
<option value="active-energy-phase-c-delivered">Active energy phase C delivered</option>
<option value="partial-active-energy-delivered">Partial active energy delivered</option>
<option value="partial-active-energy-received">Partial active energy received</option>
<option value="partial-reactive-energy-delivered">Partial reactive energy delivered</option>
<option value="partial-reactive-energy-received">Partial reactive energy received</option>
</select>
</div>
<div id="node-input-data-energy-f160-rope" class="form-row">
<label for="node-input-data-energy-f160-rope"><i class="icon-list"></i> Measure</label>
<select id="node-input-data-energy-f160-rope">
<option value="rms-current-phase-a">RMS current phase A</option>
<option value="rms-current-phase-b">RMS current phase B</option>
<option value="rms-current-phase-c">RMS current phase C</option>
<option value="rms-current-phase-neutral">RMS current neutral</option>
<option value="rms-voltage-a-b">RMS phase-to-phase voltage A-B</option>
<option value="rms-voltage-b-c">RMS phase-to-phase voltage B-C</option>
<option value="rms-voltage-c-a">RMS phase-to-phase voltage C-A</option>
<option value="rms-voltage-a-n">RMS phase-to-neutral voltage A-N</option>
<option value="rms-voltage-b-n">RMS phase-to-neutral voltage B-N</option>
<option value="rms-voltage-c-n">RMS phase-to-neutral voltage C-N</option>
<option value="active-power-phase-a">Active power phase A</option>
<option value="active-power-phase-b">Active power phase B</option>
<option value="active-power-phase-c">Active power phase C</option>
<option value="active-power-total">Total active power</option>
<option value="reactive-power-phase-a">Reactive power phase A</option>
<option value="reactive-power-phase-b">Reactive power phase B</option>
<option value="reactive-power-phase-c">Reactive power phase C</option>
<option value="reactive-power-total">Total reactive power</option>
<option value="apparent-power-phase-a">Apparent power phase A</option>
<option value="apparent-power-phase-b">Apparent power phase B</option>
<option value="apparent-power-phase-c">Apparent power phase C</option>
<option value="apparent-power-total">Total apparent power</option>
<option value="power-factor-phase-a">Power factor phase A</option>
<option value="power-factor-phase-b">Power factor phase B</option>
<option value="power-factor-phase-c">Power factor phase C</option>
<option value="power-factor-total">Total power factor</option>
<option value="power-factor-sign">Power factor sign convention</option>
<option value="frequency">Frequency</option>
<option value="device-temperature">Device temperature</option>
<option value="total-active-energy-delivered-count-positively">Total active energy delivered count positively</option>
<option value="total-active-energy-received">Total active energy received</option>
<option value="partial-active-energy-delivered">Partial active energy delivered</option>
<option value="partial-active-energy-received">Partial active energy received</option>
<option value="partial-reactive-energy-delivered">Partial reactive energy delivered</option>
<option value="partial-reactive-energy-received">Partial reactive energy received</option>
<option value="total-active-power-demand">Demand total active power</option>
<option value="max-demand-total-active-power">Maximum demand total active power</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="powertag">
<p>This node resumes the configuration parameters that are necessary to poll a Schneider Electric PowerTag series over Modbus TCP/IP. To use this node:<br>1. Enter Modbus unit ID.<br>2. Select device type. <br>3. Select which information you want to request from the device.<br>4. Add more node to select more data.</p>
</script>