hugobloem / stateful_scenes

Stateful Scenes in Home Assistant (Home Kit scene compatible)
MIT License
38 stars 6 forks source link

Not working with Zigbee Groups #59

Closed vJan00 closed 2 months ago

vJan00 commented 2 months ago

Hey, thanks for this great automation - it really helps me a lot! The only thing I've noticed is that Zigbee groups don't work.

I think this has to do with the fact that Zigbee groups are not handled as individual devices but as pure controls in the respective ZigBee dongle. This means that Stateful Scenes controls them but queries their attributes incorrectly as they do not have the correct ones (they are on the correct devices belonging to the group).

I am happy to help with debugging and will update the issue as soon as I find out more.

hugobloem commented 2 months ago

Hi!

Thank you for pointing this out. Is this using ZHA or Zigbee2mqtt? I use the latter myself, so do not have much experience with ZHA.

Could you share a scene configuration where you use these Zigbee groups and maybe the corresponding device and its attributes in Home Assistant?

vJan00 commented 2 months ago

Hey,

I use ZHA. I have already done some debugging, in my bedroom everything works as desired - 3x MagicHome LED strips, 2x IKEA Tradfri bulbs (Zigbee) and 1x IKEA LED driver (Zigbee) - but in my living room it unfortunately does not work - 2x MagicHome LED strips, 2x IKEA Tradfri bulbs (Zigbee), 1x IKEA LED driver (Zigbee) and 1x IKEA Tradfri bulb group consisting of 3x IKEA Tradfri light bulbs (Zigbee Group).

The only difference is the group in question. I will share the two desired scenes from scenes.yaml below:

Scene "Wohnbeleuchtung" ```yaml - id: '1708707387914' name: Wohnbeleuchtung entities: light.wohnzimmer_decke_licht: supported_color_modes: - brightness color_mode: brightness brightness: 26 off_with_transition: false off_brightness: icon: mdi:ceiling-light friendly_name: Wohnzimmer Decke supported_features: 40 state: 'on' light.wohnzimmer_fernseherleuchte: effect_list: - blue_fade - blue_strobe - colorjump - colorloop - colorstrobe - cyan_fade - cyan_strobe - cycle_rgb - cycle_seven_colors - gb_cross_fade - green_fade - green_strobe - purple_fade - purple_strobe - rb_cross_fade - red_fade - red_strobe - rg_cross_fade - rgb_cross_fade - white_fade - white_strobe - yellow_fade - yellow_strobe - random supported_color_modes: - rgb effect: color_mode: rgb brightness: 255 hs_color: - 194.118 - 100 rgb_color: - 0 - 195 - 255 xy_color: - 0.146 - 0.245 ip_address: 10.0.0.22 icon: mdi:television friendly_name: Wohnzimmer Fernseherleuchte supported_features: 36 state: 'on' light.wohnzimmer_tischleuchte_licht: min_color_temp_kelvin: 2202 max_color_temp_kelvin: 4000 min_mireds: 250 max_mireds: 454 supported_color_modes: - color_temp color_mode: color_temp brightness: 89 color_temp_kelvin: 3067 color_temp: 326 hs_color: - 27.718 - 55.105 rgb_color: - 255 - 179 - 114 xy_color: - 0.49 - 0.382 off_with_transition: false off_brightness: icon: mdi:lamp friendly_name: Wohnzimmer Tischleuchte supported_features: 40 state: 'on' light.kueche_kuechenleuchte_licht: supported_color_modes: - brightness color_mode: brightness brightness: 254 off_with_transition: false off_brightness: icon: mdi:led-strip friendly_name: Küche Küchenleuchte supported_features: 40 state: 'on' light.kuchen_decke: min_color_temp_kelvin: 2202 max_color_temp_kelvin: 4000 min_mireds: 250 max_mireds: 454 supported_color_modes: - color_temp color_mode: brightness: color_temp_kelvin: color_temp: hs_color: rgb_color: xy_color: off_with_transition: false off_brightness: icon: mdi:ceiling-light friendly_name: Küche Decke supported_features: 40 state: 'off' icon: mdi:sofa metadata: light.wohnzimmer_decke_licht: entity_only: true light.wohnzimmer_fernseherleuchte: entity_only: true light.wohnzimmer_tischleuchte_licht: entity_only: true light.kueche_kuechenleuchte_licht: entity_only: true light.kuchen_decke: entity_only: true ```
Scene "Standardbeleuchtung Blau" ```yaml - id: '1708719166649' name: Standardbeleuchtung Blau entities: light.schlafzimmer_bettleuchte: effect_list: - blue_fade - blue_strobe - colorjump - colorloop - colorstrobe - cyan_fade - cyan_strobe - cycle_rgb - cycle_seven_colors - gb_cross_fade - green_fade - green_strobe - purple_fade - purple_strobe - rb_cross_fade - red_fade - red_strobe - rg_cross_fade - rgb_cross_fade - white_fade - white_strobe - yellow_fade - yellow_strobe - random supported_color_modes: - rgb effect: color_mode: rgb brightness: 255 hs_color: - 193.647 - 100 rgb_color: - 0 - 197 - 255 xy_color: - 0.146 - 0.248 ip_address: 10.0.0.21 icon: mdi:bed friendly_name: Schlafzimmer Bettleuchte supported_features: 36 state: 'on' light.schlafzimmer_monitorleuchte: effect_list: - blue_fade - blue_strobe - colorjump - colorloop - colorstrobe - cyan_fade - cyan_strobe - cycle_rgb - cycle_seven_colors - gb_cross_fade - green_fade - green_strobe - purple_fade - purple_strobe - rb_cross_fade - red_fade - red_strobe - rg_cross_fade - rgb_cross_fade - white_fade - white_strobe - yellow_fade - yellow_strobe - random supported_color_modes: - rgb effect: color_mode: rgb brightness: 255 hs_color: - 193.647 - 100 rgb_color: - 0 - 197 - 255 xy_color: - 0.146 - 0.248 ip_address: 10.0.0.20 icon: mdi:monitor friendly_name: Schlafzimmer Monitorleuchte supported_features: 36 state: 'on' light.schlafzimmer_bildschirmleuchte: effect_list: - blue_fade - blue_strobe - colorjump - colorloop - colorstrobe - cyan_fade - cyan_strobe - cycle_rgb - cycle_seven_colors - gb_cross_fade - green_fade - green_strobe - purple_fade - purple_strobe - rb_cross_fade - red_fade - red_strobe - rg_cross_fade - rgb_cross_fade - white_fade - white_strobe - yellow_fade - yellow_strobe - random supported_color_modes: - rgb effect: color_mode: rgb brightness: 255 hs_color: - 193.647 - 100 rgb_color: - 0 - 197 - 255 xy_color: - 0.146 - 0.248 ip_address: 10.0.0.25 icon: mdi:monitor friendly_name: Schlafzimmer Bildschirmleuchte supported_features: 36 state: 'on' light.schlafzimmer_decke_licht: supported_color_modes: - brightness color_mode: brightness brightness: 26 off_with_transition: false off_brightness: icon: mdi:ceiling-light friendly_name: Decke supported_features: 40 state: 'on' light.schlafzimmer_nachtleuchte_licht: supported_color_modes: - brightness color_mode: brightness brightness: 178 off_with_transition: false off_brightness: icon: mdi:lamp friendly_name: Schlafzimmer Nachtleuchte supported_features: 40 state: 'on' light.schlafzimmer_schrankleuchte_licht: supported_color_modes: - brightness color_mode: brightness brightness: 204 off_with_transition: false off_brightness: icon: mdi:outdoor-lamp friendly_name: Schlafzimmer Schrankleuchte supported_features: 40 state: 'on' icon: mdi:desk metadata: light.schlafzimmer_bettleuchte: entity_only: true light.schlafzimmer_monitorleuchte: entity_only: true light.schlafzimmer_bildschirmleuchte: entity_only: true light.schlafzimmer_decke_licht: entity_only: true light.schlafzimmer_nachtleuchte_licht: entity_only: true light.schlafzimmer_schrankleuchte_licht: entity_only: true ```

Regarding the corresponding devices and attributes, I am not quite sure if this is correct/helps, it should be noted that the device that contains the entity for the Zigbee group also contains other Zigbee groups that do not belong to the scenes (this is where I suspect an "error").

Entity attributes for "Wohnbeleuchtung" \ **light.wohnzimmer_decke_licht** - supported_color_modes: brightness - color_mode: null - brightness: null - off_with_transition: false - off_brightness: 26 - icon: mdi:ceiling-light - friendly_name: Wohnzimmer Decke - supported_features: 40 **light.wohnzimmer_fernseherleuchte** - effect_list: blue_fade, blue_strobe, colorjump, colorloop, colorstrobe, cyan_fade, cyan_strobe, cycle_rgb, cycle_seven_colors, gb_cross_fade, green_fade, green_strobe, purple_fade, purple_strobe, rb_cross_fade, red_fade, red_strobe, rg_cross_fade, rgb_cross_fade, white_fade, white_strobe, yellow_fade, yellow_strobe, random - supported_color_modes: rgb - effect: null - color_mode: null - brightness: null - hs_color: null - rgb_color: null - xy_color: null - ip_address: 10.0.0.22 - icon: mdi:television - friendly_name: Wohnzimmer Fernseherleuchte - supported_features: 36 **light.wohnzimmer_tischleuchte_licht** - min_color_temp_kelvin: 2202 - max_color_temp_kelvin: 4000 - min_mireds: 250 - max_mireds: 454 - supported_color_modes: color_temp - color_mode: null - brightness: null - color_temp_kelvin: null - color_temp: null - hs_color: null - rgb_color: null - xy_color: null - off_with_transition: false - off_brightness: 89 - icon: mdi:lamp - friendly_name: Wohnzimmer Tischleuchte - supported_features: 40 **light.kueche_kuechenleuchte_licht** - supported_color_modes: brightness - color_mode: brightness - brightness: 254 - off_with_transition: false - off_brightness: null - icon: mdi:led-strip - friendly_name: Küche Küchenleuchte - supported_features: 40 **light.kuchen_decke** (This is the Zigbee group) - min_color_temp_kelvin: 2202 - max_color_temp_kelvin: 4000 - min_mireds: 250 - max_mireds: 454 - supported_color_modes: color_temp - color_mode: null - brightness: null - color_temp_kelvin: null - color_temp: null - hs_color: null - rgb_color: null - xy_color: null - off_with_transition: false - off_brightness: null - icon: mdi:ceiling-light - friendly_name: Küche Decke - supported_features: 40
Entity attributes for "Standardbeleuchtung Blau" \ **light.schlafzimmer_bettleuchte** - effect_list: blue_fade, blue_strobe, colorjump, colorloop, colorstrobe, cyan_fade, cyan_strobe, cycle_rgb, cycle_seven_colors, gb_cross_fade, green_fade, green_strobe, purple_fade, purple_strobe, rb_cross_fade, red_fade, red_strobe, rg_cross_fade, rgb_cross_fade, white_fade, white_strobe, yellow_fade, yellow_strobe, random - supported_color_modes: rgb - effect: null - color_mode: null - brightness: null - hs_color: null - rgb_color: null - xy_color: null - ip_address: 10.0.0.21 - icon: mdi:bed - friendly_name: Schlafzimmer Bettleuchte - supported_features: 36 **light.schlafzimmer_monitorleuchte** - effect_list: blue_fade, blue_strobe, colorjump, colorloop, colorstrobe, cyan_fade, cyan_strobe, cycle_rgb, cycle_seven_colors, gb_cross_fade, green_fade, green_strobe, purple_fade, purple_strobe, rb_cross_fade, red_fade, red_strobe, rg_cross_fade, rgb_cross_fade, white_fade, white_strobe, yellow_fade, yellow_strobe, random - supported_color_modes: rgb - effect: null - color_mode: rgb - brightness: 255 - hs_color: 192.941, 100 - rgb_color: 0, 200, 255 - xy_color: 0.147, 0.253 - ip_address: 10.0.0.20 - icon: mdi:monitor - friendly_name: Schlafzimmer Monitorleuchte - supported_features: 36 **light.schlafzimmer_bildschirmleuchte** - effect_list: blue_fade, blue_strobe, colorjump, colorloop, colorstrobe, cyan_fade, cyan_strobe, cycle_rgb, cycle_seven_colors, - gb_cross_fade, green_fade, green_strobe, purple_fade, purple_strobe, rb_cross_fade, red_fade, red_strobe, rg_cross_fade, rgb_cross_fade, white_fade, white_strobe, yellow_fade, yellow_strobe, random - supported_color_modes: rgb - effect: null - color_mode: null - brightness: null - hs_color: null - rgb_color: null - xy_color: null - ip_address: 10.0.0.25 - icon: mdi:monitor - friendly_name: Schlafzimmer Bildschirmleuchte - supported_features: 36 **light.schlafzimmer_decke_licht** - supported_color_modes: brightness - color_mode: null - brightness: null - off_with_transition: false - off_brightness: 26 - icon: mdi:ceiling-light - friendly_name: Schlafzimmer Decke - supported_features: 40 **light.schlafzimmer_nachtleuchte_licht** - supported_color_modes: brightness - color_mode: null - brightness: null - off_with_transition: false - off_brightness: 178 - icon: mdi:lamp - friendly_name: Schlafzimmer Nachtleuchte - supported_features: 40 **light.schlafzimmer_schrankleuchte_licht** - supported_color_modes: brightness - color_mode: null - brightness: null - off_with_transition: false - off_brightness: 204 - icon: mdi:wardrobe - friendly_name: Schlafzimmer Schrankleuchte - supported_features: 40

And finally, here is the hierarchy of devices and entities:

Hierarchy of Devices ( Area -> Device -> Entity ) ```yaml Schlafzimmer: Schlafzimmer Bettleuchte: - light.schlafzimmer_bettleuchte Schlafzimmer Monitorleuchte: - light.schlafzimmer.monitorleuchte Schlafzimmer Bildschirmleuchte: - light.schlafzimmer_bildschirmleuchte Schlafzimmer Nachtleuchte: - light.schlafzimmer_nachtleuchte_licht Schlafzimmer Schrankleuchte: - light.schlafzimmer_schrankleuchte_licht Wohnzimmer: Wohnzimmer Decke: - light.wohnzimmer_decke_licht Wohnzimmer Fernseherleuchte: - light.wohnzimmer_fernseherleuchte Wohnzimmer Tischleuchte: - light.wohnzimmer_tischleuchte_licht Küche: Küche Küchenleuchte: - light.kueche_kuechenleuchte_licht No_Area: Sonoff Stick: - light.kuechen_decke ```
hugobloem commented 2 months ago

From your scene files, are all light.*leuchte zigbee groups? If so, these should work as any other light entity.

When you say stateful scenes do not work for the living room do you mean that it doesn't turn on or off the lights as desired, or does it not infer whether the scene is turned on?

vJan00 commented 2 months ago

Only the ´light.kuchen_decke´ is a Zigbee group.

Statefulscenes does turn the desired scene on or off but then immediately shows the scene as "off" even if it just has turned it on. Same thing when i manualy do turn it on via Hass.

hugobloem commented 2 months ago

I think this is a ZHA issue: https://github.com/home-assistant/core/issues/42830