Page 1 of 1

Dial : customize grey dial bezel color depending on value

Posted: Saturday 20 February 2021 0:16
by FuReT
Hello !

I'm using the dial block and i'm trying to switch the dial bezel color depending on the current value of the Dial.
I got it working with standard block but not able to make it work with the default dial...

My block :
blocks['nrj_conso'] = {
idx: 1027,
title: 'Conso',
type: 'dial',
values: ['Usage','CounterToday'],
min: 0,
max: 7000,
width: 3,
showunit: true,
shownumbers: false,
showring: true,
animation: false,
flash: true,
last_update: false
}
Ths css i want to apply :
.warning {
background-color: #bb2424;
}

My function on custom.js :
function getStatus_nrj_conso(block) {
var value = block.device.Usage;
if (parseFloat(value) > 100 ) {
block.addClass='warning';
} else {
block.addClass='';
}
}
If someone can help ;)

Thanks in advance.

Re: Dial : customize grey dial bezel color depending on value

Posted: Saturday 20 February 2021 9:45
by Lokonli
FuReT wrote: Saturday 20 February 2021 0:16 Hello !

I'm using the dial block and i'm trying to switch the dial bezel color depending on the current value of the Dial.
I got it working with standard block but not able to make it work with the default dial...

My block :
blocks['nrj_conso'] = {
idx: 1027,
title: 'Conso',
type: 'dial',
values: ['Usage','CounterToday'],
min: 0,
max: 7000,
width: 3,
showunit: true,
shownumbers: false,
showring: true,
animation: false,
flash: true,
last_update: false
}
Ths css i want to apply :
.warning {
background-color: #bb2424;
}

My function on custom.js :
function getStatus_nrj_conso(block) {
var value = block.device.Usage;
if (parseFloat(value) > 100 ) {
block.addClass='warning';
} else {
block.addClass='';
}
}
If someone can help ;)

Thanks in advance.
The getStatus functions are not supported for dial blocks yet.

The standard blocks and dial blocks currently are almost completely independent implementations. I'm investigating how to merge the two.

Re: Dial : customize grey dial bezel color depending on value

Posted: Saturday 20 February 2021 18:05
by FuReT
Ok I was not knowing for getStatus, not indicated on the doc page..
Thanks a lot to take care of my request ;)