From 4b532e00faee2b27fe09ece9e632f7dbd780891d Mon Sep 17 00:00:00 2001 From: squandor Date: Mon, 2 Jan 2017 22:40:30 +0100 Subject: [PATCH] added pushon and off to solve a little bug --- static/js/domoboard.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/static/js/domoboard.js b/static/js/domoboard.js index 0341b7b..51fdd52 100644 --- a/static/js/domoboard.js +++ b/static/js/domoboard.js @@ -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) { $.each(updateSwitches, function (i, switchID) { var url = flask_server + "/api?type=devices&rid=" + switchID;