added pushon and off to solve a little bug

This commit is contained in:
squandor 2017-01-02 22:40:30 +01:00
parent 3e36752fc2
commit 4b532e00fa
1 changed files with 10 additions and 0 deletions

View File

@ -22,6 +22,16 @@ function changeSwitch(checkboxElem, idx) {
}
}
// Switch functions
function changePush(idx, action) {
if (action == 'on') {
requestAPI(flask_server + "/api?type=command&param=switchlight&idx=" + idx + "&switchcmd=On" );
} else {
requestAPI(flask_server + "/api?type=command&param=switchlight&idx=" + idx + "&switchcmd=Off" );
}
}
function refreshSwitches(updateSwitches, block) {
$.each(updateSwitches, function (i, switchID) {
var url = flask_server + "/api?type=devices&rid=" + switchID;