home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.76k stars 30k forks source link

Scenes with a light group snapshot do not activate correctly #126263

Open Airblader opened 6 days ago

Airblader commented 6 days ago

The problem

This is a follow-up for #122165 which has been fixed & closed, but I think something is still not working correctly.

I have an automation that creates a scene using a snapshot, dims the lights, and reactivates the scene later on (to dim the lights while the balcony door is open). In my specific case, they are all Hue lights.

When I create the scene as a snapshot of a light group (with each light having a different color), activating the scene turns on the lights, but sets them all to the same (white, for me) color instead of the correct individual settings.

If, however, I create the scene specifying the individual lights rather than a light group, everything works correctly.

I am attaching an automation that I can trigger manually to reliably reproduce the issue.

What version of Home Assistant Core has the issue?

core-2024.9.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Philips Hue

Link to integration documentation on our website

https://www.home-assistant.io/integrations/hue/

Diagnostics information

No response

Example YAML snippet

- id: test_hue_group_scene
  alias: Test Hue Group Scene
  trigger:
    # Dummy trigger
    - platform: state
      entity_id: media_player.apple_tv
  action:
    - action: scene.create
      data:
        scene_id: hue_group_test
        snapshot_entities:
          - light.couch
          # Using individual lights instead works:
          # - light.couch_1
          # - light.couch_2
          # - light.couch_3
          # - light.couch_4

    - delay: '00:00:03'
    - action: light.turn_off
      entity_id: 
        - light.couch 

    - delay: '00:00:03'
    - action: scene.turn_on
      entity_id: scene.hue_group_test
    - action: scene.delete
      data:
        entity_id: scene.hue_group_test

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 6 days ago

Hey there @balloob, @marcelveldt, mind taking a look at this issue as it has been labeled with an integration (hue) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `hue` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign hue` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


hue documentation hue source (message by IssueLinks)

Grandma-Betty commented 6 days ago

Same problem here.

marcelveldt commented 5 days ago

If you want to have different colors in a scene, you need the individual lights in the scene and not the group.

Airblader commented 5 days ago

Is that a hard limitation, or just a feature request rather than a bug?

Grandma-Betty commented 5 days ago

Here is my specific example which is facing the issue: I have an automation where a light scene is being generated dynamically as soon as someone hits the main door ring bell. This scene is taking a snapshot of the Hue light bulbs current state. After the scene is being created, the lights starts to blink using the “breathe” effect (which is done via mqtt.publish action). After blinking the lights should get into their previous state at the moment when the snapshot was taken.

(Just for explanation: The idea behind this is that the Hue lights should singalize optically whenever someone is ringing the main door bell because there are some areas in our house where you just cannot hear the main door ring bell.)

As suggested by @marcelveldt, for taking the dynamic scene snapshot, I use the individual lights instead of the group, but this does not solve the issue I am facing. The automation works so far but the ugly limitation here is that when the scene is being activated at the last step of the automation, the color and brightness do not match the previous state.

Here's the code of the script which is being triggered by the automation after someone hits the main door ring bell:

alias: ScriptLightNotifications
sequence:
  - action: scene.create
    data:
      scene_id: scene_scriptlightnotifications_lights_previous_state
      snapshot_entities:
        - light.huecolorlightstripplus02
        - light.huecolorlightstripplus03
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - action: mqtt.publish
    data:
      qos: 0
      retain: false
      topic: zigbee2mqtt/Z2MGroup_huecolorlightstripsplus/set
      payload: "{\"scene_recall\": 1, \"effect\": \"breathe\"}"
  - delay:
      hours: 0
      minutes: 0
      seconds: 8
      milliseconds: 0
  - action: scene.turn_on
    data: {}
    target:
      entity_id: scene.scene_scriptlightnotifications_lights_previous_state
mode: single