🎉 Party Lights - Randomly loop through color and brightness values

Just create these two automations and sub to your entities :smiley:


#Automation 1 - Save current state:
alias: Auto - Luke Disco Save Light Status
description: ""
trigger:
  - platform: state
    entity_id: input_boolean.disco_luke_helper
    from: "off"
    to: "on"
condition: []
action:
  - service: scene.create
    data:
      snapshot_entities:
        - light.luke_dog
        - light.luke_spot_01
        - light.luke_spot_02
        - light.luke_spot_03
        - light.luke_spot_04
        - light.luke_spot_05
      scene_id: luke_before_disco
mode: single


#Automation 2 - Restore previous state:
alias: Auto - Luke Disco Restore Light Status
description: ""
trigger:
  - platform: state
    entity_id: input_boolean.disco_luke_helper
    from: "on"
    to: "off"
condition: []
action:
  - service: scene.turn_on
    data: {}
    target:
      entity_id: scene.luke_before_disco
mode: single

Then your light will go back to previous state :wink:

1 Like

I’ve used the blueprint to create multiple automations, one for each room in my home. I can now go into party mode in a single room or the whole house. I tested it with the whole house which is 27 lights and it was AWESOME. Setting them all back to normal was a bit of a pain so I do hope something like the above can be integrated into the blueprint.

1 Like

I can’t seem to figure this message board, I’m a blockhead :yum:

I was TRYING to say …

I have to agree with Edvin89!

This was the first blueprint I used PLUS it was one of the main ideas I had wanted to try with my lights.

Thanks much for your work!

That is all! lol

1 Like

For those struggling with getting their lights back to normal after using this amazing blueprint, I came up with the following. It doesn’t actually set it back to what it was but instead back to what you define as default which may well be how they were to begin with. It works for me :slight_smile:

I have separate automations for each room that detect when the corresponding room’s input boolean turns off and it then runs the following code (example from one room shown). I did it this way as it meant I didn’t modify the original blueprint code in case in gets updated. It also allows different settings for each room. Basically when the input boolean turns off the lights will stay as they are, in various colours etc. I let that settle for a few seconds, change the lights to how I normally want them in the room and then turn them off.

Here’s the code. I hope it is helpful. If you have any better ideas I’d love to hear them and of course it would be great to get something like this built into the blueprint.

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
    service: light.turn_on
    metadata: {}
    data:
      kelvin: 5500
      brightness_pct: 20
    target:
      entity_id: light.tv_room_lights
  - service: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: light.tv_room_lights
    alias: Turn Lights Off
mode: single

It would be great if the BluePrint could include the HA service to create a snapshot of the light entity states prior to any changes so we can call the restore service when turning off ‘party lights’.

eg:

prior to making changes to lights:

      - service: scene.create
        data:
          scene_id: ensuite_lights_snapshot
          snapshot_entities:
            - light.ensuite_led_strip
            - light.ensuite_downlight

Then when turning off party lights:

      - service: scene.turn_on
        data:
          entity_id: scene.ensuite_lights_snapshot

This is just an example from what I do with some lights if my doorbell is pressed where they flash a few times then go back to the previous state.

1 Like

Great blueprint, it could be added that when the trigger is turned off, all bulbs or groups return to warm white. When the trigger goes to OFF, the bulbs remain lit in color. I solved the problem myself by creating an additional script and automation for when the trigger goes to off.

I saw another similar blueprint to this one and it mentioned that prolonged use would hammer the log & database, making it grow and potentially cause issues for systems running on an SD Card. It mentioned that the best way around this was to turn off logging for the automation but it didn’t say how to do it.

As I am using this automation I thought I would ask the question here as I am sure many of us could be affected by this if you have it running many lights over say the Christmas period.

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