From 2348bc684ed6142b896cfbc79eff8069f50da4dc Mon Sep 17 00:00:00 2001 From: wysiwyng <4764286+wysiwyng@users.noreply.github.com> Date: Tue, 20 Mar 2018 22:34:49 +0100 Subject: [PATCH 1/2] switch schedules work again --- code/html/custom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/html/custom.js b/code/html/custom.js index b2e90172..85bde849 100644 --- a/code/html/custom.js +++ b/code/html/custom.js @@ -662,7 +662,7 @@ function addSchedule(event) { var template = $("#scheduleTemplate").children(); var line = $(template).clone(); - var type = (1 === event.data.schType) ? "switch" : "light"; + var type = ("1" === event.data.schType) ? "switch" : "light"; template = $("#" + type + "ActionTemplate").children(); var actionLine = template.clone(); From 1bab8e01424d92049c0795a637a4693a22ee9fa8 Mon Sep 17 00:00:00 2001 From: wysiwyng Date: Wed, 21 Mar 2018 18:35:38 +0100 Subject: [PATCH 2/2] schedules properly fixed --- code/espurna/scheduler.ino | 2 +- code/html/custom.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/espurna/scheduler.ino b/code/espurna/scheduler.ino index faa89e68..b78f3fc7 100644 --- a/code/espurna/scheduler.ino +++ b/code/espurna/scheduler.ino @@ -26,7 +26,7 @@ void _schWebSocketOnSend(JsonObject &root){ scheduler["schEnabled"] = getSetting("schEnabled", i, 1).toInt() == 1; scheduler["schSwitch"] = getSetting("schSwitch", i, 0).toInt(); scheduler["schAction"] = getSetting("schAction", i, 0).toInt(); - scheduler["schType"] = getSetting("schType", i, 0); + scheduler["schType"] = getSetting("schType", i, 0).toInt(); scheduler["schHour"] = getSetting("schHour", i, 0).toInt(); scheduler["schMinute"] = getSetting("schMinute", i, 0).toInt(); scheduler["schWDs"] = getSetting("schWDs", i, ""); diff --git a/code/html/custom.js b/code/html/custom.js index 85bde849..70181a10 100644 --- a/code/html/custom.js +++ b/code/html/custom.js @@ -662,7 +662,7 @@ function addSchedule(event) { var template = $("#scheduleTemplate").children(); var line = $(template).clone(); - var type = ("1" === event.data.schType) ? "switch" : "light"; + var type = (1 === event.data.schType) ? "switch" : "light"; template = $("#" + type + "ActionTemplate").children(); var actionLine = template.clone(); @@ -1349,8 +1349,8 @@ $(function() { $(".button-add-network").on("click", function() { $(".more", addNetwork()).toggle(); }); - $(".button-add-switch-schedule").on("click", { schType: "1" }, addSchedule); - $(".button-add-light-schedule").on("click", { schType: "2" }, addSchedule); + $(".button-add-switch-schedule").on("click", { schType: 1 }, addSchedule); + $(".button-add-light-schedule").on("click", { schType: 2 }, addSchedule); $(document).on("change", "input", hasChanged); $(document).on("change", "select", hasChanged);