Page 20 of 20

Re: Dashticz - Feature Requests

Posted: Monday 02 December 2019 13:03
by EdwinK
I've got the EU meteoalarm plugin for Domoticz running (https://www.domoticz.com/forum/viewtopi ... 65&t=19519). Is it possible to change the icon colours depending on the alert?

For example: green if there is no alert to red for a severe alert (maybe something in between for moderate alerts.

(I believe there is some sort of level in the RSS feed (level:1 through level:4).

Re: Dashticz - Feature Requests

Posted: Wednesday 04 December 2019 8:20
by lzwfkv
EdwinK wrote: Monday 02 December 2019 13:03 I've got the EU meteoalarm plugin for Domoticz running (https://www.domoticz.com/forum/viewtopi ... 65&t=19519). Is it possible to change the icon colours depending on the alert?

For example: green if there is no alert to red for a severe alert (maybe something in between for moderate alerts.

(I believe there is some sort of level in the RSS feed (level:1 through level:4).
You can do it with custom.css and custom.js, e.g. for changing alert icon colors dynamically (you can do likewise for other attributes: fonts, block color, etc.):
Assumptions:
today alert IDX in Domoticz=115 (find your own IDX and replace in the code below)
tomorrow alert IDX in Domoticz=116 (find your own IDX and replace in the code below)
Level grades (as defined in Domoticz): Level 1 - normal (no alert, GREEN), Level 2 - Light warning (YELLOW), Level 3 - Warning (ORANGE), Level 4 - Critical (RED).

custom.css:

.alertnormal .col-icon {
color: green !important;
}
.alertlight .col-icon {
color: yellow !important;
}
.alertmedium .col-icon {
color: orange !important;
}
.alerthigh .col-icon {
color: red !important;
}

custom.js:

function getStatus_115(idx,value,device) {
if(device['Level']==1) {
$('div.block_115').addClass('alertnormal');
$('div.block_115').removeClass('alertmedium');
$('div.block_115').removeClass('alerthigh');
$('div.block_115').removeClass('alertlight');
}
else if (device['Level']==2) {
$('div.block_115').addClass('alertlight');
$('div.block_115').removeClass('alertmedium');
$('div.block_115').removeClass('alertnormal');
$('div.block_115').removeClass('alerthigh');
}
else if (device['Level']==3) {
$('div.block_115').addClass('alertmedium');
$('div.block_115').removeClass('alertnormal');
$('div.block_115').removeClass('alerthigh');
$('div.block_115').removeClass('alertlight');
}
else {
$('div.block_115').addClass('alerthigh');
$('div.block_115').removeClass('alertnormal');
$('div.block_115').removeClass('alertmedium');
$('div.block_115').removeClass('alertlight');
}
}
function getStatus_116(idx,value,device) {
if(device['Level']==1) {
$('div.block_116').addClass('alertnormal');
$('div.block_116').removeClass('alertmedium');
$('div.block_116').removeClass('alerthigh');
$('div.block_116').removeClass('alertlight');
}
else if (device['Level']==2) {
$('div.block_116').addClass('alertlight');
$('div.block_116').removeClass('alertmedium');
$('div.block_116').removeClass('alertnormal');
$('div.block_116').removeClass('alerthigh');
}
else if (device['Level']==3) {
$('div.block_116').addClass('alertmedium');
$('div.block_116').removeClass('alertnormal');
$('div.block_116').removeClass('alerthigh');
$('div.block_116').removeClass('alertlight');
}
else {
$('div.block_116').addClass('alerthigh');
$('div.block_116').removeClass('alertnormal');
$('div.block_116').removeClass('alertmedium');
$('div.block_116').removeClass('alertlight');
}
}

Re: Dashticz - Feature Requests

Posted: Wednesday 04 December 2019 10:03
by EdwinK
Thanks. Going to add this to my dashboard :)

Re: Dashticz - Feature Requests

Posted: Sunday 29 December 2019 10:16
by EdwinK
Added above code to dashboard, and the icon changes colour when there is an alert, but it doesn't give the reason any more.
Screen Shot 2019-12-29 at 10.15.24.png
Screen Shot 2019-12-29 at 10.15.24.png (13.42 KiB) Viewed 4399 times

Re: Dashticz - Feature Requests

Posted: Thursday 02 January 2020 22:38
by clinkadink
EdwinK wrote: Sunday 29 December 2019 10:16 Added above code to dashboard, and the icon changes colour when there is an alert, but it doesn't give the reason any more.

Screen Shot 2019-12-29 at 10.15.24.png
Looks like the same value is being set to both fields (title and state).

Btw, you can daisy chain jquery, and add/remove multiple classes at the same time. It is down to user preference at the end of the day :)

Code: Select all

switch (device['Level']) {
  case 1:
    $('div.block_116').addClass('alertnormal').removeClass('alertmedium alerthigh alertlight');
    break;
  case 2:
    $('div.block_116').addClass('alertlight').removeClass('alertmedium alertnormal alerthigh');
    break;
  case 3:
    $('div.block_116').addClass('alertmedium').removeClass('alertnormal alerthigh alertlight')
    break;
  default:
    $('div.block_116').addClass('alerthigh').removeClass('alertnormal alertmedium alertlight')
}

Re: Dashticz - Feature Requests

Posted: Thursday 02 January 2020 22:47
by EdwinK
Thanks. Going to work on this.

Re: Dashticz - Feature Requests

Posted: Sunday 05 January 2020 9:19
by lzwfkv
EdwinK wrote: Sunday 29 December 2019 10:16 Added above code to dashboard, and the icon changes colour when there is an alert, but it doesn't give the reason any more.

Screen Shot 2019-12-29 at 10.15.24.png
Hi Edwin, this behaviour shuldn't be related to the css styles which do not touch the data section of the block at all. Have you, i some way, redefined the "Title" of the Alert block (e.g. blocks[xxx]['title']='MeteoAlarmEU" in CONFIG.js? If so, please comment the line where you defined the title and try to refresh dashticz page and see the results. I suspect it is due to the strange way the "Alert" blocks are defined in Dashticz code which is different from all the other blocks definitions, where Title and Value variables of the block are upside-down, i.e. Title=<Data>, Value=<Name>.
In particular, in blocks.js code you can find this definition:
blocktypes.SubType['Alert'] = {
icon: 'fas fa-warning',
title: '<Data>',
value: '<Name>'
};
And i have overriden it in custom.js with this one:
function getExtendedBlockTypes(blocktypes){
blocktypes.SubType['Alert'] = {icon: 'fas fa-exclamation-triangle', title: '<Name>', value: '<Data>'};
return blocktypes;
}
(Note: the 'fas fa-warning' icon is not recognized by fontawesome so it is empty, then i redefined it as well)
that should be more starightforward and, most important, lets you redefine the "Title" field without impacting the device' State/Value, as it should be allowed in Dashticz.

Re: Dashticz - Feature Requests

Posted: Sunday 05 January 2020 10:27
by EdwinK
thank. I'll have a try later today

Re: Dashticz - Feature Requests

Posted: Friday 17 January 2020 19:26
by janumix
Hi

It'd be nice to have an option to enter credentials in URL i.e. https://user:apssword@<IP> to use in buttons.
I tried several ways to enter login/pass in URL to access camera but all the time it failed (URL and camera tested in browser i.e. chrome and I'm sure it works).
How about it ?

Re: Dashticz - Feature Requests

Posted: Friday 17 January 2020 19:57
by Lokonli
janumix wrote: Friday 17 January 2020 19:26 Hi

It'd be nice to have an option to enter credentials in URL i.e. https://user:apssword@<IP> to use in buttons.
I tried several ways to enter login/pass in URL to access camera but all the time it failed (URL and camera tested in browser i.e. chrome and I'm sure it works).
How about it ?
I think it's a cross-origin issue. As a workaround you could try to use the following url:

Code: Select all

'./vendor/dashticz/nocache.php?https://user:apssword@<IP>

Re: Dashticz - Feature Requests

Posted: Monday 20 January 2020 13:46
by janumix
Thanks !
In 'btnimage' works good.
In 'url' it doesn't seem so.

BR

Re: Dashticz - Feature Requests

Posted: Friday 24 January 2020 8:08
by dannybloe
Peeps, there's a new sub forum for feature request. Let's use that one from now on. This topic will be locked.

Cheers,

Danny