Modify retrieveValues array order to fix issue #62

This commit is contained in:
wez3 2017-01-09 21:23:37 +01:00
parent d7f0520bf1
commit be717b3559
16 changed files with 82 additions and 81 deletions

View File

@ -62,13 +62,14 @@ def retrieveValue(page, component):
match = re.search("^(.+)\[(.+)\]$", component) match = re.search("^(.+)\[(.+)\]$", component)
if not match: if not match:
for k, v in config[page][component].iteritems(): for k, v in config[page][component].iteritems():
v = strToList(v) l = [None]
dict[k] = v l.extend(strToList(v))
dict[k] = l
else: else:
for sk, sv in config[page][match.group(1)][match.group(2)].iteritems(): for sk, sv in config[page][match.group(1)][match.group(2)].iteritems():
sv = strToList(sv) l = [match.group(2)]
sv.append(match.group(2)) l.extend(strToList(sv))
dict[sk] = sv dict[sk] = l
except: except:
dict = {} dict = {}
return dict return dict

View File

@ -27,9 +27,9 @@ var area_chart_block_{{count}} = Morris.Area({
$(document).ready(function() { $(document).ready(function() {
{% for k, v in blockArray[count]["area_charts"].iteritems() %} {% 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}}"); $("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 %} {% endfor %}
</script> </script>

View File

@ -22,7 +22,7 @@ $(document).ready(function() {
var barChartElementsNames=[]; var barChartElementsNames=[];
{% for k, v in blockArray[count]["bar_charts"].iteritems() %} {% for k, v in blockArray[count]["bar_charts"].iteritems() %}
barChartElements.push("{{v[0]}}"); barChartElements.push("{{v[1]}}");
barChartElementsNames.push("{{k}}"); barChartElementsNames.push("{{k}}");
{% endfor %} {% endfor %}
var bar_chart_block_{{count}} = Morris.Bar({ var bar_chart_block_{{count}} = Morris.Bar({

View File

@ -12,7 +12,7 @@
<br> <br>
{% for k, v in blockArray[count]["camera"].iteritems() %} {% for k, v in blockArray[count]["camera"].iteritems() %}
{% if v[1] %} {% if v[1] %}
<script> $('#s_title_{{ count }}').html("{{ v[1] }}");</script> <script> $('#s_title_{{ count }}').html("{{ v[0] }}");</script>
{% endif %} {% endif %}
<form class="form-horizontal form-label-left" style="width: 80%; height: 80%; "> <form class="form-horizontal form-label-left" style="width: 80%; height: 80%; ">
<div class="form-group" style=""> <div class="form-group" style="">

View File

@ -17,9 +17,9 @@
$(document).ready(function() { $(document).ready(function() {
{% for k, v in blockArray[count]["domoticz_counter_charts"].iteritems() %} {% 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}}"); $("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 %} {% endfor %}
}); });
</script> </script>

View File

@ -17,9 +17,9 @@
$(document).ready(function() { $(document).ready(function() {
{% for k, v in blockArray[count]["domoticz_percentage_charts"].iteritems() %} {% 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}}"); $("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 %} {% endfor %}
}); });
</script> </script>

View File

@ -17,9 +17,9 @@
$(document).ready(function() { $(document).ready(function() {
{% for k, v in blockArray[count]["domoticz_smart_charts"].iteritems() %} {% 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}}"); $("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 %} {% endfor %}
}); });
</script> </script>

View File

@ -17,9 +17,9 @@
$(document).ready(function() { $(document).ready(function() {
{% for k, v in blockArray[count]["domoticz_temp_charts"].iteritems() %} {% 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}}"); $("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 %} {% endfor %}
}); });
</script> </script>

View File

@ -22,7 +22,7 @@ var donut_chart_block_{{count}} = Morris.Donut({
$(document).ready(function() { $(document).ready(function() {
var donutChartElements=[]; var donutChartElements=[];
{% for k, v in blockArray[count]["donut_charts"].iteritems() %} {% for k, v in blockArray[count]["donut_charts"].iteritems() %}
donutChartElements.push("{{v[0]}}"); donutChartElements.push("{{v[1]}}");
{% endfor %} {% endfor %}
redrawDonutChart(donutChartElements, donut_chart_block_{{count}}); redrawDonutChart(donutChartElements, donut_chart_block_{{count}});
setInterval(redrawDonutChart,9000,donutChartElements, donut_chart_block_{{count}}); setInterval(redrawDonutChart,9000,donutChartElements, donut_chart_block_{{count}});

View File

@ -27,9 +27,9 @@ var line_chart_block_{{count}} = Morris.Line({
$(document).ready(function() { $(document).ready(function() {
{% for k, v in blockArray[count]["line_charts"].iteritems() %} {% 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}}"); $("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 %} {% endfor %}
</script> </script>

View File

@ -21,10 +21,10 @@
$(document).ready(function() { $(document).ready(function() {
var location=[]; var location=[];
{% for k, v in blockArray[count]["map"].iteritems() %} {% for k, v in blockArray[count]["map"].iteritems() %}
{% if v[1] %} {% if v[0] %}
$('#s_title_{{ count }}').html("{{ v[1] }}"); $('#s_title_{{ count }}').html("{{ v[0] }}");
{% endif %} {% endif %}
location.push("{{v[0]}}"); location.push("{{v[1]}}");
{% endfor %} {% endfor %}
refreshMapLocation(location, "locationIframe-{{count}}"); refreshMapLocation(location, "locationIframe-{{count}}");
setInterval(refreshMapLocation, 60000, location, "locationIframe-{{count}}"); setInterval(refreshMapLocation, 60000, location, "locationIframe-{{count}}");

View File

@ -20,10 +20,10 @@
<div class="menu_section"> <div class="menu_section">
<ul class="nav side-menu"> <ul class="nav side-menu">
{% for k, v in configValues["navbar"].iteritems() %} {% for k, v in configValues["navbar"].iteritems() %}
{% if v is not string %} {% if v|length > 1 %}
<li><a href="{{v[0]}}"> <i class="fa fa-{{v[1]}} fa-fw" aria-hidden="true"></i> {{k}}</a></li> <li><a href="{{v[0]}}"> <i class="fa fa-{{v[1]}} fa-fw" aria-hidden="true"></i> {{k}}</a></li>
{% else %} {% else %}
<li><a href="{{v}}">{{k}}</a></li> <li><a href="{{v[0]}}">{{k}}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -14,8 +14,8 @@
<script> <script>
$(document).ready(function() { $(document).ready(function() {
{% for k, v in blockArray[count]["news"].iteritems() %} {% for k, v in blockArray[count]["news"].iteritems() %}
{% if v[1] %} {% if v[0] %}
$('#s_title_{{ count }}').html("{{ v[1] }}"); $('#s_title_{{ count }}').html("{{ v[0] }}");
{% endif %} {% endif %}
{% endfor %} {% endfor %}
}); });

View File

@ -22,7 +22,7 @@
{% for k, v in blockArray[count]["power_usage"].iteritems() %} {% for k, v in blockArray[count]["power_usage"].iteritems() %}
<tr> <tr>
<td>{{k}}</td> <td>{{k}}</td>
<td id="power_usage_{{v[0]}}_{{count}}">{{v[1]}}</td> <td id="power_usage_{{v[1]}}_{{count}}">{{v[2]}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
<tr> <tr>
@ -39,7 +39,7 @@
$(document).ready(function() { $(document).ready(function() {
var updatePowerUsage_{{count}}=[]; var updatePowerUsage_{{count}}=[];
{% for k, v in blockArray[count]["power_usage"].iteritems() %} {% for k, v in blockArray[count]["power_usage"].iteritems() %}
updatePowerUsage_{{count}}.push("{{v[0]}}"); updatePowerUsage_{{count}}.push("{{v[1]}}");
{% endfor %} {% endfor %}
refreshPowerUsage(updatePowerUsage_{{count}}, "{{count}}"); refreshPowerUsage(updatePowerUsage_{{count}}, "{{count}}");
setInterval(refreshPowerUsage, 9000, updatePowerUsage_{{count}}, "{{count}}"); setInterval(refreshPowerUsage, 9000, updatePowerUsage_{{count}}, "{{count}}");

View File

@ -17,38 +17,38 @@
<table class="table" style="width: auto;"> <table class="table" style="width: auto;">
{% for k, v in blockArray[count]["switches"].iteritems() %} {% for k, v in blockArray[count]["switches"].iteritems() %}
<tr> <tr>
{% if "dimmer" in v[1] or "rgb" in v[1] %} {% if "dimmer" in v[2] or "rgb" in v[2] %}
<td style="border-top: none; vertical-align: middle;"><a id="dim_{{count}}" style="cursor: pointer;"><label style="cursor: pointer;" class=""> &nbsp;{{k}}</label></a></td> <td style="border-top: none; vertical-align: middle;"><a id="dim_{{count}}" style="cursor: pointer;"><label style="cursor: pointer;" class=""> &nbsp;{{k}}</label></a></td>
{% else %} {% else %}
<td style="border-top: none; vertical-align: middle;"><label class=""> &nbsp;{{k}}</label></td> <td style="border-top: none; vertical-align: middle;"><label class=""> &nbsp;{{k}}</label></td>
{% endif %} {% endif %}
<td style="border-top: none;"> <td style="border-top: none;">
{% if "switch" in v[1] %} {% if "switch" in v[2] %}
<input id="switch_{{v[0]}}_block_{{count}}" type="checkbox" checked data-size="mini"> <input id="switch_{{v[1]}}_block_{{count}}" type="checkbox" checked data-size="mini">
{% elif "dimmer" in v[1] %} {% elif "dimmer" in v[2] %}
<input id="dimmer_{{v[0]}}_block_{{count}}" data-slider-id='dim_{{v[0]}}_block_{{count}}' type="text" test={{ v[1] }} state="on" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="14" /> <input id="dimmer_{{v[1]}}_block_{{count}}" data-slider-id='dim_{{v[1]}}_block_{{count}}' type="text" test={{ v[2] }} state="on" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="14" />
{% elif "pushon" in v[1] %} {% elif "pushon" in v[2] %}
<button id="push_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button> <button id="push_{{v[1]}}_block_{{count}}" class="btn btn-primary btn-circle">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button>
{% elif "pushoff" in v[1] %} {% elif "pushoff" in v[2] %}
<button id="push_{{v[0]}}_block_{{count}}" class="btn btn-danger btn-circle">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button> <button id="push_{{v[1]}}_block_{{count}}" class="btn btn-danger btn-circle">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button>
{% elif "group" in v[1] %} {% elif "group" in v[2] %}
<div><div style="float: left"><button id="groupon_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button></div><div style="padding-left: 20px; float: left"><button id="groupoff_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle btn-danger">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button></div></div> <div><div style="float: left"><button id="groupon_{{v[1]}}_block_{{count}}" class="btn btn-primary btn-circle">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button></div><div style="padding-left: 20px; float: left"><button id="groupoff_{{v[1]}}_block_{{count}}" class="btn btn-primary btn-circle btn-danger">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button></div></div>
{% elif "scene" in v[1] %} {% elif "scene" in v[2] %}
<button id="scene_{{v[0]}}_block_{{count}}" class="btn btn-primary btn-circle">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button> <button id="scene_{{v[1]}}_block_{{count}}" class="btn btn-primary btn-circle">&nbsp;<li class="fa fa-power-off" aria-hidden="true"></i>&nbsp;</button>
{% elif "setpoint" in v[1] %} {% elif "setpoint" in v[2] %}
<div> <div>
<div style="float: left; margin-right: 5px"><h1 id="setpoint_{{v[0]}}_block_{{count}}" style="font-size: 16px;"></h1></div> <div style="float: left; margin-right: 5px"><h1 id="setpoint_{{v[1]}}_block_{{count}}" style="font-size: 16px;"></h1></div>
<div style="float: left"> <div style="float: left">
<div style=""><i onclick="changeUp({{ v[0] }}, {{count}})" class="fa fa-arrow-up" style="font-size: 13px; cursor: pointer;" aria-hidden="true"></i></div> <div style=""><i onclick="changeUp({{ v[1] }}, {{count}})" class="fa fa-arrow-up" style="font-size: 13px; cursor: pointer;" aria-hidden="true"></i></div>
<div style=""><i onclick="changeDown({{ v[0] }}, {{count}})" class="fa fa-arrow-down" style="font-size: 13px; cursor: pointer;" aria-hidden="true"></i></div> <div style=""><i onclick="changeDown({{ v[1] }}, {{count}})" class="fa fa-arrow-down" style="font-size: 13px; cursor: pointer;" aria-hidden="true"></i></div>
</div> </div>
</div> </div>
{% elif "rgb" in v[1] %} {% elif "rgb" in v[2] %}
&nbsp;<input id="dimmer_{{v[0]}}_block_{{count}}" data-slider-id='dim_{{v[0]}}_block_{{count}}' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="14" /> &nbsp;<input id="dimmer_{{v[1]}}_block_{{count}}" data-slider-id='dim_{{v[1]}}_block_{{count}}' type="text" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="14" />
<br><br> <br><br>
<button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#myModal-{{v[0]}}-block-{{count}}">RGB colors</button> <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#myModal-{{v[1]}}-block-{{count}}">RGB colors</button>
<!-- Modal --> <!-- Modal -->
<div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="myModal-{{v[0]}}-block-{{count}}"> <div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" id="myModal-{{v[1]}}-block-{{count}}">
<div class="modal-dialog modal-sm"> <div class="modal-dialog modal-sm">
<!-- Modal content--> <!-- Modal content-->
@ -58,7 +58,7 @@
<h4 class="modal-title">RGB Selector</h4> <h4 class="modal-title">RGB Selector</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div id="rgb_{{v[0]}}_block_{{count}}" class="inl-bl"></div> <div id="rgb_{{v[1]}}_block_{{count}}" class="inl-bl"></div>
<style> <style>
.inl-bl { .inl-bl {
display: inline-block; display: inline-block;
@ -66,7 +66,7 @@
</style> </style>
<script> <script>
$(function() { $(function() {
$('#rgb_{{v[0]}}_block_{{count}}').colorpicker({ $('#rgb_{{v[1]}}_block_{{count}}').colorpicker({
color: '#ffaa00', color: '#ffaa00',
container: true, container: true,
inline: true inline: true
@ -75,7 +75,7 @@
</script> </script>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" onclick="changeRgbColor('rgb_{{v[0]}}_block_{{count}}')">Save</button> <button type="button" class="btn btn-default" data-dismiss="modal" onclick="changeRgbColor('rgb_{{v[1]}}_block_{{count}}')">Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div> </div>
</div> </div>
@ -98,45 +98,45 @@ $(document).ready(function() {
{% for k, v in blockArray[count]["switches"].iteritems() %} {% for k, v in blockArray[count]["switches"].iteritems() %}
{% if v[2] %} {% if v[0] %}
$('#s_title_{{ count }}').html("{{ v[2] }}"); $('#s_title_{{ count }}').html("{{ v[0] }}");
{% endif %} {% endif %}
{% if v[1] == "switch" %} {% if v[2] == "switch" %}
$('input[id="switch_{{v[0]}}_block_{{count}}"]').on('switchChange.bootstrapSwitch', function(event, state) { $('input[id="switch_{{v[1]}}_block_{{count}}"]').on('switchChange.bootstrapSwitch', function(event, state) {
changeSwitch(this, {{v[0]}}); changeSwitch(this, {{v[1]}});
}); });
updateSwitches_block_{{count}}.push("{{v[0]}}"); updateSwitches_block_{{count}}.push("{{v[1]}}");
{% elif (v[1] == "pushon") %} {% elif (v[2] == "pushon") %}
$('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) { $('button[id="push_{{v[1]}}_block_{{count}}"]').click(function(e) {
e.preventDefault(); e.preventDefault();
changePush({{v[0]}}, 'on'); changePush({{v[1]}}, 'on');
}); });
{% elif (v[1] == "pushoff") %} {% elif (v[2] == "pushoff") %}
$('button[id="push_{{v[0]}}_block_{{count}}"]').click(function(e) { $('button[id="push_{{v[1]}}_block_{{count}}"]').click(function(e) {
e.preventDefault(); e.preventDefault();
changePush({{v[0]}}, 'off'); changePush({{v[1]}}, 'off');
}); });
{% elif (v[1] == "group") or (v[1] == "scene") %} {% elif (v[2] == "group") or (v[2] == "scene") %}
$('button[id="groupon_{{v[0]}}_block_{{count}}"]').click(function(e) { $('button[id="groupon_{{v[1]}}_block_{{count}}"]').click(function(e) {
e.preventDefault(); 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(); 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(); e.preventDefault();
changeScene({{v[0]}}, 'on'); changeScene({{v[1]}}, 'on');
}); });
{% elif (v[1] == "setpoint") %} {% elif (v[2] == "setpoint") %}
updateSetpoints_block_{{count}}.push("{{v[0]}}"); updateSetpoints_block_{{count}}.push("{{v[1]}}");
{% elif (v[1] == "dimmer" or v[1] == "rgb") %} {% elif (v[2] == "dimmer" or v[2] == "rgb") %}
$('#dim_{{count}}').click(function(e) { $('#dim_{{count}}').click(function(e) {
e.preventDefault(); 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 %} {% endif %}
{% endfor %} {% endfor %}
refreshSwitches(updateSwitches_block_{{count}}, {{count}}); refreshSwitches(updateSwitches_block_{{count}}, {{count}});

View File

@ -5,7 +5,7 @@
<div class="left"></div> <div class="left"></div>
<div class="right"> <div class="right">
<span class="count_top"><i class="fa fa-{{v[1]}}"></i> {{k}}</span> <span class="count_top"><i class="fa fa-{{v[1]}}"></i> {{k}}</span>
<div class="count{% if v[2] == "On" %} green{% elif v[2] == "Off" %} red{% endif %} loading" id="top_tiles_block_{{count}}_{{v[0]}}" style="white-space: nowrap;"></div> <div class="count{% if v[2] == "On" %} green{% elif v[2] == "Off" %} red{% endif %} loading" id="top_tiles_block_{{count}}_{{v[1]}}" style="white-space: nowrap;"></div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
@ -16,9 +16,9 @@ $(document).ready(function() {
var tilesPreviousArray_{{count}}=[]; var tilesPreviousArray_{{count}}=[];
var updateDivsType_block_{{count}} = []; var updateDivsType_block_{{count}} = [];
{% for k, v in blockArray[count]["top_tiles"].iteritems() %} {% for k, v in blockArray[count]["top_tiles"].iteritems() %}
updateDivs_block_{{count}}.push("{{v[0]}}"); updateDivs_block_{{count}}.push("{{v[1]}}");
{% if v[2]|length > 3 %} {% if v[3]|length > 3 %}
updateDivsType_block_{{count}}.push("{{v[2]}}"); updateDivsType_block_{{count}}.push("{{v[3]}}");
{% else %} {% else %}
updateDivsType_block_{{count}}.push("Data"); updateDivsType_block_{{count}}.push("Data");
{% endif %} {% endif %}