Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having the choice on or off if the state of group/scene is mixted #1206

Open
Tixav opened this issue Dec 14, 2024 · 4 comments
Open

Having the choice on or off if the state of group/scene is mixted #1206

Tixav opened this issue Dec 14, 2024 · 4 comments

Comments

@Tixav
Copy link

Tixav commented Dec 14, 2024

It is more an improvement than an issue

@lokonli
Copy link
Collaborator

lokonli commented Dec 15, 2024

For a 'group' block you can set this behavior via the 'mixed' parameter.

See:
https://dashticz.readthedocs.io/en/beta/blocks/specials/group.html

@Tixav
Copy link
Author

Tixav commented Dec 15, 2024

you are wright but it is fixed in the config.js, sometimes I need to set off in the group is mixted and sometimes I need to set on. If I set it up in the config.js to 'on' the and I want to go to off, all devices go 'On" and I am obliged to push the group button again to set 'Off'. If I set it up in the config.js to 'off' the and I want to go to on, all devices go 'Off" and I am obliged to push the group button again to set 'On'. If a popup would appear to choice, it will be easier
;-)
regards and a lot of good things for Chrismass

And thanks for all the work already realised !

@lokonli
Copy link
Collaborator

lokonli commented Dec 15, 2024

popup window would be an option, but is not supported (yet)

Alternative:
Create two blocks.
For the first one add:
switchMode: 'on',
Second block:
switchMode: 'off',

Then you will have two blocks: The first one will switch on all group devices, the second one will switch off all devices.

@Tixav
Copy link
Author

Tixav commented Jan 3, 2025

so perhaps this could help someone :
I add this in my config.js (popup is voluntarily null and will be changed on the fly in the custom.js when the device will be 'mixed') :

blocks['s9']={width:6,longpress:false,title:'all light',popup:'',ChoixMixed:true};
//the pop block that contains blocks must have the name Pu_ + the name of the group or scene
blocks['Pu_s9']={blocks:['GPGOff','GPGOn']};
blocks['GPGOff']={type:'group',idx:'s9',width:4,longpress:false,switchMode:'off',title:'all to Off'};
blocks['GPGOn'] ={type:'group',idx:'s9',width:4,longpress:false,switchMode:'on',title:'all to On'};

and in the custom.js :

// AFTERGETDEVICES
function afterGetDevices(){
$.each(blocks, function (i,valu) {

// find device in alldevices matching with block index
var ledevice=alldevices[blocks[i]['idx']];	

// scene or group !!
 if (blocks[i]['ChoixMixed'] && i[0]=='s') {
	var BlockData;
	var BlockDataChange=false;
	if(ledevice.Data=='Mixed') {
		if (blocks[i]['popup']=='') {
			BlockData={popup:'Pu_'+blocks[i]['idx']};
			BlockDataChange=true;
		}
	}
	else{
		if (!blocks[i]['popup']=='') {
		BlockData={popup:''};
		BlockDataChange=true;
		}
	}
	if (BlockDataChange) { Dashticz.setBlock(valu['idx'], BlockData); }
}

}
}

I tested with several domoticz scene/group, that works

I Wish a good year to all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants