Zigbee2mqtt lighting Group: How to Dim, Maintaining Relative Device Brightness Levels

Reading the zigbee2mqtt documentation I am trying to clarify a few quick items for use in HA, any help would be great :slight_smile:

  1. In zigbee2mqtt (“z2m”) I’d like to create a z2m “Group” of lights and with different brightness per light. Can those device-specific brightness levels be set when creating the z2m Group, or, do device specifics have to be done as a z2m “Scene” (which has the Group inside it) [so far we are in z2m addon not yet HA]? In the z2m Group or the Scene config documentation, I didn’t see where the member device-specifics e.g. brightness, get set.
  2. Assuming the above z2m Group (and Scene if needed), were multiple devices have individual preset brightness levels when the Group(/Scene?) is turned on/off…Next question becomes: If one wants to brighten/dim or change the brightness value of the z2m Group/Scene as a whole, can this be done by sending a command to the z2m Group/Scene to e.g. dim or be at some brightness value less than 100% (to the Group not changing the relative brightness levels of the separate devices). Example: A group w 10 lights. When it turns On: 3 devices are at 30%, 3 are at 70% and 4 are at 100%. Now, Dim/set the Group to 50%. Thus 3 go to 15%, 3 go to 35% and 4 go to 50%, i.e. the z2m Group Dims as a whole, maintaining the relative values of the devices within it. How is this dimming done? If so is this done in z2m on in HA?
  3. Finally, if I want to expose that z2m Group Dimming (or set Group to brightness X) command to HomeAssistant, to yield the equivalent of a dimmer-switch in HA to brighten/dim z2m Group, how would one do that?

For context, I use ISY for Insteon lights and can use a physical keypad-buttons that do on/off dim/brighten for a scene (group of lights). In Scene on creation on ISY the relative On light values are preset for each device. When I dim via the KP button they all dim but keep their relative levels. I want to do this with zigbee (or zwave) and control from both a physical dimmer and virtually in HA, (and then via: “Alexa set Light Scene Dinner to 80%”)

Any guidance for any parts of this would be great.

Thank

One thing that might help. ZigBee groups are not the same thing as a scene/helper group. A ZigBee group allows you to group devices and then use ZigBee group commands to control the group as a single instance. It’s more of a timing/efficiency thing (since one command is sent to the group for each action instead of one command per device).

It sounds like your use cases all revolve around using scenes (preset options per device) and helper groups. Scenes and helper groups are both done in HA, not in Z2M.

Hi @FriedCheese

I actually specifically want to use the native zigbee groups, not HA groups/scenes for as much of this as possible, because then only a single HA command is sent to the native zigbee group vs a HA group/scene (not sure which they are called), which would send separate commands to each device in the group. Insteon native Scenes work like zigbee native Groups and dramatically cut down network traffic and resulting delays/pops etc.

Because I haven’t yet used zigbee2mqtt it is not clear to me 1) how to configure its native zigbee group such that each light has its own individual base-lighting-level per device when the group turns on, and then 2) if and how I can then dim that native group; and if that group-dimming would be done in z2mt or in HA, and how. The goal is to have minimum HA commands sent, but be able to end up with a “dimmer-switch” in HA that dims/brightens a native zigbee group created in z2m.

Thanks

My Z2M groups act exactly like scenes in that they remember the brightness and colour that was originally set when creating the group,

@jchh Excellent. Thanks for confirming that as I prepare to jump into z2m & HA…

So, as to Q2: can one then dim the z2m group as a whole, keeping the relative device brightness levels, ultimately with a “dimmer” switch in HA dashboard?

Thanks

No. Z2M groups act like HA scenes.

Edit: To be more specific, A Z2M scene set within a Z2M group acts like an HA scene.

Firstly, you create a group (of devices), then you create scenes for that group (that can act only on the devices that are in that group).
Devices can be in multiple groups.
Groups can have multiple scenes.

@jchh Im not sure I understand what you are saying. I’ll try to clarify my question…

You clarified that a z2m native zigbee group can be created with device-specific brightness levels. Excellent, this is just like what ISY does in making native “Insteon Scenes”.

The question is: can that z2m group later be dimmed (or brightness level specified) in HA, i.e. “Dim z2m group XYZ to 80%” and can a HA dimmer-switch/card be used to slide brightness up/down?

Thanks and sorry if you answered and I didnt understand.

Hi,

Sorry I am not being very clear.

No, I was incorrect in my original statement: Z2M groups do not act like HA scenes. I was clarifying that it is the Z2M scene within in a Z2M group that acts like an HA scene:

  • A Z2M group is just a group of stateless devices - nothing more.
  • A Z2M group’s scene contains a ‘snapshot’ of the group (state, brightness colour etc) in that group. A scene can be set and recalled.
  • A device can be in multiple Z2M groups.
  • A Z2M group can contain multiple Z2M scenes.

I don’t know about dimming/brightening the group using MQTT - sorry. You can check the docs and research for yourself though or maybe someone else that knows this better can comment.

I do know that the Z2M groups are visible in HA and I dim/brighten groups the ‘normal’ way (not using MQTT commands as I do to recall Z2M scenes):

      - service: light.toggle
        data:
          brightness_pct: 70
          transition: 1
        target:
          entity_id: light.hallway

In the above example, light.hallway is a Z2M group of 3 Hue bulbs. Does that help?

Hi Thanks, youre info is helpful

Ok, this is what I had thought looking at the z2m documentation.

Question: Do you know if when addressing a z2m scene, from HA, is there still only a single network command, or because the z2m scene tells each device in the group to have specific parameters, eg brightness, does HA (or m2q) now have to send separate commands to each device in the group. If so, that would remove a primary benefit of using groups…to reduce traffic, delay etc. Im hoping its still a single command at both the HA and the z2m levels to control scenes.

Ok, good…

  1. Q: Could you have a HA “dimmer-switch” type of a card on a dashboard so you can slide brigntness up/down of the z2m group?
  2. Q: If addressing a z2m scene from HA (vs a z2m group, in your example), can you specify brightness as shown in your example, or will HA not let you do that for a z2m scene?

I have ordered zigbee devices to test but don’t have then yet, Otherwise i would try this myself.

Thanks

Remember that a scene is a snapshot, so you only need one command to recall that scene. This is an example:

      - service: mqtt.publish
        data:
          topic_template: "zigbee2mqtt/lights/set"
          payload_template: "{"scene_recall": 1 }"
  • lights is my group name
  • 1 is my scene number

You can template it, so my scene recall script actually looks like this:

  set_z2m_scene:
    alias: 'Lights: Set Z2M scene'
    sequence:
      - service: mqtt.publish
        data:
          topic_template: "zigbee2mqtt/{{group}}/set"
          payload_template: "{{ payload }}"
    mode: queued
    icon: mdi:lamps

I believe so, per my code above. Perhaps someone else can verify this.

No. A scene is a snapshot. You either recall it or you don’t.