Dashticz - afterGetDevices() Topic is solved

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Dashticz - afterGetDevices()

Post by Doudy »

Hello,

I tried following via custom.js

Code: Select all

function afterGetDevices(){
    if (Domoticz.getAllDevices()[78].Data == 'Off') {
            $('.pluie-1h .title').addClass('warningblue');
            $('.pluie-1h .state').addClass('warningblue');
    }
    else {
            $('.pluie-1h .title').removeClass('warningblue');
            $('.pluie-1h .state').removeClass('warningblue');
    }
}
My custom.css

Code: Select all

.warningred {
  color: red !important;
}
.warningorange {
  color: orange !important;
}
.warninggreen {
  color: green !important;
}
.warningblue {
  color: blue !important;
}
My Block

Code: Select all

blocks['pluie-1h'] = { 
	idx: 84,
	width: 2,
	title: '1h',
}
But no result on display

Image

Domoticz device [78]
Image

Where is the problem ?
Thank you
Dashticz V3.8.3 beta
;)
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Dashticz - afterGetDevices()

Post by Doudy »

Hello,
Nobody ?

function afterGetDevices still does not work! :?
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Dashticz - afterGetDevices()

Post by Doudy »

Nobody ?
😥
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
cornesch
Posts: 19
Joined: Sunday 10 November 2019 19:10
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Contact:

Re: Dashticz - afterGetDevices()

Post by cornesch »

Goodmorning,

Below is an example of how it works for me:
(Instead of Data, use Status)

CUSTOM.JS
if (alldevices[118].Status == 'On') {
$('.block_75 .col-data').addClass('warningblue');
}
else {
$('.block_75 .col-data').removeClass('warningblue');
}

CUSTOM.CSS
.warningblue {
color: green !important;
}
>>Raspberry Pi 4<<>>Raspberry Pi 3 + 7-inch Touchscreen<<>>Ikea Tradfri<<>>Nefit Easy<<>>ESP-Easy<<>>Netatmo<<>>Sonos<<
Lokonli
Posts: 2262
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Dashticz - afterGetDevices()

Post by Lokonli »

Doudy wrote: Friday 25 June 2021 10:48 Hello,

I tried following via custom.js

Code: Select all

function afterGetDevices(){
    if (Domoticz.getAllDevices()[78].Data == 'Off') {
            $('.pluie-1h .title').addClass('warningblue');
            $('.pluie-1h .state').addClass('warningblue');
    }
    else {
            $('.pluie-1h .title').removeClass('warningblue');
            $('.pluie-1h .state').removeClass('warningblue');
    }
}
My custom.css

Code: Select all

.warningred {
  color: red !important;
}
.warningorange {
  color: orange !important;
}
.warninggreen {
  color: green !important;
}
.warningblue {
  color: blue !important;
}
My Block

Code: Select all

blocks['pluie-1h'] = { 
	idx: 84,
	width: 2,
	title: '1h',
}
But no result on display

Image

Domoticz device [78]
Image

Where is the problem ?
Thank you
Dashticz V3.8.3 beta
;)
You have to add '.block_' to the CSS class selector, so like this:

Code: Select all

function afterGetDevices(){
    if (Domoticz.getAllDevices()[78].Data == 'Off') {
            $('.block_pluie-1h .title').addClass('warningblue');
            $('.block_pluie-1h .state').addClass('warningblue');
    }
    else {
            $('.block_pluie-1h .title').removeClass('warningblue');
            $('.block_pluie-1h .state').removeClass('warningblue');
    }
}
Doudy
Posts: 246
Joined: Tuesday 09 August 2016 9:09
Target OS: -
Domoticz version:
Contact:

Re: Dashticz - afterGetDevices()

Post by Doudy »

Lokonli wrote: Sunday 04 July 2021 20:33 You have to add '.block_' to the CSS class selector, so like this:

Code: Select all

function afterGetDevices(){
    if (Domoticz.getAllDevices()[78].Data == 'Off') {
            $('.block_pluie-1h .title').addClass('warningblue');
            $('.block_pluie-1h .state').addClass('warningblue');
    }
    else {
            $('.block_pluie-1h .title').removeClass('warningblue');
            $('.block_pluie-1h .state').removeClass('warningblue');
    }
}
It was the right solution
👍

👏
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests