diff --git a/templates/settings.html b/templates/settings.html index c98da85..99ccbba 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -1,5 +1,8 @@ - +
+
+

A new update is available for Domoboard.


+ The current version is
+ The new version available is:
+
+ {% if debug == True %} +

Install the new version by pressing the "Upgrade" button below.

+ {% endif %} + {% if debug == False %} +

Upgrading through Domoboard is only possible when running in debug mode (pass "-d" parameter to server.py). Manual upgrade is possible by performing a "git pull" command.

+ {% endif %} + {% if debug == True %} + + {% endif %} +
+
+

Hurray!


+ There is no update available for Domoboard.

+
+
@@ -147,8 +170,8 @@ document.getElementById("defaultOpen").click(); setInterval(automaticIndex(), 9000); $('.fullSummary').hide(); + checkVersionSettings(); }); - retrieveAvailableDevices(); selected_page_settings(); selected_component_settings(); From ce9cd5a494873c21ea5568ad52e3043105b538b1 Mon Sep 17 00:00:00 2001 From: wez3 Date: Sat, 7 Jan 2017 15:03:22 +0100 Subject: [PATCH 02/19] Changed dict to OrderedDict to prevent ordering issue #29 --- server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.py b/server.py index bee5c81..b8f5714 100755 --- a/server.py +++ b/server.py @@ -25,9 +25,9 @@ def init(): def generatePage(): requestedRoute = str(request.url_rule)[1:] if configValueExists(requestedRoute): - blockValues = {} + blockValues = OrderedDict() blockArray = [] - configValues = {} + configValues = OrderedDict() configValues["navbar"] = config["navbar"]["menu"] configValues["server_location"] = config["general_settings"]["server"].get("url") configValues["flask_server_location"] = config["general_settings"]["server"].get("flask_url") @@ -57,7 +57,7 @@ def index(): @login_required() def retrieveValue(page, component): - dict = {} + dict = OrderedDict() try: match = re.search("^(.+)\[(.+)\]$", component) if not match: From 66f50dcc70b6de57b01d95bbf50471ea3abcb720 Mon Sep 17 00:00:00 2001 From: wez3 Date: Sat, 7 Jan 2017 19:21:05 +0100 Subject: [PATCH 03/19] Allow different domoticz type fields to be used at the top_tiles. --- example.conf | 6 +++--- static/js/domoboard.js | 4 ++-- templates/top_tiles.html | 15 +++++++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/example.conf b/example.conf index ddb27e0..ad18ebf 100644 --- a/example.conf +++ b/example.conf @@ -32,11 +32,11 @@ [[top_tiles]] Temperatuur tuin = 31, fire Temperatuur auto = 22, car - Stroomverbruik TV = 13, plug + Stroomverbruik TV = 13, plug, Usage Temperatuur Eindhoven = 54, fire Temperatuur tuin BMP = 55, fire - Totaal Playstation = 25, plug - Totaal slaapkamer lamp = 12, plug + Totaal Playstation = 25, plug, Usage + Totaal slaapkamer lamp = 12, plug, CounterToday Temperatuur raspberry = 1, car [[line_charts]] Temperatuur Slaapkamer = 14, month, temp diff --git a/static/js/domoboard.js b/static/js/domoboard.js index e1abd05..22a0f6a 100644 --- a/static/js/domoboard.js +++ b/static/js/domoboard.js @@ -57,7 +57,7 @@ function refreshSwitches(updateSwitches, block) { } // Top tiles functions -function refreshTopTiles(updateDivs, block, tilesPreviousArray) { +function refreshTopTiles(updateDivs, block, tilesPreviousArray, updateDivsTypeArray) { if (tilesPreviousArray.length == 0) { for(var i = 0; i < updateDivs.length; i++){ tilesPreviousArray.push(-1); @@ -69,7 +69,7 @@ function refreshTopTiles(updateDivs, block, tilesPreviousArray) { requestAPI(url, function(d) { var obj = JSON.parse(d); if (obj.result != undefined) { - var data = obj.result[0].Data; + var data = obj.result[0][updateDivsTypeArray[i]]; } else { var data = "-"; } diff --git a/templates/top_tiles.html b/templates/top_tiles.html index 0e370cf..bdc038a 100644 --- a/templates/top_tiles.html +++ b/templates/top_tiles.html @@ -5,7 +5,7 @@
{{k}} -
{{v[2]}}
+
{% endfor %} @@ -14,15 +14,22 @@ $(document).ready(function() { var updateDivs_block_{{count}}=[]; var tilesPreviousArray_{{count}}=[]; + var updateDivsType_block_{{count}} = []; {% for k, v in blockArray[count]["top_tiles"].iteritems() %} updateDivs_block_{{count}}.push("{{v[0]}}"); + {% set data = v[2] %} + {% if data is defined %} + updateDivsType_block_{{count}}.push("{{v[2]}}"); + {% else %} + updateDivsType_block_{{count}}.push("Data"); + {% endif %} {% endfor %} - tilesPreviousArray_{{count}} = refreshTopTiles(updateDivs_block_{{count}}, "top_tiles_block_{{count}}_", tilesPreviousArray_{{count}}); + + tilesPreviousArray_{{count}} = refreshTopTiles(updateDivs_block_{{count}}, "top_tiles_block_{{count}}_", tilesPreviousArray_{{count}}, updateDivsType_block_{{count}}); + tilesPreviousArray_{{count}} = setInterval(refreshTopTiles, 9000, updateDivs_block_{{count}}, "top_tiles_block_{{count}}_", tilesPreviousArray_{{count}}, updateDivsType_block_{{count}}); for (var i in updateDivs_block_{{count}}) { $("#top_tiles_block_{{count}}_" + updateDivs_block_{{count}}[i]).removeClass("loading"); } - tilesPreviousArray_{{count}} = setInterval(refreshTopTiles, 9000, updateDivs_block_{{count}}, "top_tiles_block_{{count}}_", tilesPreviousArray_{{count}}); }); - From 1e8e7daa601cf02be4d3a4df2ea66f153de5c686 Mon Sep 17 00:00:00 2001 From: squandor Date: Sun, 8 Jan 2017 00:51:56 +0100 Subject: [PATCH 04/19] Fix for #56 --- templates/news.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/templates/news.html b/templates/news.html index c7155a2..a6558c6 100644 --- a/templates/news.html +++ b/templates/news.html @@ -3,7 +3,7 @@
-

News

+

News

From 151bd968e6dde4814e3ce310c29d77d463149f2d Mon Sep 17 00:00:00 2001 From: wez3 Date: Sun, 8 Jan 2017 16:35:04 +0100 Subject: [PATCH 10/19] Remove console.log --- templates/bar_charts.html | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/bar_charts.html b/templates/bar_charts.html index b01d4f3..a4bb5e5 100644 --- a/templates/bar_charts.html +++ b/templates/bar_charts.html @@ -25,7 +25,6 @@ $(document).ready(function() { barChartElements.push("{{v[0]}}"); barChartElementsNames.push("{{k}}"); {% endfor %} - console.log(barChartElementsNames); var bar_chart_block_{{count}} = Morris.Bar({ element: 'morris-bar-chart-{{count}}', data: [], From 5be60c31c6eaf56c6cb4f08c739dcd8e2ffb086f Mon Sep 17 00:00:00 2001 From: squandor Date: Sun, 8 Jan 2017 17:35:08 +0100 Subject: [PATCH 11/19] Fixed issue #47 the track-slider will now be green if dimmer device is on --- static/css/bootstrap-slider.css | 3 --- static/css/custom.css | 11 +++++++++++ static/js/bootstrap-slider.js | 8 +++++--- static/js/domoboard.js | 27 +++++++++++++++++++++++---- templates/footer.html | 1 - templates/header.html | 1 + templates/switches.html | 15 +++++++++------ 7 files changed, 49 insertions(+), 17 deletions(-) diff --git a/static/css/bootstrap-slider.css b/static/css/bootstrap-slider.css index c53983d..d31b14b 100644 --- a/static/css/bootstrap-slider.css +++ b/static/css/bootstrap-slider.css @@ -152,9 +152,6 @@ } .slider-selection { position: absolute; - background-image: -webkit-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%); - background-image: -o-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%); - background-image: linear-gradient(to bottom, #f9f9f9 0%, #f5f5f5 100%); background-repeat: repeat-x; filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0); -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); diff --git a/static/css/custom.css b/static/css/custom.css index e1ee516..633172a 100755 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -6407,3 +6407,14 @@ ul.notifications { .hide_update { display: None; } + +.slider_on { + background-image: -webkit-linear-gradient(top, #f9f9f9 0%, green 100%); + background-image: -o-linear-gradient(top, #f9f9f9 0%, green 100%); + background-image: linear-gradient(to bottom, #f9f9f9 0%, green 100%); +} +.slider_off { + background-image: -webkit-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%); + background-image: -o-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%); + background-image: linear-gradient(to bottom, #f9f9f9 0%, #f5f5f5 100%); +} diff --git a/static/js/bootstrap-slider.js b/static/js/bootstrap-slider.js index f9f3fdd..6ce0596 100755 --- a/static/js/bootstrap-slider.js +++ b/static/js/bootstrap-slider.js @@ -410,8 +410,9 @@ sliderTrackLow.className = "slider-track-low"; sliderTrackSelection = document.createElement("div"); - sliderTrackSelection.className = "slider-selection"; - + //sliderTrackSelection.className = "slider-selection"; + sliderTrackSelection.id = this.options.id + "_track"; + sliderTrackSelection.className = "slider-selection slider_" + this.options.state sliderTrackHigh = document.createElement("div"); sliderTrackHigh.className = "slider-track-high"; @@ -766,7 +767,8 @@ scale: 'linear', focus: false, tooltip_position: null, - labelledby: null + labelledby: null, + state: 'off' }, getElement: function() { diff --git a/static/js/domoboard.js b/static/js/domoboard.js index 6fec00a..0eafebc 100644 --- a/static/js/domoboard.js +++ b/static/js/domoboard.js @@ -21,7 +21,6 @@ function changeSwitch(checkboxElem, idx) { requestAPI(flask_server + "/api?type=command¶m=switchlight&idx=" + idx + "&switchcmd=Off" ); } } - // Dimmer functions function changeDimmer(checkboxElem, idx) { var chkurl = "/api?type=devices&rid=" + idx; @@ -32,8 +31,22 @@ function changeDimmer(checkboxElem, idx) { } else { requestAPI(flask_server + "/api?type=command¶m=switchlight&idx=" + idx + "&switchcmd=On&level=0"); } + setDimmerState(checkboxElem, idx); }); } + +function setDimmerState(id, idx) { + var url = "/api?type=devices&rid=" + idx; + requestAPI(flask_server + url, function(d) { + _json = JSON.parse(d); + if (_json['result'][0]['Data'] != 'Off') { + $('#' + id).css({'background-image': '-webkit-linear-gradient(top, #f9f9f9 0%, green 100%)', 'background-image': '-o-linear-gradient(top, #f9f9f9 0%, green 100%)', 'background-image': 'linear-gradient(to bottom, #f9f9f9 0%, green 100%)'}); + } else { + $('#' + id).css({'background-image': '-webkit-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%)', 'background-image': '-o-linear-gradient(top, #f9f9f9 0%, #f5f5f5 100%)', 'background-image': 'linear-gradient(to bottom, #f9f9f9 0%, #f5f5f5 100%)'}); + } + }); +} + // Switch functions function changePush(idx, action) { if (action == 'on') { @@ -149,9 +162,15 @@ function dimmerSlider(updateDimmers, block) { url = "/api?type=devices&rid=" + dimmerID; requestAPI(url, function(d) { var percentage = JSON.parse(d).result[0].Level; - $('#dimmer_' + dimmerID + "_block_" + block).slider({min:0, max:100, value: percentage}).on('slideStop', function(ev) { changeDimmerSlider($(this).attr('id'), ev.value) } ).data('slider'); - $('#dimmer_' + dimmerID + "_block_" + block).slider().on('slideStop', function(ev) { changeDimmerSlider($(this).attr('id'), ev.value) } ).data('slider'); - }); + $('#dimmer_' + dimmerID + "_block_" + block).slider({min:0, max:100, value: percentage}).on('slideStop', function(ev) { + setDimmerState('dim_' + dimmerID + "_block_" + block + "_track", dimmerID); + changeDimmerSlider($(this).attr('id'), ev.value) } ).data('slider'); + $('#dimmer_' + dimmerID + "_block_" + block).slider().on('slideStop', function(ev) { + setDimmerState('dim_' + dimmerID + "_block_" + block + "_track", dimmerID); + changeDimmerSlider($(this).attr('id'), ev.value) + } ).data('slider'); + setDimmerState('dim_' + dimmerID + "_block_" + block + "_track", dimmerID); + }); }); } diff --git a/templates/footer.html b/templates/footer.html index 368335f..95ee215 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -9,7 +9,6 @@ - {% if configValues["domoboard"].get("time") == "True" %} diff --git a/templates/header.html b/templates/header.html index ffc3a54..5c254fd 100644 --- a/templates/header.html +++ b/templates/header.html @@ -43,6 +43,7 @@ + diff --git a/templates/switches.html b/templates/switches.html index f3295b3..9feffb1 100644 --- a/templates/switches.html +++ b/templates/switches.html @@ -1,4 +1,5 @@ +
@@ -25,7 +26,7 @@ {% if "switch" in v[1] %} {% elif "dimmer" in v[1] %} - + {% elif "pushon" in v[1] %} {% elif "pushoff" in v[1] %} @@ -43,7 +44,7 @@
{% elif "rgb" in v[1] %} -   +  

@@ -131,10 +132,10 @@ $(document).ready(function() { {% elif (v[1] == "setpoint") %} updateSetpoints_block_{{count}}.push("{{v[0]}}"); {% elif (v[1] == "dimmer" or v[1] == "rgb") %} - $('#dim_{{count}}').click(function(e) { - e.preventDefault(); - changeDimmer(this, {{v[0]}}); - }); + $('#dim_{{count}}').click(function(e) { + e.preventDefault(); + changeDimmer('dim_{{v[0]}}_block_{{count}}_track', {{v[0]}}); + }); updateDimmers_block_{{count}}.push("{{v[0]}}"); {% endif %} {% endfor %} @@ -144,5 +145,7 @@ $(document).ready(function() { setInterval(refreshSwitches, 9000, updateSwitches_block_{{count}}, {{count}}); setInterval(dimmerSlider, 9000, updateDimmers_block_{{count}}, {{count}}); setInterval(refreshSetpoints, 9000, updateSetpoints_block_{{count}}, {{count}}); + }); + From 8374a8f6abde201252026f3d8bb1dad49aa0af56 Mon Sep 17 00:00:00 2001 From: squandor Date: Sun, 8 Jan 2017 20:58:19 +0100 Subject: [PATCH 12/19] fixed bug for title top_tiles --- templates/top_tiles.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/top_tiles.html b/templates/top_tiles.html index b42238c..180b34f 100644 --- a/templates/top_tiles.html +++ b/templates/top_tiles.html @@ -1,5 +1,6 @@
+

Top tiles

{% for k, v in blockArray[count]["top_tiles"].iteritems() %}
@@ -16,7 +17,12 @@ $(document).ready(function() { var tilesPreviousArray_{{count}}=[]; var updateDivsType_block_{{count}} = []; {% for k, v in blockArray[count]["top_tiles"].iteritems() %} + {% if v[2] %} + $('#s_title_{{ count }}').html("{{ v[2] }}"); + {% endif %} + updateDivs_block_{{count}}.push("{{v[0]}}"); + console.log("{{v[2]|length}}"); {% if v[2]|length > 3 %} updateDivsType_block_{{count}}.push("{{v[2]}}"); {% else %} From c26a07ccda46feb3c180e964966b8e26a2b257cf Mon Sep 17 00:00:00 2001 From: squandor Date: Mon, 9 Jan 2017 18:52:03 +0100 Subject: [PATCH 13/19] removed double function for dimmer slider --- static/js/domoboard.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/static/js/domoboard.js b/static/js/domoboard.js index ead4aac..4f987b6 100644 --- a/static/js/domoboard.js +++ b/static/js/domoboard.js @@ -164,9 +164,6 @@ function dimmerSlider(updateDimmers, block) { var percentage = JSON.parse(d).result[0].Level; $('#dimmer_' + dimmerID + "_block_" + block).slider({min:0, max:100, value: percentage}).on('slideStop', function(ev) { setDimmerState('dim_' + dimmerID + "_block_" + block + "_track", dimmerID); - changeDimmerSlider($(this).attr('id'), ev.value) } ).data('slider'); - $('#dimmer_' + dimmerID + "_block_" + block).slider().on('slideStop', function(ev) { - setDimmerState('dim_' + dimmerID + "_block_" + block + "_track", dimmerID); changeDimmerSlider($(this).attr('id'), ev.value) } ).data('slider'); setDimmerState('dim_' + dimmerID + "_block_" + block + "_track", dimmerID); From d7f0520bf16c3c06558a5cc7956c4dec2b519ff4 Mon Sep 17 00:00:00 2001 From: squandor Date: Mon, 9 Jan 2017 18:55:32 +0100 Subject: [PATCH 14/19] removed title --- templates/top_tiles.html | 6 ------ 1 file changed, 6 deletions(-) diff --git a/templates/top_tiles.html b/templates/top_tiles.html index 180b34f..b42238c 100644 --- a/templates/top_tiles.html +++ b/templates/top_tiles.html @@ -1,6 +1,5 @@
-

Top tiles

{% for k, v in blockArray[count]["top_tiles"].iteritems() %}
@@ -17,12 +16,7 @@ $(document).ready(function() { var tilesPreviousArray_{{count}}=[]; var updateDivsType_block_{{count}} = []; {% for k, v in blockArray[count]["top_tiles"].iteritems() %} - {% if v[2] %} - $('#s_title_{{ count }}').html("{{ v[2] }}"); - {% endif %} - updateDivs_block_{{count}}.push("{{v[0]}}"); - console.log("{{v[2]|length}}"); {% if v[2]|length > 3 %} updateDivsType_block_{{count}}.push("{{v[2]}}"); {% else %} From be717b35594b85b4cdea12b81d14431ce8944e46 Mon Sep 17 00:00:00 2001 From: wez3 Date: Mon, 9 Jan 2017 21:23:37 +0100 Subject: [PATCH 15/19] Modify retrieveValues array order to fix issue #62 --- server.py | 11 +-- templates/area_charts.html | 4 +- templates/bar_charts.html | 2 +- templates/camera.html | 2 +- templates/domoticz_counter_charts.html | 4 +- templates/domoticz_percentage_charts.html | 4 +- templates/domoticz_smart_charts.html | 4 +- templates/domoticz_temp_charts.html | 4 +- templates/donut_charts.html | 2 +- templates/line_charts.html | 4 +- templates/map.html | 6 +- templates/navbar.html | 4 +- templates/news.html | 4 +- templates/power_usage.html | 4 +- templates/switches.html | 96 +++++++++++------------ templates/top_tiles.html | 8 +- 16 files changed, 82 insertions(+), 81 deletions(-) diff --git a/server.py b/server.py index 089889a..f83da6e 100755 --- a/server.py +++ b/server.py @@ -62,13 +62,14 @@ def retrieveValue(page, component): match = re.search("^(.+)\[(.+)\]$", component) if not match: for k, v in config[page][component].iteritems(): - v = strToList(v) - dict[k] = v + l = [None] + l.extend(strToList(v)) + dict[k] = l else: for sk, sv in config[page][match.group(1)][match.group(2)].iteritems(): - sv = strToList(sv) - sv.append(match.group(2)) - dict[sk] = sv + l = [match.group(2)] + l.extend(strToList(sv)) + dict[sk] = l except: dict = {} return dict diff --git a/templates/area_charts.html b/templates/area_charts.html index 145d5dd..9db18d1 100644 --- a/templates/area_charts.html +++ b/templates/area_charts.html @@ -27,9 +27,9 @@ var area_chart_block_{{count}} = Morris.Area({ $(document).ready(function() { {% for k, v in blockArray[count]["area_charts"].iteritems() %} - redrawAreaChart("{{v[2]}}",{{v[0]}},"{{v[1]}}", area_chart_block_{{count}}); + redrawAreaChart("{{v[3]}}",{{v[1]}},"{{v[2]}}", area_chart_block_{{count}}); $("div#title_block_{{count}} h2").html("{{k}}"); - setInterval(redrawAreaChart,9000,"{{v[2]}}",{{v[0]}},"{{v[1]}}", area_chart_block_{{count}}); + setInterval(redrawAreaChart,9000,"{{v[3]}}",{{v[1]}},"{{v[2]}}", area_chart_block_{{count}}); }); {% endfor %} diff --git a/templates/bar_charts.html b/templates/bar_charts.html index a4bb5e5..d3b90e5 100644 --- a/templates/bar_charts.html +++ b/templates/bar_charts.html @@ -22,7 +22,7 @@ $(document).ready(function() { var barChartElementsNames=[]; {% for k, v in blockArray[count]["bar_charts"].iteritems() %} - barChartElements.push("{{v[0]}}"); + barChartElements.push("{{v[1]}}"); barChartElementsNames.push("{{k}}"); {% endfor %} var bar_chart_block_{{count}} = Morris.Bar({ diff --git a/templates/camera.html b/templates/camera.html index d0e63fb..c95936c 100644 --- a/templates/camera.html +++ b/templates/camera.html @@ -12,7 +12,7 @@
{% for k, v in blockArray[count]["camera"].iteritems() %} {% if v[1] %} - + {% endif %}
diff --git a/templates/domoticz_counter_charts.html b/templates/domoticz_counter_charts.html index 09c5f51..c6629f2 100644 --- a/templates/domoticz_counter_charts.html +++ b/templates/domoticz_counter_charts.html @@ -17,9 +17,9 @@ $(document).ready(function() { {% for k, v in blockArray[count]["domoticz_counter_charts"].iteritems() %} - ShowGeneralGraph("domoticz-chart-block-{{count}}",{{v[0]}},"{{k}}", 1, "{{v[2]}}", "{{v[1]}}"); + ShowGeneralGraph("domoticz-chart-block-{{count}}",{{v[1]}},"{{k}}", 1, "{{v[3]}}", "{{v[2]}}"); $("div#title_block_{{count}} h2").html("{{k}}"); - setInterval(ShowGeneralGraph,60000,"domoticz-chart-block-{{count}}",{{v[0]}},"{{k}}", 1, "{{v[2]}}", "{{v[1]}}"); + setInterval(ShowGeneralGraph,60000,"domoticz-chart-block-{{count}}",{{v[1]}},"{{k}}", 1, "{{v[3]}}", "{{v[2]}}"); {% endfor %} }); diff --git a/templates/domoticz_percentage_charts.html b/templates/domoticz_percentage_charts.html index 366d8c0..eca234c 100644 --- a/templates/domoticz_percentage_charts.html +++ b/templates/domoticz_percentage_charts.html @@ -17,9 +17,9 @@ $(document).ready(function() { {% for k, v in blockArray[count]["domoticz_percentage_charts"].iteritems() %} - ShowPercentageLog("domoticz-chart-block-{{count}}",{{v[0]}},"{{k}}", "{{v[1]}}"); + ShowPercentageLog("domoticz-chart-block-{{count}}",{{v[1]}},"{{k}}", "{{v[2]}}"); $("div#title_block_{{count}} h2").html("{{k}}"); - setInterval(ShowPercentageLog,60000,"domoticz-chart-block-{{count}}",{{v[0]}},"{{k}}", "{{v[1]}}"); + setInterval(ShowPercentageLog,60000,"domoticz-chart-block-{{count}}",{{v[1]}},"{{k}}", "{{v[2]}}"); {% endfor %} }); diff --git a/templates/domoticz_smart_charts.html b/templates/domoticz_smart_charts.html index eeac38c..c590fb9 100644 --- a/templates/domoticz_smart_charts.html +++ b/templates/domoticz_smart_charts.html @@ -17,9 +17,9 @@ $(document).ready(function() { {% for k, v in blockArray[count]["domoticz_smart_charts"].iteritems() %} - ShowSmartLog("domoticz-chart-block-{{count}}",{{v[0]}},"{{k}}", "{{v[2]}}", "{{v[1]}}"); + ShowSmartLog("domoticz-chart-block-{{count}}",{{v[1]}},"{{k}}", "{{v[3]}}", "{{v[2]}}"); $("div#title_block_{{count}} h2").html("{{k}}"); - setInterval(ShowSmartLog,60000,"domoticz-chart-block-{{count}}",{{v[0]}},"{{k}}", "{{v[2]}}", "{{v[1]}}"); + setInterval(ShowSmartLog,60000,"domoticz-chart-block-{{count}}",{{v[1]}},"{{k}}", "{{v[3]}}", "{{v[2]}}"); {% endfor %} }); diff --git a/templates/domoticz_temp_charts.html b/templates/domoticz_temp_charts.html index c53559e..81cca1d 100644 --- a/templates/domoticz_temp_charts.html +++ b/templates/domoticz_temp_charts.html @@ -17,9 +17,9 @@ $(document).ready(function() { {% for k, v in blockArray[count]["domoticz_temp_charts"].iteritems() %} - ShowTempLog("domoticz-chart-block-{{count}}",{{v[0]}},"{{k}}", "{{v[1]}}"); + ShowTempLog("domoticz-chart-block-{{count}}",{{v[1]}},"{{k}}", "{{v[2]}}"); $("div#title_block_{{count}} h2").html("{{k}}"); - setInterval(ShowGeneralGraph,60000,"domoticz-chart-block-{{count}}",{{v[0]}},"{{k}}", "{{v[1]}}"); + setInterval(ShowGeneralGraph,60000,"domoticz-chart-block-{{count}}",{{v[1]}},"{{k}}", "{{v[2]}}"); {% endfor %} }); diff --git a/templates/donut_charts.html b/templates/donut_charts.html index b216877..5c5fa3d 100644 --- a/templates/donut_charts.html +++ b/templates/donut_charts.html @@ -22,7 +22,7 @@ var donut_chart_block_{{count}} = Morris.Donut({ $(document).ready(function() { var donutChartElements=[]; {% for k, v in blockArray[count]["donut_charts"].iteritems() %} - donutChartElements.push("{{v[0]}}"); + donutChartElements.push("{{v[1]}}"); {% endfor %} redrawDonutChart(donutChartElements, donut_chart_block_{{count}}); setInterval(redrawDonutChart,9000,donutChartElements, donut_chart_block_{{count}}); diff --git a/templates/line_charts.html b/templates/line_charts.html index 04605a2..0f983ac 100644 --- a/templates/line_charts.html +++ b/templates/line_charts.html @@ -27,9 +27,9 @@ var line_chart_block_{{count}} = Morris.Line({ $(document).ready(function() { {% for k, v in blockArray[count]["line_charts"].iteritems() %} - redrawLineChart("{{v[2]}}",{{v[0]}},"{{v[1]}}", line_chart_block_{{count}}); + redrawLineChart("{{v[3]}}",{{v[1]}},"{{v[2]}}", line_chart_block_{{count}}); $("div#title_block_{{count}} h2").html("{{k}}"); - setInterval(redrawLineChart,9000,"{{v[2]}}",{{v[0]}},"{{v[1]}}",line_chart_block_{{count}}); + setInterval(redrawLineChart,9000,"{{v[3]}}",{{v[1]}},"{{v[2]}}",line_chart_block_{{count}}); }); {% endfor %} diff --git a/templates/map.html b/templates/map.html index 35f74be..24ed1e2 100644 --- a/templates/map.html +++ b/templates/map.html @@ -21,10 +21,10 @@ $(document).ready(function() { var location=[]; {% for k, v in blockArray[count]["map"].iteritems() %} - {% if v[1] %} - $('#s_title_{{ count }}').html("{{ v[1] }}"); + {% if v[0] %} + $('#s_title_{{ count }}').html("{{ v[0] }}"); {% endif %} - location.push("{{v[0]}}"); + location.push("{{v[1]}}"); {% endfor %} refreshMapLocation(location, "locationIframe-{{count}}"); setInterval(refreshMapLocation, 60000, location, "locationIframe-{{count}}"); diff --git a/templates/navbar.html b/templates/navbar.html index dce56ed..4ee518b 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -20,10 +20,10 @@
@@ -98,45 +98,45 @@ $(document).ready(function() { {% for k, v in blockArray[count]["switches"].iteritems() %} - {% if v[2] %} - $('#s_title_{{ count }}').html("{{ v[2] }}"); + {% if v[0] %} + $('#s_title_{{ count }}').html("{{ v[0] }}"); {% endif %} - {% if v[1] == "switch" %} - $('input[id="switch_{{v[0]}}_block_{{count}}"]').on('switchChange.bootstrapSwitch', function(event, state) { - changeSwitch(this, {{v[0]}}); + {% if v[2] == "switch" %} + $('input[id="switch_{{v[1]}}_block_{{count}}"]').on('switchChange.bootstrapSwitch', function(event, state) { + changeSwitch(this, {{v[1]}}); }); - updateSwitches_block_{{count}}.push("{{v[0]}}"); - {% elif (v[1] == "pushon") %} - $('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) { + updateSwitches_block_{{count}}.push("{{v[1]}}"); + {% elif (v[2] == "pushon") %} + $('button[id="push_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changePush({{v[0]}}, 'on'); + changePush({{v[1]}}, 'on'); }); - {% elif (v[1] == "pushoff") %} - $('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) { + {% elif (v[2] == "pushoff") %} + $('button[id="push_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changePush({{v[0]}}, 'off'); + changePush({{v[1]}}, 'off'); }); - {% elif (v[1] == "group") or (v[1] == "scene") %} - $('button[id="groupon_{{v[0]}}_block_{{count}}"]').click(function(e) { + {% elif (v[2] == "group") or (v[2] == "scene") %} + $('button[id="groupon_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changeScene({{v[0]}}, 'on'); + changeScene({{v[1]}}, 'on'); }); - $('button[id="groupoff_{{v[0]}}_block_{{count}}"]').click(function(e) { + $('button[id="groupoff_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changeScene({{v[0]}}, 'off'); + changeScene({{v[1]}}, 'off'); }); - $('button[id="scene_{{v[0]}}_block_{{count}}"]').click(function(e) { + $('button[id="scene_{{v[1]}}_block_{{count}}"]').click(function(e) { e.preventDefault(); - changeScene({{v[0]}}, 'on'); + changeScene({{v[1]}}, 'on'); }); - {% elif (v[1] == "setpoint") %} - updateSetpoints_block_{{count}}.push("{{v[0]}}"); - {% elif (v[1] == "dimmer" or v[1] == "rgb") %} + {% elif (v[2] == "setpoint") %} + updateSetpoints_block_{{count}}.push("{{v[1]}}"); + {% elif (v[2] == "dimmer" or v[2] == "rgb") %} $('#dim_{{count}}').click(function(e) { e.preventDefault(); - changeDimmer('dim_{{v[0]}}_block_{{count}}_track', {{v[0]}}); + changeDimmer('dim_{{v[1]}}_block_{{count}}_track', {{v[1]}}); }); - updateDimmers_block_{{count}}.push("{{v[0]}}"); + updateDimmers_block_{{count}}.push("{{v[1]}}"); {% endif %} {% endfor %} refreshSwitches(updateSwitches_block_{{count}}, {{count}}); diff --git a/templates/top_tiles.html b/templates/top_tiles.html index b42238c..3859b22 100644 --- a/templates/top_tiles.html +++ b/templates/top_tiles.html @@ -5,7 +5,7 @@
{{k}} -
+
{% endfor %} @@ -16,9 +16,9 @@ $(document).ready(function() { var tilesPreviousArray_{{count}}=[]; var updateDivsType_block_{{count}} = []; {% for k, v in blockArray[count]["top_tiles"].iteritems() %} - updateDivs_block_{{count}}.push("{{v[0]}}"); - {% if v[2]|length > 3 %} - updateDivsType_block_{{count}}.push("{{v[2]}}"); + updateDivs_block_{{count}}.push("{{v[1]}}"); + {% if v[3]|length > 3 %} + updateDivsType_block_{{count}}.push("{{v[3]}}"); {% else %} updateDivsType_block_{{count}}.push("Data"); {% endif %} From 2685496a25563da47e53785439ce6d8558d6a9a7 Mon Sep 17 00:00:00 2001 From: wez3 Date: Mon, 9 Jan 2017 21:30:35 +0100 Subject: [PATCH 16/19] Modify retrieveValues array order to fix issue #62 --- templates/camera.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/camera.html b/templates/camera.html index c95936c..693a5ad 100644 --- a/templates/camera.html +++ b/templates/camera.html @@ -11,12 +11,12 @@

{% for k, v in blockArray[count]["camera"].iteritems() %} - {% if v[1] %} + {% if v[0] %} {% endif %}
- +
{% endfor %} From 0191fd69a2a48aad2f718d94fc9f1088d9e09909 Mon Sep 17 00:00:00 2001 From: wez3 Date: Mon, 9 Jan 2017 21:57:14 +0100 Subject: [PATCH 17/19] Fix navbar issue after changing array order --- templates/navbar.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/navbar.html b/templates/navbar.html index 4ee518b..dce56ed 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -20,10 +20,10 @@