šŸŽ‰ Party Lights - Randomly loop through color and brightness values

I installed this blueprint earlier today, the lights do all turn on in different colors, but they do not randomly change after X seconds?

alias: Karaoke Time
description: ""
use_blueprint:
  path: Twanne/party_lights.yaml
  input:
    party_mode_trigger: input_boolean.karaoke
    target_light:
      - light.big_light
      - light.dining_light
      - light.living_light
      - light.kitchen_corner
      - light.little_light
    sync_lights: false
    time_between_changes:
      hours: 0
      minutes: 0
      seconds: 1
    transition_time: 0
    color_mode: random
    min_brightness_pct: 30

seemed straight forward, i have no updates pending in HA, the lights are ā€˜Wizzā€™ lights, and I have restarted HA

1 second?
dudeā€¦

:smiley: yeh well it was 30 secs, but to test i think i tried almost everything

I reckon this would be pretty neat alright - but wonder if anyone has come across the error below:

Iā€™ve got mine all set for 1 second too. Thatā€™s anywhere from a single light to 27 if I have them all in party mode. Party lights need to flash quickly and 1 second does this reasonably well.

One thing you will need to be careful of if you set a really short loop time (ie 1 second). As I mentioned above, Iā€™ve had mine set to 1 second since I first set it up but I have really only had the lights on for relatively short periods of time and all was good. However, I had some of them on for a long time last night and the automation crashed as I exceeded 10,000 loops. Iā€™m not sure if there is somewhere to increase that limit. If not, then if you have a 1 second delay, you can really only run it for 10,000 seconds which is about 2 3/4 hours. Increase the delay to 2 seconds and you will get 5 1/2 hours. The problem is, at 2 seconds and greater, the lights arenā€™t really ā€œflashingā€. They are just changing colour slowly.

Thank you for the great blue print. I use it the first time for a party on Saturday and it was great, people love it.

Just notice that sometime the looping stops for like 4-5 seconds.

Do you have any idea?

Below my settings

1 Like

Thx for a GREAT BP.
is there a way it can just flash Blue / RED - like for secuity alarm?

many tx

I think you might be running into a caching issue like @dw1562 in his previous replies.
Currently I donā€™t know how to fix that yet.

Not sure it is the same problem. Cause it seems to happen every 2-3 minutes.
Iā€™m trying to tweak a little bit the automation in order to see if it improves.

To have flashing lights that are more similar to a disco Iā€™m using the following parameters. My guess is that time_between_changes is somehow too low, and at some point it overloads the requests the light can support. Initially I had 0, now I put 0.7 which seems to be a good compromise.

description: ''
use_blueprint:
  path: Twanne/party_lights.yaml
  input:
    party_mode_trigger: input_boolean.party_button_home
    target_light:
      - light.signify_netherlands_b_v_lcl001_light
    color_mode: random
    transition_time: 0.4
    time_between_changes: 0.7
    min_brightness_pct: 80
    brightness_mode: fixed
    fixed_brightness_pct: 100

I think it makes sense that the light itself was getting messed up since the transition time is set to 0.4 seconds, but you had the time between changes set to 0.
This would mean that the transition is still happening when a new change is pushed. My guess us that the light buffers the new incoming requests and only executes them once the transition is done, thus loading up the buffer and then stalling.

There is a warning message at the transition time parameter about this in order to prevent it, but there is no way of coding a hard stop in the blueprint to prevent users from actually setting it up incorrectly.

NEW RELEASE:

05/09/2024 - Version 1.4

  • Added a feature where your lights will return to the previous settings when the party mode is stopped.
  • Added the option to set effects for the lights.
  • Removed a logging action (was used for debugging).
  • General code corrections.
  • Modified some descriptions to improve user friendliness.
2 Likes

This feature has now been added to the blueprint (Version 1.4).

2 Likes

A snapshot feature has been added so that the lights return to their previous state.

1 Like

Thanks for your continued work on this!

Iā€™ve upgraded to the new version and it almost works as needed. It does indeed grab a snapshot of how the lights were and returns to it when the trigger is turned off. However, if the lights were off to begin with, it returns to the off state but when you then turn the lights on again they will be in the final colours before the lights were turned off. If the lights are on before the trigger occurs then it works perfectly.

I think what is also needed is ā€œdefault light settingsā€ that are returned to if the lights were off to begin with. I have implemented this myself with an ā€œOffā€ automation that sets the lights back to white etc and then turns them off. The code is below.

alias: Party Lights - TV Room - Off
description: ā€œā€
trigger:

  • platform: state
    entity_id:
    • input_boolean.party_lights_tv_room
      from: ā€œonā€
      to: ā€œoffā€
      condition:
      action:
  • delay:
    hours: 0
    minutes: 0
    seconds: 5
    milliseconds: 0
  • alias: Set Lights Back to White
    metadata: {}
    data:
    kelvin: 5500
    brightness_pct: 20
    target:
    entity_id: light.tv_room_lights
    action: light.turn_on
  • metadata: {}
    data: {}
    target:
    entity_id: light.tv_room_lights
    alias: Turn Lights Off
    action: light.turn_off
    mode: single
1 Like

What are the ā€œeffectsā€ you mention in the release notes?

Some smart bulbs support effects like ā€˜blinkā€™, ā€˜fadeā€™, ā€˜colorloopā€™, etc ā€¦
You can now configure these, but support depends on the specific bulb.

Youā€™re welcome.

This behavior is part of how your lights themselves are configured.
Most smart bulbs will be set to turn on in the last state they were in. See if you can set there ā€˜turn onā€™ behavior in the lightā€™s settings.

While I agree in general that this is a good idea, the way you implement it is not very flexible as it would apply all the same settings to the lights in the blueprint.
I will look into giving users the option to choose to return the lights to their previous state or activating a scene. That would allow different settings for each light and even include other entities.

Iā€™ve added the option to configure effects for the lights (your specific lights will need to support it though.) Maybe that will work for you.
Itā€™s pretty easy to make an automation for specifically that though, just loop through blue and red colors with a short delay:

sequence:
  - repeat:
      sequence:
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
        - action: light.turn_on
          metadata: {}
          data:
            rgb_color:
              - 255
              - 0
              - 0
            brightness_pct: 100
          target:
            entity_id: light.YOUR_LIGHT_ENTITY
        - action: light.turn_on
          metadata: {}
          data:
            rgb_color:
              - 0
              - 0
              - 255
            brightness_pct: 100
          target:
            entity_id: light.YOUR_LIGHT_ENTITY
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
      until:
        - condition: state
          entity_id: input_boolean.YOUR_TRIGGER
          state: "off"

NEW RELEASE:

06/09/2024 - Version 2.0

  • Added user defined behavior when the party mode is turned off.
    4 options are available:
  1. NO CHANGE:
    Keep the lights in the state they are at the end of the party.

  2. LIGHTS OFF:
    Turn the lights off.

  3. RETURN TO PREVIOUS STATE:
    Return the lights to the state they were before the party began.

  4. USER DEFINED SCENE:
    Activate a scene that determines the state of the lights after the party.

1 Like