Dial : customize grey dial bezel color depending on value

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
FuReT
Posts: 4
Joined: Saturday 20 February 2021 0:07
Target OS: -
Domoticz version:
Contact:

Dial : customize grey dial bezel color depending on value

Post 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.
Lokonli
Posts: 2262
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post 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.
FuReT
Posts: 4
Joined: Saturday 20 February 2021 0:07
Target OS: -
Domoticz version:
Contact:

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

Post by FuReT »

Ok I was not knowing for getStatus, not indicated on the doc page..
Thanks a lot to take care of my request ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest