UNPKG

node-red-contrib-xiaomi-smart-devices

Version:
67 lines (61 loc) 2.13 kB
<script type="text/javascript"> RED.nodes.registerType('generic-device', { category: 'xiaomi', color: 'rgb(192, 222, 237)', defaults: { gateway: {value: "", type: "xiaomi-gateway-config"}, name: {value: ""}, sid: {value: "", required: true}, key: {value: "", required: true} }, inputs: 0, outputs: 1, paletteLabel: "generic", icon: "arrow", label: function () { return this.name || "Xiaomi Generic Device"; } }); </script> <script type="text/x-red" data-template-name="generic-device"> <div class="form-row"> <label for="node-input-gateway"><i class="icon-tag"></i> Gateway</label> <input type="text" id="node-input-gateway" placeholder="xiaomi gateway"> </div> <div class="form-row"> <label for="node-input-name"><i class="icon-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name"> </div> <div class="form-row"> <label for="node-input-sid"><i class="icon-tag"></i> SID</label> <input type="text" id="node-input-sid" placeholder="SID"></input> </div> <div class="form-row"> <label for="node-input-key"><i class="icon-tag"></i> Device</label> <input type="text" id="node-input-key" placeholder="Device Key/Name"></text> </div> </script> <script type="text/x-red" data-help-name="generic-device"> <p>The Generic Device (Any Xiaomi Device)</p> <h3>Details</h3> <p>This generic node with is applicaple for any device type</p> <p>The incoming json message is parsed when the <code>sid</code> matches the configured value for this device.</p> <h3>Inputs</h3> <dl class="message-properties"> <dt>payload <span class="property-type">json</span></dt> </dl> <h3>Outputs</h3> <p>Sample message:</p> <p><pre> { cmd: "read_ack", model: "human-body-sensor", sid: "158d00015ef56c", short_id: 21672, device: "kitchen_motion_sensor", data: { "voltage":3035, "status":"flip90" } }</pre></p> </script>