How to choose which lights are on

I have about 80 hue lights.

I want to control which of these lights are turned on.

for example
Brightness of lights that are turned on
Color temperature of lights that are turned on
The color of the lights that are turned on
I want to control the above action using the hue tap dial.

I think it would be possible if I could specify this “light that is on” with logic. Is there a way?

So…this AND card?

image

Are there too many cards??

Hi @LEE_Tackzun ,
I guess there is an elegant possibility in Homey Script, which I did not yet started to look at.
As there are no FOR loops in (advanced) flows, the easy way would be in Advanced Flow.
*WHEN… * started manually or at certain times, eg by CronJob
THEN… Set MyLightsOn to " "
AND… Light1 is ON THEN… Set MyLightsOn to MyLightsOn " , Light1"
… for every Light you want to check.
Then you have a text variable with all lights that are on at that specific time.

Hope that helps

If you really want to control potentially 80 lights probably running a HomeyScript is the easiest solution:

// provide with argument in the format in the default value below
const { dim, color } = JSON.parse(args[0] || '{ "dim": 0.5, "color": null }');

const devices = await Homey.devices.getDevices();

const lights = Object.values(devices).filter(d => d.class === "light");

lights.forEach(async (light) => {
  // ignore lights which are turned off
  if (!light.capabilitiesObj.onoff.value) {
    return;
  }

  // if light is dimmable set to target dim value
  if (dim >= 0 && light.capabilities.includes("dim")) {
    await Homey.devices.setCapabilityValue({
      deviceId: light.id,
      capabilityId: 'dim',
      value: dim
    });
  }

  // TODO: something similar for color
});

1 Like

For me, scripting is too difficult an approach.

Can you tell me how to apply this?

I probably would create a flow like below. This basically adds the brightness for all turned on devices by 10% or sets it to 100% depending on what you are pressing on the remote.

with the following script:

// Change dim of on lights
let change = 'absolute';

if (args[0].startsWith("+") || args[0].startsWith("-")) {
  change = 'relative';
}

const dim = Number(args[0]);

const devices = await Homey.devices.getDevices();

const lights = Object.values(devices).filter(d => d.class === "light");

lights.forEach(async (light) => {
  // ignore lights which are turned off
  if (!light.capabilitiesObj.onoff.value) {
    return;
  }

  // if light is dimmable set to target dimvalue
  if (light.capabilities.includes("dim")) {
    if (change === 'absolute') {
      await Homey.devices.setCapabilityValue({
        deviceId: light.id,
        capabilityId: 'dim',
        value: Math.min(Math.max(dim, 0.01), 1)
      });
    } else {
      await Homey.devices.setCapabilityValue({
        deviceId: light.id,
        capabilityId: 'dim',
        value: Math.min(Math.max(light.capabilitiesObj.dim.value + dim, 0.01), 1)
      });
    }
  }
});

As an alternative have you thought about just creating different moods in which you define what lights should be in which state (power, brightness, color) and just switch between the moods when pressing on your remote?

Introducing Moods | Homey News

Not a direct solution I think, but worth a try: Light Triggers app