-
Notifications
You must be signed in to change notification settings - Fork 1
/
smartpi-treshold-trigger.html
89 lines (84 loc) · 3.29 KB
/
smartpi-treshold-trigger.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
<script type="text/javascript">
RED.nodes.registerType('smartpi-treshold-trigger', {
category: 'SmartPi',
color: '#E2D96E',
defaults: {
name: {
value: ""
},
rising_threshold: {
value: "",
required: true,
validate: RED.validators.number()
},
falling_threshold: {
value: "",
required: true,
validate: RED.validators.number()
},
levelup: {
value: ""
},
leveldown: {
value: ""
},
},
inputs: 1,
outputs: 1,
icon: "hysteresis.png",
label: function() {
return this.name || "smartpi-treshold-trigger";
},
oneditprepare: function() {
var setstate = function() {
if ($('#node-input-set').is(":checked")) {
$("#node-set-levelup").show();
$("#node-set-leveldown").show();
} else {
$("#node-set-levelup").hide();
$("#node-set-leveldown").hide();
}
};
$("#node-input-set").change(function() {
setstate();
});
setstate();
}
});
</script>
<script type="text/x-red" data-template-name="smartpi-treshold-trigger">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="name">
</div>
<div class="form-row" id="node-set-behavior">
<label> </label>
<input type="checkbox" id="node-input-set" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-set" style="width: 70%;">Change normal behavior?</label>
</div>
<div class="form-row">
<label for="node-input-rising_threshold"><i class="icon-chevron-up"></i> Rising threshold</label>
<input type="text" id="node-input-rising_threshold" placeholder="value">
</div>
<div class="form-row" id="node-set-levelup">
<label for="node-input-levelup"> </label>
<select id="node-input-levelup" style="width: 250px;">
<option value="0">"level - off (0)"</option>
<option selected="selected" value="1">"level - on (1)"</option>
</select>
</div>
<div class="form-row">
<label for="node-input-falling_threshold"><i class="icon-chevron-down"></i> Falling threshold</label>
<input type="text" id="node-input-falling_threshold" placeholder="value">
</div>
<div class="form-row" id="node-set-leveldown">
<label for="node-input-leveldown"> </label>
<select id="node-input-leveldown" style="width: 250px;">
<option selected="selected" value="0">"level - off (0)"</option>
<option value="1">"level - on (1)"</option>
</select>
</div>
</script>
<script type="text/x-red" data-help-name="smartpi-treshold-trigger">
<p>A node that converts values to 0 or 1 for the SmartPi relay. If the input rises above the rising treshold, the output is 1. If the input sings below the falling threshold, the output is 0.</p>
</script>