hass-animated-scenes icon indicating copy to clipboard operation
hass-animated-scenes copied to clipboard

Different colors of several lights in the same scene.

Open Smarthome-Creator opened this issue 1 year ago • 5 comments

@chazzu, super project and also works great. One question, is it possible to run several lights of the same scene not synchronized?

Smarthome-Creator avatar Feb 18 '24 16:02 Smarthome-Creator

What do you mean by not synchronized?

One thing I've settled on doing is setting up an animation as a script. For example:

alias: Start Spooky
sequence:
  - service: animated_scenes.start_animation
    data:
      priority: 0
      transition: 2
      change_frequency: 5
      change_amount: all
      ignore_off: true
      restore: true
      restore_power: true
      change_sequence: false
      animate_brightness: true
      animate_color: true
      name: "{{ identifier }}"
      lights: "{{ lights }}"
      colors:
        - color_type: rgb_color
          color:
            - 247
            - 95
            - 28
          one_change_per_tick: true
          nearby_colors: 5
        - color_type: rgb_color
          color:
            - 255
            - 154
            - 0
          one_change_per_tick: true
          nearby_colors: 5
        - color_type: rgb_color
          color:
            - 136
            - 30
            - 228
          one_change_per_tick: true
          nearby_colors: 5
        - color_type: rgb_color
          color:
            - 133
            - 226
            - 31
          one_change_per_tick: true
          nearby_colors: 5
        - color_type: rgb_color
          color:
            - 148
            - 0
            - 211
          one_change_per_tick: true
          nearby_colors: 5
        - color_type: rgb_color
          color:
            - 200
            - 10
            - 10
          one_change_per_tick: true
          nearby_colors: 5
        - color_type: rgb_color
          color:
            - 135
            - 169
            - 107
          one_change_per_tick: true
          nearby_colors: 5
        - color_type: rgb_color
          color:
            - 103
            - 76
            - 71
          one_change_per_tick: true
          nearby_colors: 5
mode: single

Now I have my scene and it accepts two params, identifier and lights so I can do this:

service: script.start_spooky
data:
  identifier: spooky_living_room
  lights:
    - light.living_room_1
    - light.living_room_2
    - light.living_room_3

This will start the scene in the living room. And if I want it to do another room at the same time:

service: script.start_spooky
data:
  identifier: spooky_kitceh
  lights:
    - light.kitchen_1
    - light.kitchen_2
    - light.kitchen_3

Technically now I'm running the same scene in two places, but they are running independent of one another. Is that what you mean?

chazzu avatar Feb 18 '24 17:02 chazzu

@chazzu , thanks for the quick reply, perhaps I expressed myself badly. For example: In a Hue animated scene with a group of lights, if the animation starts, each light in the group is started with a different color so that all colors run randomly on all lights.

When I create a scene with your integration, all the lights always get the same color at the same time. So all the specified lamps light up with the same color.

You know what I mean?

Smarthome-Creator avatar Feb 18 '24 18:02 Smarthome-Creator

As long as you have change_sequence: false in your configuration, then it will choose colors randomly and assign one color to each "light." It may be that you are using a light group? The integration is not aware of what lights are in a group, so it treats a light group as a single light.

Using my example from before, I have light.living_room_1, light.living_room_2, and light.living_room_3 specified individually, even though I have a group called light.living_room which controls all 3 together.

Given the example above, I specified 8 colors, so it will go through that list 3 times (1 for each light) and choose randomly. So there's a pretty good chance each will be different, but it's not guaranteed since it's totally random.

chazzu avatar Feb 18 '24 21:02 chazzu

@chazzu , thanks, I'll give that a try.

I've tested it and understood it so far. If I set "change_sequence" to false, a random color is selected and if it is set to true, the colors are run through in sequence.

But if I set it to "false", the transition no longer works "smoothly". I set it to 30 seconds to get a "smooth" transition.

Is there any way to adjust this?

Smarthome-Creator avatar Feb 19 '24 07:02 Smarthome-Creator

Hello @chazzu , I have another question about stopping the animations. With the script it works great but unfortunately I have no idea about scripting. The animations mainly run in my living room. As soon as I switch off my TV, for example, the lighting in the living room is also switched off.

But if I still have an animation running in the kitchen, I don't want it to be switched off as well. Do you have a tip for me on how to define the variable so that I can only switch off animations with "@livingroom" or "@kitchen" with the script?

Greetings

Smarthome-Creator avatar Feb 21 '24 09:02 Smarthome-Creator