UNPKG

node-red-contrib-smartnora

Version:

Google Smart Home integration via Smart Nora https://smart-nora.eu/

125 lines (123 loc) 4.78 kB
<script type="text/javascript"> RED.nodes.registerType('noraf-speaker', { category: 'nora', color: 'rgb(235, 227, 141)', icon: 'assistant.png', defaults: { devicename: { value: 'Speaker', required: true, }, roomhint: { value: '' }, name: { value: '' }, passthru: { value: false, }, step: { value: 5, validate: function (v) { return RED.validators.number()(v) && v >= 1 && v <= 50; }, }, nora: { type: 'noraf-config', required: true }, topic: { value: '' }, twofactor: { value: 'off', }, twofactorpin: { value: '' }, filter: { value: false, } }, inputs: 1, outputs: 1, paletteLabel: 'speaker', label: function () { return this.name || this.devicename || 'speaker'; }, oneditprepare: function() { $('#node-input-twofactor').change(function () { if ($(this).val() === 'pin') { $('#node-twofactor-pin').show(); } else { $('#node-twofactor-pin').hide(); } }); }, }); </script> <script type="text/x-red" data-template-name="noraf-speaker"> <div class="form-row"> <label for="node-input-nora"><i class="fa fa-table"></i> Config</label> <input type="text" id="node-input-nora"> </div> <div class="form-row"> <label for="node-input-devicename"><i class="fa fa-i-cursor"></i> Speaker</label> <input type="text" id="node-input-devicename"> </div> <div class="form-row"> <label for="node-input-step"><i class="fa fa-i-cursor"></i> Volume step</label> <input type="text" id="node-input-step"> </div> <div class="form-row"> <label style="width:auto" for="node-input-passthru"><i class="fa fa-arrow-right"></i> If <code>msg</code> arrives on input, pass through to output: </label> <input type="checkbox" id="node-input-passthru" style="display:inline-block; width:auto; vertical-align:top;"> </div> <div class="form-row"> <label style="width:auto" for="node-input-filter"><i class="fa fa-filter"></i> Ignore input messages that don't match the <code>topic</code> value: </label> <input type="checkbox" id="node-input-filter" style="display:inline-block; width:auto; vertical-align:top;"> </div> <div class="form-row"> <label for="node-input-roomhint"><i class="fa fa-i-cursor"></i> Room Hint</label> <input type="text" id="node-input-roomhint"> </div> <div class="form-row"> <label for="node-input-twofactor"><i class="fa fa-question-sign"></i> Two Factor</label> <select id="node-input-twofactor"> <option value="off">None</option> <option value="ack">Acknowledge</option> <option value="pin">Pin</option> </select> </div> <div id="node-twofactor-pin" class="form-row"> <label for="node-input-twofactorpin"><i class="fa fa-code"></i> Pin</label> <input type="text" id="node-input-twofactorpin"> </div> <div class="form-row"> <label for="node-input-topic" style="padding-left:25px; margin-right:-25px">Topic</label> <input type="text" id="node-input-topic"> </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"> </div> </script> <script type="text/x-red" data-help-name="noraf-speaker"> <p> <strong>Experimental!</strong> Represents a <a href="https://github.com/actions-on-google/smart-home-nodejs/issues/253">Google Home Speaker</a>. <br> Input payload can have one or more be of the following properties <code> <strong>on</strong> - boolean. Speaker on or off state.<br> <strong>volume</strong> - number (0-100). represents the current volume of the speaker;<br> </code> Output payload has the properties that can be changed from Google Home: <code> <strong>on</strong> - boolean. Speaker on or off state.<br> <strong>volume</strong> - number (0-100). represents the current volume of the speaker;<br> </code> <br> <strong>Room Hint</strong>: Provides the current room of the device in the user's home to simplify setup. </p> </script>