Update for Lock/Unlock support

This commit is contained in:
Ben Hardill
2017-03-21 08:24:34 +00:00
parent a7724eca2a
commit af256bfbb1
7 changed files with 53 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 486 B

View File

@@ -33,10 +33,12 @@
<textarea id="friendlyDescription" rows="2"></textarea>
<fieldset>
<legend>Actions</legend>
<label for="turnOn">On: </label>
<input type="checkbox" name="actions" id="turnOn" value="turnOn">
<label for="turnOff">Off: </label>
<input type="checkbox" name="actions" id="turnOff" value="turnOff">
<fieldset id="onOff">
<label for="turnOn">On: </label>
<input type="checkbox" name="actions" id="turnOn" value="turnOn">
<label for="turnOff">Off: </label>
<input type="checkbox" name="actions" id="turnOff" value="turnOff">
</fieldset>
<fieldset id="percentCheck">
<label for="setPercentage">%: </label>
<input type="checkbox" name="actions" id="setPercentage" value="setPercentage" onclick='checkCapability(this)'>
@@ -53,14 +55,20 @@
<label for="decrementTargetTemperature">-&deg;C/F: </label>
<input type="checkbox" name="actions" id="decrementTargetTemperature" value="decrementTargetTemperature" onclick='checkCapability(this)'>
</fieldset>
<!--
<!-- -->
<fieldset id="queryTemperature">
<label ofr="getTargetTemperature">Query Set Point: </label>
<label for="getTargetTemperature">Query Set Point: </label>
<input type="checkbox" name="actions" id="getTargetTemperature" value="getTargetTemperature" onclick='checkCapability(this)'>
<label ofr="getTemperatureReading">Query Current Temp: </label>
<input type="checkbox" name="actions" id="getTemperatureReading" value="getTemperatureReading" onclick='checkCapability(this)'>
</fieldset>
-->
<fieldset id="lockControl">
<label for="">Lock/Unlock</label>
<input type="checkbox" name="actions" id="setLockState" value="setLockState" onclick='checkCapability(this)'>
<label for="">Query Lock State</label>
<input type="checkbox" name="actions" id="getLockState" value="getLockState" onclick='checkCapability(this)'>
</fieldset>
<!-- -->
</fieldset>
</div>
@@ -208,21 +216,36 @@
var t = temp | incTemp | decTemp | qSetTemp | qCurTemp;
if (p & t) {
alert("You can not control both percentage and temperature on the same device");
return;
var lock = $('#setLockState').prop('checked');
var qLock = $('#getLockState').prop('checked');
var l = lock | qLock;
if (p & t || p & l || t & l) {
alert("You can not control percentage and temperature, percentage and lock or temperature and lock on the same device");
return false;
}
if (p) {
$('#temperatureCheck').attr('disabled', true);
$('#percentCheck').removeAttr('disabled');
$('#temperatureCheck').attr('disabled', '');
$('#queryTemperature').attr('disabled', '');
$('#lockControl').attr('disabled', '');
} else if (t) {
$('#temperatureCheck').removeAttr('disabled');
$('#queryTemperature').removeAttr('disabled');
$('#lockControl').attr('disabled', '');
$('#percentCheck').attr('disabled', '');
} else if (l) {
$('#lockControl').removeAttr('disabled');
$('#temperatureCheck').attr('disabled', '');
$('#queryTemperature').attr('disabled', '');
$('#percentCheck').attr('disabled', '');
} else {
$('#temperatureCheck').attr('disabled', false);
}
if (t) {
$('#percentCheck').attr('disabled', true);
} else {
$('#percentCheck').attr('disabled', false);
$('#percentCheck').removeAttr('disabled');
$('#temperatureCheck').removeAttr('disabled');
$('#queryTemperature').removeAttr('disabled');
$('#lockControl').removeAttr('disabled');
}
}

View File

@@ -20,7 +20,7 @@
<p>After you have created an account you need to define some devices to control. Once you are
logged in a "Devices" tab should appear in the menu at the top of the page. From here you can
add new, edit or delete existing devices.</p>
<img width="1133" height="276" src="/images/devices.png">
<img width="1134" height="388" src="/images/devices.png">
The name you give to the device will be how you access it from Alexa.
<h2 id="linkAccount">Link Account</h2>
@@ -112,7 +112,7 @@ npm install node-red-contrib-alexa-home-skill</pre>
"extraInfo": {},
payload: -5
}</pre>
<p>The important bits ae the <i>msg.command</i> and the <i>msg.payload</i>. The <i>msg.command</i> will be one of the following list (that corresponds to the capabilities you added to the device when you defined it):</p>
<p>The important bits are the <i>msg.command</i> and the <i>msg.payload</i>. The <i>msg.command</i> will be one of the following list (that corresponds to the capabilities you added to the device when you defined it):</p>
<ul>
<li>TurnOnRequest</li>
<li>TurnOffRequest</li>
@@ -122,7 +122,17 @@ npm install node-red-contrib-alexa-home-skill</pre>
<li>SetTemperatureRequest</li>
<li>IncrementTemperatureRequest</li>
<li>DecrementTemperatureRequest</li>
<li>GetTemperatureReadingRequest <sup>1,2</sup></li>
<li>GetTargetTemperatureRequests <sup>1,2</sup></li>
<li>SetLockState <sup>1</sup></li>
<li>GetLockState <sup>1,2</sup></li>
</ul>
<ol>
<li>Only available in to US users at the moment</li>
<li>Can not be Auto Acknoledged as they need to return a value</li>
</ol>
<p>The payload field will hold positive numbers for the Set and Increment versions of commands and negative numbers
for the Decrement versions. For TurnOn/TurnOff the payload will be true/false</p>