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 %}