core icon indicating copy to clipboard operation
core copied to clipboard

Scenes with a light group snapshot do not activate correctly

Open Airblader opened this issue 1 year ago • 6 comments

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

Airblader avatar Sep 19 '24 11:09 Airblader

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)

home-assistant[bot] avatar Sep 19 '24 11:09 home-assistant[bot]

Same problem here.

Grandma-Betty avatar Sep 19 '24 12:09 Grandma-Betty

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

marcelveldt avatar Sep 19 '24 20:09 marcelveldt

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

Airblader avatar Sep 19 '24 20:09 Airblader

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

Grandma-Betty avatar Sep 20 '24 09:09 Grandma-Betty

This is my scene.yaml

- id: '1728732702977'
  name: Flur Hell
  entities:
    light.flur_gruppe:
      brightness: 255
      color_temp_kelvin: 2700
      state: 'on'

The brightness change as expected. But the color_temp is not set.

The attributes of this group

min_color_temp_kelvin: 2202
max_color_temp_kelvin: 6535
min_mireds: 153
max_mireds: 454
effect_list: blink, breathe, candle, channel_change, finish_effect, okay, stop_effect, stop_hue_effect
supported_color_modes: color_temp
effect: null
color_mode: color_temp
brightness: 150
color_temp_kelvin: 3649
color_temp: 274
hs_color: 27.037, 41.629
rgb_color: 255, 196, 148
xy_color: 0.444, 0.371
entity_id: light.hue_flur_1, light.hue_flur_2, light.hue_flur_3
icon: mdi:lightbulb-group
friendly_name: Flur Gruppe
supported_features: 44

Setting the color_temp_kelvin to 2700 manual works fine. But when turn_on scene the color_temp_kelvin is set 3649

TylonHH avatar Oct 12 '24 17:10 TylonHH

OK, I am a step further now. Playing around again I now found out that when I take the light’s scene snapshot, then start effects via mqtt.publish action (zigbee2mqtt topic and calling up a breathe effect in my case) and then restore the snapshot, the issue mentioned above occurs. If I use the same effects directly via Device --> Change effect option --> breathe action for every specific light, the snapshot gets restored as intended. Weird, but I guess the issue is dependent on the light steering method used after the snapshot was being taken.

It does not matter if I take/restore the snapshot for specific lights or a light group, it just works that way. So the comment from @marcelveldt is obviously wrong. The only limiting thing here is that if you want to use the specific light effect action, it is not possible to set those effects for light groups, you just have to set those effects for every single light device specifically. Just wanted to add this for completion here.

Grandma-Betty avatar Dec 05 '24 10:12 Grandma-Betty

This is mine scene.yaml. I have wifi bulbs. Wrong color application started suddenly for me.

Core 2024.12.5 Frontend 20241127.8

scene.yaml
id: "1735551774671"
name: Morning Ligths
entities:
  light.table_left:
    min_color_temp_kelvin: 2000
    max_color_temp_kelvin: 6535
    min_mireds: 153
    max_mireds: 500
    supported_color_modes:
      - color_temp
      - hs
    color_mode: hs
    brightness: 120
    color_temp_kelvin: null
    color_temp: null
    hs_color:
      - 19
      - 77.3
    rgb_color:
      - 255
      - 120
      - 58
    xy_color:
      - 0.6
      - 0.353
    friendly_name: Table Left
    supported_features: 0
    state: "on"
  light.table_center:
    min_color_temp_kelvin: 2000
    max_color_temp_kelvin: 6535
    min_mireds: 153
    max_mireds: 500
    supported_color_modes:
      - color_temp
      - hs
    color_mode: hs
    brightness: 120
    color_temp_kelvin: null
    color_temp: null
    hs_color:
      - 19
      - 77.3
    rgb_color:
      - 255
      - 120
      - 58
    xy_color:
      - 0.6
      - 0.353
    friendly_name: Table Center
    supported_features: 0
    state: "on"
  light.table_right:
    min_color_temp_kelvin: 2000
    max_color_temp_kelvin: 6535
    min_mireds: 153
    max_mireds: 500
    supported_color_modes:
      - color_temp
      - hs
    color_mode: hs
    brightness: 120
    color_temp_kelvin: null
    color_temp: null
    hs_color:
      - 19
      - 77.3
    rgb_color:
      - 255
      - 120
      - 58
    xy_color:
      - 0.6
      - 0.353
    friendly_name: Table Right
    supported_features: 0
    state: "on"
  light.192_168_68_25:
    min_color_temp_kelvin: 1700
    max_color_temp_kelvin: 6535
    min_mireds: 153
    max_mireds: 588
    effect_list:
      - Strobe color
      - Police
      - Christmas
      - RGB
      - Random Loop
      - Fast Random Loop
      - LSD
      - Slowdown
      - Night Mode
      - Date Night
      - Movie
      - Sunrise
      - Sunset
      - Romance
      - Happy Birthday
      - Disco
      - Strobe epilepsy!
      - Alarm
      - Police2
      - WhatsApp
      - Facebook
      - Twitter
      - Home
      - Candle Flicker
      - Tea Time
      - Slow Temp
      - Stop
    supported_color_modes:
      - color_temp
      - hs
      - rgb
    friendly_name: Stairs Strip
    supported_features: 44
    state: unavailable
  light.lsc_smart_globe_g95_goud_flex_filament:
    min_color_temp_kelvin: 2000
    max_color_temp_kelvin: 6535
    min_mireds: 153
    max_mireds: 500
    supported_color_modes:
      - color_temp
    color_mode: color_temp
    brightness: 38
    color_temp_kelvin: 2000
    color_temp: 500
    hs_color:
      - 30.601
      - 94.547
    rgb_color:
      - 255
      - 137
      - 14
    xy_color:
      - 0.598
      - 0.383
    friendly_name: 1st Floor Lamp
    supported_features: 0
    state: "on"
icon: mdi:weather-sunset-up
metadata: {}

ikarlashov avatar Jan 11 '25 16:01 ikarlashov

Created a somewhat related issue about the gradient lights of Phillips Hue here; https://github.com/home-assistant/core/issues/138304

carstenflokstra avatar Feb 11 '25 14:02 carstenflokstra

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.