Allow different domoticz type fields to be used at the top_tiles.
This commit is contained in:
parent
ce9cd5a494
commit
66f50dcc70
|
|
@ -32,11 +32,11 @@
|
||||||
[[top_tiles]]
|
[[top_tiles]]
|
||||||
Temperatuur tuin = 31, fire
|
Temperatuur tuin = 31, fire
|
||||||
Temperatuur auto = 22, car
|
Temperatuur auto = 22, car
|
||||||
Stroomverbruik TV = 13, plug
|
Stroomverbruik TV = 13, plug, Usage
|
||||||
Temperatuur Eindhoven = 54, fire
|
Temperatuur Eindhoven = 54, fire
|
||||||
Temperatuur tuin BMP = 55, fire
|
Temperatuur tuin BMP = 55, fire
|
||||||
Totaal Playstation = 25, plug
|
Totaal Playstation = 25, plug, Usage
|
||||||
Totaal slaapkamer lamp = 12, plug
|
Totaal slaapkamer lamp = 12, plug, CounterToday
|
||||||
Temperatuur raspberry = 1, car
|
Temperatuur raspberry = 1, car
|
||||||
[[line_charts]]
|
[[line_charts]]
|
||||||
Temperatuur Slaapkamer = 14, month, temp
|
Temperatuur Slaapkamer = 14, month, temp
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ function refreshSwitches(updateSwitches, block) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Top tiles functions
|
// Top tiles functions
|
||||||
function refreshTopTiles(updateDivs, block, tilesPreviousArray) {
|
function refreshTopTiles(updateDivs, block, tilesPreviousArray, updateDivsTypeArray) {
|
||||||
if (tilesPreviousArray.length == 0) {
|
if (tilesPreviousArray.length == 0) {
|
||||||
for(var i = 0; i < updateDivs.length; i++){
|
for(var i = 0; i < updateDivs.length; i++){
|
||||||
tilesPreviousArray.push(-1);
|
tilesPreviousArray.push(-1);
|
||||||
|
|
@ -69,7 +69,7 @@ function refreshTopTiles(updateDivs, block, tilesPreviousArray) {
|
||||||
requestAPI(url, function(d) {
|
requestAPI(url, function(d) {
|
||||||
var obj = JSON.parse(d);
|
var obj = JSON.parse(d);
|
||||||
if (obj.result != undefined) {
|
if (obj.result != undefined) {
|
||||||
var data = obj.result[0].Data;
|
var data = obj.result[0][updateDivsTypeArray[i]];
|
||||||
} else {
|
} else {
|
||||||
var data = "-";
|
var data = "-";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;">{{v[2]}}</div>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
@ -14,15 +14,22 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var updateDivs_block_{{count}}=[];
|
var updateDivs_block_{{count}}=[];
|
||||||
var tilesPreviousArray_{{count}}=[];
|
var tilesPreviousArray_{{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[0]}}");
|
||||||
|
{% set data = v[2] %}
|
||||||
|
{% if data is defined %}
|
||||||
|
updateDivsType_block_{{count}}.push("{{v[2]}}");
|
||||||
|
{% else %}
|
||||||
|
updateDivsType_block_{{count}}.push("Data");
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% 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}}) {
|
for (var i in updateDivs_block_{{count}}) {
|
||||||
$("#top_tiles_block_{{count}}_" + updateDivs_block_{{count}}[i]).removeClass("loading");
|
$("#top_tiles_block_{{count}}_" + updateDivs_block_{{count}}[i]).removeClass("loading");
|
||||||
}
|
}
|
||||||
tilesPreviousArray_{{count}} = setInterval(refreshTopTiles, 9000, updateDivs_block_{{count}}, "top_tiles_block_{{count}}_", tilesPreviousArray_{{count}});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- /top tiles -->
|
<!-- /top tiles -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue