Violation errors console

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
michelscholte
Posts: 75
Joined: Friday 08 January 2016 10:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Violation errors console

Post by michelscholte »

My Dashticz is very slow since a few weeks. I run it on a newly Samsung Tablet. Clickinh on a button takes seconds before Domoticz notice it.
Websocket is working, so that's not the problem.
When I open Dashticz on my pc, I'm getting a lot of "Violation" messages in the console of Chrome and I tink thats yhe reason of the slow tablet.

Anybody any idea what the "Violation" messages might be?
Knipsel.JPG
Knipsel.JPG (49.91 KiB) Viewed 2214 times
User avatar
gizmocuz
Posts: 2481
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Violation errors console

Post by gizmocuz »

"My Dashticz is very slow since a few weeks. I run it on a newly Samsung Tablet"

Okey, are you able to run it on the thing you previously used to see if that is faster?
Quality outlives Quantity!
michelscholte
Posts: 75
Joined: Friday 08 January 2016 10:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: Violation errors console

Post by michelscholte »

Thanks for you reply.

I have the tablet Samsung Tab A8 for about 3 months. In the beginning it was really fast.
As I said, the errors are in Chrome on a Windos PC. I have a lot of them. Domoticz itself runs on an Rasp4.
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Violation errors console

Post by Lokonli »

Maybe first try with a dashboard that only contains one switch, without custom.js and check whether that performs normally.
You can create a new config file, for instance test.js, and load it with /?cfg=test.js

If Dashticz has good performance with the test config file, switch back to your current config and check the following :

Did you configure a block with a low refresh value?
Any functionality in custom.js that may make things slowly? (post it here)


Verzonden vanaf mijn iPhone met Tapatalk
michelscholte
Posts: 75
Joined: Friday 08 January 2016 10:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: Violation errors console

Post by michelscholte »

I think I found the problem. It is what you suggested a custom.js problem. I will display and hide blocks depending of the status and combination of the statuses of other blocks. Therefor I use the function "afterGetDevices()". When I delete this function with all the checks from my custom.js the errors are gone.

For example, if the radio is turned on, it shows me the "radio-blocks" and if the radio is off and the tv is on then it shows the "TV-blocks". See below:
radio.JPG
radio.JPG (30.07 KiB) Viewed 2100 times
tv.JPG
tv.JPG (27.47 KiB) Viewed 2100 times
I've attached the custom.js also. Hopefully there is a better way to show and hide these blocks?

Thanks in forward.
Attachments
custom.js
(88.46 KiB) Downloaded 49 times
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Violation errors console

Post by Lokonli »

Impressive size of custom.js, especially the afterGetDevices function...

Remember, this function is called at every device change.
That also means a lot of classes are added or removed at every device change.

I can imagine this will make Dashticz somewhat slow.

To make Dashticz faster you could use the deviceHook functionality:
There you know which device is changing, and you only need to update the blocks that depend on this.

I see you make use of a lot of Jquery selections ($) that include wildcards (*). These functions are also expensive. Probably there are ways to make this more efficient.

Some ideas:
Line 4:

Code: Select all

$('div[data-screenindex="1"] div[class*="block_tv_woonkamer_selectie_input"]').addClass('displaynone');
can probably be replaced with:

Code: Select all

$('.block_tv_woonkamer_selectie_input').addClass('displaynone');
Further, it seems you want to bring a set of blocks to the same state: hidden or visible for instance.

Instead of add classes to every block every time, you could set a css parameter, and make use of that parameter in the css class definitions.

For instance, in custom.css add:

Code: Select all

.tvstatus {
   display: var(--tvstatus)
}
In CONFIG.js add this class to every block that should follow this tvstatus:

Code: Select all

blocks["tv_woonkamer_selectie_input"] = {
   ...
  addClass: 'tvstatus',
   ...
}
Then you can set the tvstatus css variable via the deviceHook function:

Code: Select all


function deviceHook(device) {
  if (device.idx == 2628 || device.idx == 2630) setTVStatus(device);
}

function setTVStatus(device) {
    var device2628=Domoticz.getAllDevices()[2628] || {};
    var device2630=Domoticz.getAllDevices()[2630] || {};
    if (device.idx==2628) device2628=device;
    if (device.idx==2630) device2630=device;

    var css_tvstatus='unset';
    if (device2628.Data=='On') css_tvstatus='none';
    $(':root').css('--tvstatus', css_tvstatus);
}
This will make run Dashticz much faster.
michelscholte
Posts: 75
Joined: Friday 08 January 2016 10:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: Violation errors console

Post by michelscholte »

Thanks a lot. I tried it and it works great. I have some work to do :).

One question. Is it also possible, for example, to greyed out the underlying col-data of a block? See picture below:

tv2.JPG
tv2.JPG (49.2 KiB) Viewed 2066 times

Thank for your great effort.
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Violation errors console

Post by Lokonli »

michelscholte wrote: Saturday 30 December 2023 19:22 Thanks a lot. I tried it and it works great. I have some work to do :).

One question. Is it also possible, for example, to greyed out the underlying col-data of a block? See picture below:


tv2.JPG


Thank for your great effort.
Everything is possible :)

However, I don't understand your question.

'Zender' is a selector switch I guess. Can you post the block definition?
You want to have it greyed out? It look greyed out already... (The selection box with 'Selecteer' inside)
michelscholte
Posts: 75
Joined: Friday 08 January 2016 10:02
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Nederland
Contact:

Re: Violation errors console

Post by michelscholte »

"Zender" is a selector switch indeed. I want to greyed out it (opacity: 0.4) if the "Input" switch is not TV (in the screendump, for example "Netflix" is selected).

I don't want to greyed out (opacity: 0.4) the block itself, but only col-data.

What you see is exactly what I want but I have to reconfigure it, to reduce the afterGetDevices function.
tv3.JPG
tv3.JPG (119.28 KiB) Viewed 2049 times
Lokonli
Posts: 2287
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Violation errors console

Post by Lokonli »

Several ways ...

I would adapt the deviceHook function:

Code: Select all

function deviceHook(device) {
  if (device.idx == 2628 || device.idx == 2630) setTVStatus(device);

//start of change
  if (device.idx == 2630)
    if (device.Level == 0) //check your device idx and device level for TV
       Domoticz.setBlock('tv_woonkamer_selectie_zender', {addClass: ''});  //normal input selection
    else Domoticz.setBlock('tv_woonkamer_selectie_zender', {addClass: 'datagrayedout'});  //input selection should be grayed
//end of change 

}
and in custom.css:

Code: Select all

.datagrayedout .col-data {
   opacity: 0.4;
}
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests