-
Notifications
You must be signed in to change notification settings - Fork 0
/
Read.html
63 lines (58 loc) · 2.94 KB
/
Read.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
<!--
Copyright 2016 Danfoss A/S.
MIT License
-->
<script type="text/x-red" data-template-name="DCloud-Read">
<div class="form-row">
<label for="node-input-partid"><i class="fa fa-server"></i> Source</label>
<input type="text" id="node-input-source" placeholder="source">
</div>
<div class="form-row">
<label for="node-input-variable"><i class="fa fa-key"></i> Variable(s)</label>
<input type="text" id="node-input-variable" placeholder="variable">
</div>
<div class="form-row">
<label for="node-input-from"><i class="fa fa-clock-o"></i> From</label>
<input type="text" id="node-input-from" placeholder="from">
</div>
</script>
<!-- Next, some simple help text is provided for the node. -->
<script type="text/x-red" data-help-name="DCloud-Read">
<!-- data-help-name identifies the node type this help is for -->
<!-- This content appears in the Info sidebar when a node is selected -->
<!-- The first <p> is used as the pop-up tool tip when hovering over a -->
<!-- node in the palette. -->
<p>
DCloud read value(s) from the given source
</p>
<p>
Select a specific node in the Variables (multiple comma separated variables will be supported at some point in time)
</p>
<p>
leave from empty to get the latest value including the timestamp (notice checked and changed might be diferent, checked is when it was last validated, changed is when it was last observed as changed)
if entering something then format the inquery as {integer}{h|d|m} where h is hours, d days m months. Observe the rounding back (to enable database caching) hours rounded back to nearest hour, days and months as well.
</p>
</script>
<!-- Finally, the node type is registered along with all of its properties -->
<!-- The example below shows a small subset of the properties that can be set-->
<script type="text/javascript">
RED.nodes.registerType('DCloud-Read', {
category: 'dcloud', // the palette category
defaults: { // defines the editable properties of the node
source: { value: "", type: "DCloud-Source" },
variable: { value: "", required: true },
from: { value: "", required: false},
name: { value: "DCloud Read" }
},
inputs: 1, // set the number of inputs - only 0 or 1
outputs: 1, // set the number of outputs - 0 to n
// set the icon (held in icons dir below where you save the node)
icon: "DCloudDataLatest.png", // saved in icons/myicon.png
color: "#FF0000",
label: function () { // sets the default label contents
var _sourceObj = RED.nodes.node(this.source);
//console.debug(_sourceObj);
return 'R ' + this.variable+'@'+_sourceObj.name;
}
});
</script>