-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathezo.html
131 lines (129 loc) · 6.21 KB
/
ezo.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
<script type="text/html" data-template-name="ezo">
<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">
<label for="node-input-ezoBoard"><i class="fa fa-microchip"></i> Module</label>
<select id="node-input-ezoBoard">
</select>
</div>
<div class="form-row">
<label for="node-input-ezoTopic"><i class="fa fa-envelope-o"></i> Topic</label>
<input type="text" id="node-input-ezoTopic">
</div>
<div class="form-row">
<label for="node-input-bus"><i class="fa fa-address-card-o"></i> Bus</label>
<input type="number" id="node-input-bus" style='width: 100px;' min=0 max=7>
</div>
<div class="form-row">
<label for='node-input-customAddr'><i class='fa fa-pencil'></i> Custom</label>
<input type='checkbox' id='node-input-customAddr' style='width: auto; border: none; vertical-align: baseline;'>
<span for='node-input-customAddr' style="padding-left: 5px;">User-defined address?</span>
</div>
<div class="form-row addr-row">
<label for="node-input-address"><i class="fa fa-address-card-o"></i> Address</label>
<input type="number" id="node-input-address" style='width: 100px;' min=3 max=127>
</div>
</script>
<script type="text/html" data-help-name="ezo">
<h3>Details</h3>
<p>
Communicates with Atlas Scientific Ezo modules over I2C.
See manufacturers documentation for supported commands.
</p>
<p>
Input accepts a string in <code>msg.payload</code>,
sends to device as Buffer, then outputs the response.
</p>
<p>
Response is broken into three properties: <code>msg.status</code>
stores the response status with message, <code>msg.command</code>
stores the initial command, and <code>msg.payload</code>
stores the response value(s).
</p>
<h3>References</h3>
<ul>
<li><a href='https://github.com/MaddyTP/node-red-contrib-ezo'>GitHub</a> - the nodes github repository</li>
<li><a href='https://atlas-scientific.com/'>Atlas Scientific</a> - device website.</li>
</ul>
<h3>Documentation</h3>
<ul>
<li><a href='https://atlas-scientific.com/files/pH_EZO_Datasheet.pdf'>EZO-PH</a> - pH</li>
<li><a href='https://atlas-scientific.com/files/ORP_EZO_Datasheet.pdf'>EZO-ORP</a> - ORP</li>
<li><a href='https://atlas-scientific.com/files/DO_EZO_Datasheet.pdf'>EZO-DO</a> - dissolved oxygen</li>
<li><a href='https://atlas-scientific.com/files/EC_EZO_Datasheet.pdf'>EZO-EC</a> - conductivity</li>
<li><a href='https://atlas-scientific.com/files/EZO_RTD_Datasheet.pdf'>EZO-RTD</a> - temperature</li>
<li><a href='https://atlas-scientific.com/files/flow_EZO_Datasheet.pdf'>EZO-FLOW</a> - flow</li>
<li><a href='https://atlas-scientific.com/files/EZO_PMP_Datasheet.pdf'>EZO-PMP</a> - peristaltic pump</li>
<li><a href='https://atlas-scientific.com/files/EZO_PMP_L_Datasheet.pdf'>EZO-PMP-L</a> - peristaltic pump (large)</li>
<li><a href='https://atlas-scientific.com/files/EZO-HUM-Datasheet.pdf'>EZO-HUM</a> - humidity</li>
<li><a href='https://atlas-scientific.com/files/EZO_O2_datasheet.pdf'>EZO-O2</a> - oxygen (gas)</li>
<li><a href='https://atlas-scientific.com/files/EZO_CO2_Datasheet.pdf'>EZO-CO2</a> - carbon dioxide (gas)</li>
<li><a href='https://atlas-scientific.com/files/EZO_RGB_Datasheet.pdf'>EZO-RGB</a> - color</li>
<li><a href='https://atlas-scientific.com/files/EZO-PRS-Datasheet.pdf'>EZO-PRS</a> - pressure</li>
</ul>
</script>
<script type="text/javascript">
var values = [
{v:"ph", t:"pH", tp:'ph'},
{v:"orp", t:"ORP", tp:'orp'},
{v:"do", t:"Dissolved Oxygen", tp:'dissolved_oxygen'},
{v:"ec", t:"Conductivity", tp:'conductivity'},
{v:"rtd", t:"Temperature", tp:'temperature'},
{v:"co2", t:"Carbon Dioxide", tp:'carbon_dioxide'},
{v:"o2", t:"Oxygen", tp:'oxygen'},
{v:"hum", t:"Humidity", tp:'humidity'},
{v:"prs", t:"Pressure", tp:'pressure'},
{v:"pmp", t:"Peristaltic", tp:'peristaltic'},
{v:"pmp-l", t:"Peristaltic - Large", tp:'peristaltic_large'},
{v:"rgb", t:"Color", tp:'color'},
{v:"flo", t:"Flow", tp:'flow'},
];
RED.nodes.registerType('ezo', {
category: 'ezo',
defaults: {
name: { value: '' },
address: { value: 3, validate: function (v) { return ((v === 3) || (RED.validators.number(v) && (v >= 3) && (v <= 127))) } },
customAddr: { value: false },
ezoBoard: { value: '', required: true },
ezoTopic: { value: '' },
bus: { value: 1, required: true, validate: function (v) { return ((v === 1) || (RED.validators.number(v) && (v >= 0) && (v <= 7))) } },
},
color:"#54A769",
inputs:1,
outputs:1,
icon: "serial.png",
label: function() {
var valueText = "";
for (var i = 0; i < values.length; i++) {
if (values[i].v === this.ezoBoard) {
valueText = values[i].t;
if (this.ezoTopic === '') this.ezoTopic = values[i].tp;
break;
}
}
return this.name || valueText || "ezo";
},
labelStyle: function() { return this.name ? "node_label_italic" : ""; },
oneditprepare: function() {
//add a default bus for older nodes (<= v1.3.0)
if (this.bus == undefined) {
this.bus = 1;
}
for (var i = 0; i < values.length; i++) {
var value = values[i].v;
var text = values[i].t;
$('#node-input-ezoBoard').append($("<option></option>").attr("value", value).text(text));
}
$('#node-input-ezoBoard').val(this.ezoBoard);
$('#node-input-customAddr').on("change", function () {
if ($(this)[0].checked) {
$('.addr-row').show();
} else {
$('.addr-row').hide();
}
});
}
});
</script>