forked from charlielito/node-red-contrib-sensor-ds18b20
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsensor.html
59 lines (56 loc) · 2.08 KB
/
sensor.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
<script type="text/javascript">
RED.nodes.registerType('sensor-ds18b20',{
category: 'Raspberry Pi',
color: "#E9967A",
defaults: {
name: {value:""},
topic: {value:""},
sensorid: {value:"", required:true},
timer: {value:"1", required:true, validate:RED.validators.number()},
repeat: {value: false}
},
inputs: 1,
outputs: 1,
icon: "thermometer.png",
label: function() {
return this.name || this.sensorid || "sensor-ds18b20";
},
labelStyle: function() {
return this.name ? "node_label_italic" : "";
},
oneditprepare: function() {
var configuredSensorId = this.sensorid;
$.getJSON('/sensors/1wire/',function(data) {
$.each(data, function( index, value ) {
var isSelected = configuredSensorId === value;
$("#node-input-sensorid").append(
new Option(value, value, isSelected, isSelected));
});
});
}
});
</script>
<script type="text/x-red" data-template-name="sensor-ds18b20">
<div class="form-row">
<label for="node-input-sensorid">
<i class="fa fa-ellipsis-v"></i> Sensor ID
</label>
<select type="text" id="node-input-sensorid">
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-ok"></i>Periodic</label>
<input type="checkbox" id="node-input-repeat">
</div>
<div class="form-row">
<label for="node-input-timer"><i class="fa fa-repeat"></i> Period (secs)</label>
<input type="text" id="node-input-timer" placeholder="1">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name/topic</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="sensor-ds18b20">
<p>Reads temperature from DS18B20 digital sensor in Centigrades (°C)</p>
</script>