Works like a a charm. Except the coloring part.
Code in config.js
Code: Select all
config['longfonds_zipcode'] = '8888AA';
config['longfonds_housenumber'] = '11';
blocks['longfonds'] = {
title: 'Longfonds',
switch: true,
width: 3,
}
Besides the Longfonds I also have a Co2 Sensor, the PM10 and PM25 sensor.
For those sensors I configured the coloring based on the luchtkwaliteitsindex (air quality index)
https://www.luchtmeetnet.nl/informatie/ ... ndex-(lki)
Code: Select all
// pm25
function getStatus_124(block){
var idx = block.idx;
var device = block.device;
if(parseFloat(device['Data'])<10){
block.addClass='kleurStatus1';
}
if((parseFloat(device['Data'])>=10) && (parseFloat(device['Data'])<15)){
block.addClass='kleurStatus2';
}
if((parseFloat(device['Data'])>=15) && (parseFloat(device['Data'])<20)){
block.addClass='kleurStatus3';
}
if((parseFloat(device['Data'])>=20) && (parseFloat(device['Data'])<30)){
block.addClass='kleurStatus4';
}
if((parseFloat(device['Data'])>=30) && (parseFloat(device['Data'])<40)){
block.addClass='kleurStatus5';
}
if((parseFloat(device['Data'])>=40) && (parseFloat(device['Data'])<50)){
block.addClass='kleurStatus6';
}
if((parseFloat(device['Data'])>=50) && (parseFloat(device['Data'])<70)){
block.addClass='kleurStatus7';
}
if((parseFloat(device['Data'])>=70) && (parseFloat(device['Data'])<90)){
block.addClass='kleurStatus8';
}
if((parseFloat(device['Data'])>=90) && (parseFloat(device['Data'])<100)){
block.addClass='kleurStatus9';
}
if(parseFloat(device['Data'])>=100) {
block.addClass='kleurStatus10';
}
}
With a link to the coloring in the custom.css
Code: Select all
/* kleuren voor luchtkwaliteit (PM10, PM25, Longfonds) */
.kleurStatus1 {
color: royalblue !important;
}
.kleurStatus2 {
color: cornflowerblue !important;
}
.kleurStatus3 {
color: skyblue !important;
}
.kleurStatus4 {
color: lightyellow !important;
}
.kleurStatus5 {
color: khaki !important;
}
.kleurStatus6 {
color: yellow !important;
}
.kleurStatus7 {
color: orange !important;
}
.kleurStatus8 {
color: darkorange !important;
}
.kleurStatus9 {
color: orangered !important;
}
.kleurStatus10 {
color: red !important;
}
The problem I have is that the longfonds has no idx number or whatsoever. Does any know how to color the longfonds block based on the 0-11 (great to bad) classes?