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

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

Added options to define the state of the lights after the party mode is turned off.

NEW RELEASE:

06/09/2024 - Version 2.1

  • General code corrections
  • Layout modification for improved user friendliness
  • Correction of some spelling mistakes
1 Like

Ah right. I donā€™t think my basic Tuya based bulbs support that.

I see that the latest version now has this. I still canā€™t get it to work the way I want (return the lights to white AND turn them off so they will be white the next time someone uses voice or dashboard to turn them on) but I am sure it will make life easier for many people using your Blueprint. I still love the primary functionality of this though!!!

Can you test something for me? I have very little color changing bulbs, so I cannot do it myself:

Iā€™d like you to create a scene where you first set the color of the lights to white and then turn them off. Then save that scene and have it activate through this blueprint.

EDIT: this doesnā€™t work.

I think you need a scene for the lights to switch to (eg white/normal) and then switch off. So that on next light on command, voice, toggle, switch etcā€¦ the lights turn on to a normal colour/scene.

Yeah, Iā€™ve been testing a bit myself and itā€™s exactly how you describe. First the scene needs to be activated and then the lights need to turn off.
Iā€™ve added this feature in version 2.2.

NEW RELEASE

06/09/2024 - Version 2.2

  • Added a new after party state:
    SCENE THEN TURN OFF:
    Set the lights to a specific setting by activating the user defined scene, then turn them off.
  • General code corrections

Iā€™ve released version 2.2 today which lets you set a scene so you can set the lights to a specific setting and then turn them off after a set delay.

Thanks Anton. Iā€™ll try to test it today. Iā€™ll need to create quite a few scenes as I have separate automations using your blueprint for each room and one for the whole house so that I have more granular control.

Outstanding!!! It works perfectly for what I want and is customisable to pretty much however anybody would want it.

THANK YOU!!!

1 Like

What prompted you to create this blueprint if you have very little use for it??? Iā€™m glad you did though :slight_smile:

Spot on, working a treat. My use case:

ceiling lamps x 3 in a group
table lamps x 3 in a group

Add the actual bulbs (not groups) as the devices. Add a scene of all white for the closing effect, and a 2 second delay.

Working just as I had hoped. Great work, thanks for coming back to finish the job :wink: :laughing:




1 Like