UNPKG

node-red-contrib-zigbee2mqtt-devices

Version:
62 lines (55 loc) 2.22 kB
<!--- SONOFF BUTTON NODE ---> <script type="text/javascript"> RED.nodes.registerType('sonoff-button', { category: 'zigbee2mqtt_remotes-sonoff', color: '#f5f5f5', defaults: { name: { value: "" }, bridge: { value: "", type: "zigbee2mqtt-bridge-config" }, deviceName: { value: "", required: true }, }, inputs: 0, outputs: 1, icon: "remote-black.svg", label: function () { return this.name || "Sonoff Button"; }, oneditprepare: function () { var node = this; var deviceName = node.deviceName; RED.bavaria.devices.createDeviceSelector("device-selection", deviceName, "EndDevice", "sonoff", "SNZB-01"); } }); </script> <script type="text/html" data-template-name="sonoff-button"> <div class="zigbee2mqtt-devices-properties"> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <input type="text" id="node-input-name"> </div> <div class="form-row"> <label for="node-input-bridge"><i class="fa fa-server"></i> Bridge</label> <input type="text" id="node-input-bridge" placeholder="bridge" /> </div> <div id="device-selection" class="form-row"> </div> </div> </script> <script type="text/html" data-help-name="sonoff-button"> <p>Sends a new message when a sonoff touch button is pressed.</p> <p>It is only compatible with SONOFF touch button (Model: SNZB-01)</p> <h3>Output</h3> <dl class="message-properties"> <dt> button_name <span class="property-type"> string </span> </dt> <dd> The name of the button that was pressed </dd> <dt> button_type <span class="property-type"> string </span> </dt> <dd> The type in wich way the button was pressed. Following types are available: <ul> <li><code>pressed</code> - single press</li> <li><code>released</code> - hold for a few seconds</li> <li><code>double</code> - double press</li> </ul> </dd> </dl> </script>