Page 1 of 1

show blocks by parameter

Posted: Thursday 16 June 2022 19:37
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

Re: show blocks by parameter

Posted: Friday 01 July 2022 22:16
by kispalsz
Can anyone help with the above?

Re: show blocks by parameter

Posted: Monday 04 July 2022 22:16
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);
}