Button Mapping to Scenes [Home Assistant » Zigbee2MQTT]

Hello everyone! I just wired my Blue Series 2-1 Switch and I’m struggling to figure out how to map the custom buttons to scenes or actions via Home Assistant. So far I have:

  1. Connected the switch to Home Assistant via Zigbee2MQTT – the switch is setup as “Single Pole” with smartBulbMode disabled. (I was trying to get it to work with a non-Zigbee Hue Smart Bulb, but couldn’t and just replaced it with a dumb bulb instead)

  1. I am able to see the device in HA but I can’t tell how to map “double taps” “tripped taps” etc on to specific actions on HA.

  2. I tried looking at Automations on HA, but I don’t see device triggers for the various button configs, only the following in the screenshot:

If any of you guys have dealt with the HA / Zigbee2MQTT setup, mapping the various buttons to scenes or automations on HA, I’d love the help! :pray:

Thank you!

I also tried reading through the Scene Control guide, but it looks like it hasn’t been published yet!

Here’s your issue. “0 = no delay (Disables Button Press Events)”
You have a setting of 0. I find a good compromise to be around 300ms. It’s a fast double click but not too fast that the avg person won’t be able to do it, plus the delay is low enough that it’s not really noticeable when just turning the light on.

Change this setting, then go back to exactly where you were with your automations. You MAY have to physically make the double/triple/quad clicks on the switch before they update in HA.


Thank you so much MRobi! I gave this a shot and I’m seeing the extra button interactions as possible triggers.
Feb-11-2023 09-42-33

Somehow since yesterday though, the switch stopped responding to my dimmable bulb. I am able to turn the bulb on and off from the HA Zigbee state, but not from the actual switch.

I previously set the switch to Single-pole + Dimmer. I am curious if you see something else wrong in my Zigbee configuration, or if you could suggest anything else that might be causing this?

Additional config screenshots:

Or, I could create an HA automation to control the bulb the switch is wired to? That feels like a workaround :thinking:

Looks like you enabled local protection, which I believe will stop the switch from responding to anything “locally”/manually at the switch. The description of that is confusing in Z2M as it makes it sound like enabling it enables local control, but it’s actually the opposite.

This one right here. You’ve got localProtection Enabled.

I can see how the wording in the description can be a bit counter-intuitive if you only look at the description. “Ability to control switch from the wall”…“Enabled”. But what “Enabled” is doing here is enabling the localProtection which protects the switch from being controlled from the wall. So you want this Disabled.

That was it! You guys rock. Thank you so much for the help! :pray:

Last question, this setup works well with my regular “dumb bulb” but if I were to use a non-Zigbee Hue smart bulb connected to HA via a Phillips Hue Bridge, how should I configure the switch such that I can control the Hue bulb from the switch.

I tried two ways:

  1. Local protection: Disabled // outputMode: Dimmer // smartBulbMode: Enabled
    This leaves the Hue bulb on constantly without the ability to turn it off.

  2. Local protection: Enabled // outputMode: Dimmer // smartBulbMode: Enabled + An automation on HA to capture the action of each button.

Feb-12-2023 17-21-48

The issue with #2 is that the automation only works to turn the light off. Once the smart light is off, the actual switch seems to lose power and becomes unresponsive. It no longer registers “on” / up_single triggers once turned off, though it does while already on.

You want the switch config of #1 plus the automation from #2.

You’ll also want to add held triggers to the automation to control dimming of the bulb.

Best solution here would be to ditch the wifi/bluetooth bulb, get a zigbee equivalent and use binding.

1 Like

This has gotten me super close @MRobi, but somehow when I turn off the bulb I am unable to get it back on unless done via HA, but not via the switch. It’s as if the entire switch loses power once the smart bulb has been turned off. Here is a video of it, if that makes any sense: https://imgur.com/a/vI73019

Might have to get a Zigbee bulb or just stick to the bumb one!

Looks like you do not have smartbulb mode enabled.
To control any bulb that is not a zigbee bulb, smartbulb mode must be enabled and then you use an automation and scene control in HA to control the bulb.

With smartbulb mode off, the switch works by cutting power to the bulb to turn it off, then sending power to the bulb to turn it on. Smartbulb mode keeps power to the bulb at all times. Since the bulb is always powered, you then need an automation to control the bulb. So you’d use the “down_single” action as a trigger and then call the light.turn_off service on the bulb. And then the “up_single” action with a light.turn_on.

Because the bulb isn’t zigbee, this is the only way. The automation “translates” the zigbee command from the switch to (I’m assuming) a WiFi command the bulb can understand. Because of this, you will have a slight delay in turning the bulb on. The switch talks to the hub, the hub processes it, then the hub talks to the bulb. Ideally, you use a zigbee bulb and bind it to the switch. This way, since the switch and the bulb will both be talking zigbee, they can talk directly to each other bypassing the hub completely. This really is the best way to go. It will be much faster, and it will still work even if the hub is down.

Hmmm, this is what I have enabled:

:white_check_mark: SmartBulbMode = ON

:white_check_mark: LocalProtection = OFF

:white_check_mark: OutputMode = Dimmer

And yet get the following outcome: https://imgur.com/KaQnArr

Once the smart bulb is turned off, the switch seems to lose power. Is that possible? Not sure how to troubleshoot from here.

Thank you so much for your time @MRobi - you’ve helped me a lot already; we can call it here unless you have any other ideas!

Those look right. What’s your automation in HA look like? May be an issue in your coding there.

These are the triggers:

And the conditions:


That looks ok from the UI.
In the top right corner of the automation can you click the 3 dots and choose “edit in yaml” and post the yaml for the automation?

EDIT: My thought here is it may have something to do with turning on the device instead of the light entity. I believe that’s what I’m seeing here. It should work find turning on the device but it may be a weird quirk with the bulb.

Another thought, check the traces of the automation to make sure it’s actually firing when pressing the up button.

This is what the yaml looks like:

alias: Inovelli Kitchen ON/OFF (smart bulb)
description: ""
  - platform: device
    domain: mqtt
    device_id: 208409d534e313e18ec858b55cb69964
    type: action
    subtype: up_single
    discovery_id: 0x6c5cb1fffe570825 action_up_single
    id: kitchen-light-on
  - platform: device
    domain: mqtt
    device_id: 208409d534e313e18ec858b55cb69964
    type: action
    subtype: down_single
    discovery_id: 0x6c5cb1fffe570825 action_down_single
    id: kitchen-light-off
condition: []
  - choose:
      - conditions:
          - condition: trigger
            id: kitchen-light-on
          - type: turn_on
            device_id: 43aa4ea8c081b8cc21d75b0626812f39
            entity_id: light.hue_color_lamp_1
            domain: light
            brightness_pct: 100
      - conditions:
          - condition: trigger
            id: kitchen-light-off
          - type: turn_off
            device_id: 43aa4ea8c081b8cc21d75b0626812f39
            entity_id: light.hue_color_lamp_1
            domain: light
mode: single

None of the “turn on” events show up in the trace timeline, so it’s not even registering the attempt to turn the bulb back on.

OK, a few things you can try here if the turn on event isn’t showing up in the trace timeline for troubleshooting.

  1. Turn the switch off which should also turn the bulb off. See if you can still toggle the bulb on/off from the entity in home assistant while the switch is off. This will confirm that the switch is indeed in smart bulb mode
  2. change the trigger for on to “up_double” and see if you can get that to trigger an event. Obviously not permanent but just for test purposes.

It’s very odd — the switch is marked to Smart Bulb Mode:

But, when I turn off the bulb via the switch in HA the bulb doesn’t turn off:
Feb-20-2023 20-14-31

Is there any other way to force the switch into smart bulb mode? I just tried resetting the switch by pulling the power trigger beneath the switch and no luck! :confused: