commit
3ec0440e2d
|
|
@ -22,6 +22,16 @@ function changeSwitch(checkboxElem, idx) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Switch functions
|
||||||
|
function changePush(idx, action) {
|
||||||
|
if (action == 'on') {
|
||||||
|
requestAPI(flask_server + "/api?type=command¶m=switchlight&idx=" + idx + "&switchcmd=On" );
|
||||||
|
} else {
|
||||||
|
requestAPI(flask_server + "/api?type=command¶m=switchlight&idx=" + idx + "&switchcmd=Off" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function refreshSwitches(updateSwitches, block) {
|
function refreshSwitches(updateSwitches, block) {
|
||||||
$.each(updateSwitches, function (i, switchID) {
|
$.each(updateSwitches, function (i, switchID) {
|
||||||
var url = flask_server + "/api?type=devices&rid=" + switchID;
|
var url = flask_server + "/api?type=devices&rid=" + switchID;
|
||||||
|
|
|
||||||
|
|
@ -95,9 +95,15 @@ $(document).ready(function() {
|
||||||
changeSwitch(this, {{v[0]}});
|
changeSwitch(this, {{v[0]}});
|
||||||
});
|
});
|
||||||
updateSwitches_block_{{count}}.push("{{v[0]}}");
|
updateSwitches_block_{{count}}.push("{{v[0]}}");
|
||||||
{% elif (v[1] == "pushon") or (v[1] == "pushoff") %}
|
{% elif (v[1] == "pushon") %}
|
||||||
$('button[id="push_{{v[0]}}_block_{{count}}"]').click(function() {
|
$('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) {
|
||||||
changeSwitch(this, {{v[0]}});
|
e.preventDefault();
|
||||||
|
changePush({{v[0]}}, 'on');
|
||||||
|
});
|
||||||
|
{% elif (v[1] == "pushoff") %}
|
||||||
|
$('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
changePush({{v[0]}}, 'off');
|
||||||
});
|
});
|
||||||
{% elif (v[1] == "setpoint") %}
|
{% elif (v[1] == "setpoint") %}
|
||||||
updateSetpoints_block_{{count}}.push("{{v[0]}}");
|
updateSetpoints_block_{{count}}.push("{{v[0]}}");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue