show blocks by parameter

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
kispalsz
Posts: 31
Joined: Friday 13 October 2017 19:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

show blocks by parameter

Post by kispalsz »

Hi
I want a screen. Place columns and blocks on the screen. I want to specify the blocks to be. However, I only want them to appear under certain conditions. For example, I list all the lights in the house. But only those that are turned on would appear. If I click on 1, it will turn off and disappear from the list. I want it to disappear completely, the other burning lights to roll into its empty space.
Is this possible somehow?

Thanks
kispalsz
Posts: 31
Joined: Friday 13 October 2017 19:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: show blocks by parameter

Post by kispalsz »

Can anyone help with the above?
Lokonli
Posts: 2290
Joined: Monday 29 August 2016 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: show blocks by parameter

Post by Lokonli »

kispalsz wrote: Thursday 16 June 2022 19:37 Hi
I want a screen. Place columns and blocks on the screen. I want to specify the blocks to be. However, I only want them to appear under certain conditions. For example, I list all the lights in the house. But only those that are turned on would appear. If I click on 1, it will turn off and disappear from the list. I want it to disappear completely, the other burning lights to roll into its empty space.
Is this possible somehow?

Thanks
You have to add some code to custom.js. Below an example for two switches.

Example of CONFIG.js:

Code: Select all

var blocks = {}

blocks['light1'] = {
    idx: 79,
}

blocks['light2'] = {
    idx: 80,
}

var columns = {}

columns[1] = {
    blocks:  ['light1','light2'],
    width: 6
}

var screens = {}
screens[1] = {
    columns:  [1]
}

In custom.js add the following:

Code: Select all

function hideBlockWhenOff(block) {
  if(block.device.Status!=="On") {
    block.addClass="hidden";
    }
    else block.addClass="";
    
 }

function getStatus_light1(block) {
  hideBlockWhenOff(block);
}

function getStatus_light2(block) {
  hideBlockWhenOff(block);
}
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest