UNPKG

node-red-contrib-htu21d

Version:

Connect a Measurement Specialties HTU21D humidity sensor to Node-RED

71 lines (66 loc) 2.88 kB
<!-- Copyright 2015 Maxwell Hadley See accompanying LICENSE file for terms of use --> <!-- Edit dialog --> <script type="text/x-red" data-template-name="htu21d"> <div class="form-row"> <label for="node-input-device"><i class="fa fa-cog"></i> Device</label> <input type="text" id="node-input-device" placeholder="Device"> </div> <div class="form-row"> <label for="node-input-updateInterval"><i class="fa fa-repeat"></i> Update at</label> <input type="text" id="node-input-updateInterval" style="width:15%"> <label style="width:50%">second intervals</label> </div> <div class="form-row"> <label><i class="fa fa-tachometer"></i> Units</label> <label for="node-input-dewpointUnits" style="width:16%">Dewpoint:</label> <select id="node-input-dewpointUnits" style="width:12%"> <option value="degC">˚C</option> <option value="degF">˚F</option> </select> <label for="node-input-temperatureUnits"> Temperature:</label> <select id="node-input-temperatureUnits" style="width:12%"> <option value="degC">˚C</option> <option value="degF">˚F</option> </select> </div> <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> </script> <!-- Help text --> <script type="text/x-red" data-help-name="htu21d"> <p>Reads data from a Measurement Specialities HTU21D Humidity sensor using the I2C interface</p> Periodically reads the sensor and sends a message containing temperature, relative humidity and dewpoint (<b>payload.temperature</b>, <b>payload.humidity</b> and <b>payload.dewpoint</b>). Relative humidity is always given in percent; the temperature and dewpoint units of measurement can be selected as required.</p> <p>The dewpoint is calculated from the measured temperature and relative humidity.</p> <p>Measurements regularly update at the specified interval.</p> </script> <!-- Register node type --> <script type="text/javascript"> RED.nodes.registerType('htu21d', { category: 'hardware', defaults: { device: {value: '\/dev\/i2c-1', required:false}, updateInterval: {value: '15', required:true}, dewpointUnits: {value: 'degC', required:true}, temperatureUnits: {value: 'degC', required:true}, name: {value: ''} }, color:'#d8bfd8', inputs:0, outputs:1, icon: 'chip.png', label: function () { return this.name || 'HTU21D'; }, labelStyle: function () { return this.name ? 'node_label_italic' : ''; } }); </script>