UNPKG

@gemini86/node-red-ds18b20

Version:

Node-RED node for ds18b20 sensors connected on GPIO (fork of iiot2k, which was removed from NPM)

112 lines (98 loc) 4.34 kB
<!-- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <script type="text/javascript"> RED.nodes.registerType('read-ds18b20', { category: 'KingIOT', color: 'rebeccapurple', paletteLabel: 'ds18b20', defaults: { gpio: { value: 21, required: true, validate: function (v) { return (RED.validators.number(v) && (v >= 2) && (v <= 27)); } }, tupdate: { value: 5, required: true, validate: function (v) { return RED.validators.number(v) && (v >= 1) && (v <= 500); } }, resolution: { value: "9", required: true }, onchange: { value: true }, fahrenheit: { value: false }, name: { value: "" }, }, inputs: 1, outputs: 1, icon:"font-awesome/fa-thermometer-full", labelStyle: function() { return this.name ? "node_label_italic" : ""; }, label: function () { return this.name || "ds18b20-gpio" + this.gpio; }, }); </script> <script type="text/html" data-template-name="read-ds18b20"> <div class="form-row"> <label style="width:100%; border-bottom: 2px solid rgb(0, 0, 0);"><b>ds18b20 temperature sensors</b></label> </div> <div class="form-row"> <label for="node-input-gpio">GPIO</label> <input id="node-input-gpio" input type="number" min="2" max="27" required style="width: auto;"> </div> <div class="form-row"> <label for="node-input-resolution">Resolution</label> <select type="text" id="node-input-resolution" style="width: auto;"> <option value="9">9 bit</option> <option value="10">10 bit</option> <option value="11">11 bit</option> <option value="12">12 bit</option> </select> </div> <div class="form-row"> <label for="node-input-onchange">On-Change</label> <input type="checkbox" id="node-input-onchange" style="display: inline-block; width: auto; vertical-align: top;"> </div> <div class="form-row"> <label for="node-input-fahrenheit">Fahrenheit</label> <input type="checkbox" id="node-input-fahrenheit" style="display: inline-block; width: auto; vertical-align: top;"> </div> <div class="form-row"> <label for="node-input-tupdate">Update-Cycle</label> <input id="node-input-tupdate" input type="number" min="1" max="500" required style="width: auto;"> <label for="node-input-tupdate"> s</label> </div> <div class="form-row"> <label for="node-input-name">Name</label> <input id="node-input-name" type="text"> </div> </script> <script type="text/markdown" data-help-name="read-ds18b20"> ds18b20 temperature sensors ### Input : *any* (any) : updates sensor list ### Output : *payload* (number array) : sensor temperatures array : *topic* (string array) : sensor ID's array ### Details This node reads ds18b20 sensors connected on gpio.<br> Only one node per pin is possible.<br> <br> ```On-Change:```<br> unchecked: Output message is always send<br> checked: Output message is send when values changes<br> <br> ```Fahrenheit:```<br> unchecked: Temerature is in Celsius<br> checked: Temerature is in Fahrenheit<br> <br> It is important that a 4.7k pullup resistor is connected.<br> If you add or remove a sensor, you must restart the nodes<br> or send any message to node input for update.<br> The position in the array may change.<br> The array element is *undefined* if the sensor is not read.<br> The node does not support the parasite mode.<br> Please do not activate the 1-wire subsystem of the raspberry pi.<br> This node works on Raspberry Pi with 32bit or 64bit OS.<br> Check with raspi-config for alternate functions on GPIO.<br> If alternate function on GPIO is overwritten then malfunction is made.<br> </script>