UNPKG

node-red-contrib-amazon-echo-ext

Version:

Alexa controlled Node-Red nodes supporting latest Amazon Echo devices

169 lines (138 loc) 6.23 kB
<script type="text/javascript"> RED.nodes.registerType('amazon-echo-hub',{ category: "input", color: "#31C4F3", defaults: { port: {value:"80", required:true, validate: function(port) { return port > 0 && port < 65536; } }, enableinput: {value:false} }, inputs:1, outputs:1, icon: "amazon-echo-hub.png", label: function() { return "Amazon Echo Hub"; } }); </script> <script type="text/x-red" data-template-name="amazon-echo-hub"> <div class="form-row"> <label for="node-input-port"><i class="fa fa-globe"></i> Port</label> <input type="text" id="node-input-port" placeholder="80"> </div> <div class="form-row"> <label for="node-input-enableinput"><i class="fa fa-tag"></i> Enable Input</label> <input type="checkbox" id="node-input-enableinput"> </div> <div class="form-tips"> Tips: <p> <ul> <li>Set port to <strong>80</strong> if you have latest generation Amazon Echo devices.</li> <li>Enable input if you want to send signal to Amazon Echo Hub.</li> </ul> </p> </div> </script> <script type="text/x-red" data-help-name="amazon-echo-hub"> <p>Amazon Echo Hub</p> <h3>Inputs</h3> Enable input to allow input payload signals <dl class="message-properties"> <dt>payload <span class="property-type">string | buffer</span> </dt> <dd> the payload of the message to publish</dd> <dt>payload.nodeid <span class="property-type">string</span></dt> <dd>Node ID is Amazon Echo Device Node ID</dd> <dt>payload.on <span class="property-type">string</span></dt> <dd>on/off state of the light</dd> <dt>payload.bri <span class="property-type">number</span></dt> <dd>Brightness of the light (min 1, max 254)</dd> <dt>payload.hue <span class="property-type">number</span></dt> <dd>Hue of the light (min 0, max 65535)</dd> <dt>payload.sat <span class="property-type">number</span></dt> <dd>Saturation of the light (min 0, max 65535)</dd> <dt>payload.ct <span class="property-type">string</span></dt> <dd>The mired color temperature of the light (min 153, max 500)</dd> </dl> <h3>Outputs</h3> <dl class="message-properties"> <dt>payload <span class="property-type">string</span></dt> <dd>On state of the light (On - true, Off - false)</dd> <dt>on <span class="property-type">boolean</span></dt> <dd>On/Off state of the light</dd> <dt>bri <span class="property-type">number</span></dt> <dd>Brightness of the light (min 1, max 254)</dd> <dt>hue <span class="property-type">number</span></dt> <dd>Hue of the light (min 0, max 65535)</dd> <dt>sat <span class="property-type">number</span></dt> <dd>Saturation of the light (min 0, max 254)</dd> <dt>ct <span class="property-type">string</span></dt> <dd>The mired color temperature of the light (min 153, max 500)</dd> <dt>colormode <span class="property-type">string</span></dt> <dd>Indicates the color mode (cr - Color Temperature | hs - Hue and Saturation)</dd> <dt>rgb <span class="property-type">array</span></dt> <dd>The light color in RGB format</dd> </dl> </script> <script type="text/javascript"> RED.nodes.registerType('amazon-echo-device',{ category: "input", color: "#31C4F3", defaults: { name: {value:"", required:true}, topic: {value:"", required:false}, friendlyname: {value:"", required:false} }, inputs:1, outputs:1, icon: "amazon-echo-device.png", label: function() { return this.name || "Amazon Echo Device"; } }); </script> <script type="text/x-red" data-template-name="amazon-echo-device"> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i>Alexa Name</label> <input type="text" id="node-input-name" placeholder="Bedroom light"> </div> <div class="form-tips">Alexa uses this <strong>Name</strong> to indentify your device by voice. This has to be unique for each device. If you have renamed your device, please ask Alexa to discover again.</div> <p></p> <div class="form-row"> <label for="node-input-friendlyname"><i class="fa fa-tag"></i>Friendly Name</label> <input type="text" id="node-input-friendlyname" placeholder="Hue"> </div> <div class="form-tips">A controller can use this <strong>Friendly Name</strong> to indentify your device. This has to be unique for each device.</div> <p></p> <div class="form-row"> <label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label> <input type="text" id="node-input-topic"> </div> </script> <script type="text/x-red" data-help-name="amazon-echo-device"> <p>Amazon Echo Device</p> <h3>Outputs</h3> <dl class="message-properties"> <dt>payload <span class="property-type">string</span></dt> <dd>On state of the light (On - true, Off - false)</dd> <dt>on <span class="property-type">boolean</span></dt> <dd>On/Off state of the light</dd> <dt>bri <span class="property-type">number</span></dt> <dd>Brightness of the light (min 1, max 254)</dd> <dt>hue <span class="property-type">number</span></dt> <dd>Hue of the light (min 0, max 65535)</dd> <dt>sat <span class="property-type">number</span></dt> <dd>Saturation of the light (min 0, max 254)</dd> <dt>ct <span class="property-type">string</span></dt> <dd>The mired color temperature of the light (min 153, max 500)</dd> <dt>colormode <span class="property-type">string</span></dt> <dd>Indicates the color mode (cr - Color Temperature | hs - Hue and Saturation)</dd> <dt>rgb <span class="property-type">array</span></dt> <dd>The light color in RGB format</dd> </dl> </script>