Possible firmware bug sonoff M5ZB-2C-86W

Hi,

I’ve been experimenting with the Sonoff M5ZB-2C-86W to see if I can bind it directly to a Zigbee group containing lights, so the lights can be controlled without involving Home Assistant.

I think I may have run into a firmware bug.

For clarity, this is the exact switch model:

  • Sonoff M5ZB-2C-86W
  • Zigbee version
  • 2-gang switch
  • WITH neutral wire
  • 86mm x 86mm EU version
  • Firmware 1.0.6

The problem:
Only 1 of the 2 buttons works correctly with "detach relay" enabled.

Only the button using endpoint 2 can be directly bound to a lamp/group.

I’m using Zigbee2MQTT.

My experience:

Out of the box, the Sonoff M5 came with firmware 1.0.4 and "detach relay" did not work at all (I could not see any output clusters on endpoints 1 or 2), so updating to firmware 1.0.6 was required.

After the update, I enabled BOTH detach and clicked "Apply".

After that, I was only able to bind the right switch (source endpoint 2) to a lamp/group using only the "genOnOff" cluster without the internal relay switching as well.

For the left switch (source endpoint 1), it did not matter which cluster type or destination I used: the binding did not work correctly and the internal relay still switched on/off together with the button press.

After removing the M5 from Zigbee2MQTT, I performed a factory reset and paired it again.

This time, instead of enabling both detach relays together, I enabled them separately:

  • enable detach relay 1 -> Apply
  • enable detach relay 2 -> Apply

When testing the buttons on the M5 afterwards, I noticed that BOTH internal relays no longer switched, so detached relay mode was working correctly for both buttons.

This was BEFORE creating any bindings.

However, as soon as I use the "genOnOff" cluster on endpoint 1, the internal relay starts switching on/off again and the Zigbee binding itself stops working properly.

That seems to be where the actual problem is.

A workaround is to use the toggle state in a Home Assistant automation, but that is exactly what I’m trying to avoid :slight_smile:

Anyway, I’m not really expecting a solution here (that probably needs to come from Sonoff firmware), but I wanted to check if other people have had the same experience.

I’m definitely not an expert when it comes to Zigbee networks, so I’m not entirely sure how to properly troubleshoot this or where to start looking. Maybe I’m overlooking something obvious?

[UPDATE]

I performed the same test with the ZBM5-3C-80/86, the version with three switches, and I'm happy to report that the Zigbee bindings DO work on this model.

This three-switch version also had to be updated to firmware 1.0.6 first, and the "detach relay" toggles must be enabled one by one. In other words, do not enable them all at once and then click "confirm."

After configuring the bindings, I shut down Home Assistant, and the switches continued to control the lights correctly, so that's good news.

The test was carried out using two Philips Hue White A60 E27 bulbs and one Gledopto GL-D-003P Zigbee 6W Downlight RGB+CCT (Pro). For the Gledopto light, I believe the "Pro" version is important. I do not have a non-Pro model available for testing.

What I have not tested yet are groups and the ZBM5-1C with a single switch. If anyone has experience with the single-switch version, feel free to share it.

[Edit] So far, the "detach relay" feature does not work with groups. The Zigbee binding itself works, but the internal relay continues to switch on and off.

I have a similar issue:

I am using a ZBM5 with 1.0.6 firmware binding to 4 hue bulbs in a ceiling. When I press the button I want the 4 bulbs to come on/off together and it to continue to work if HA or the zigbee controller is down.

If I bind the ZBM5 to an individual bulb then everything works well (detached mode enabled, the relay stays on and the switch sends toggle to bulb every time the button is pressed).

However, if create a zigbee group with 1 or more of the hue bulbs and bind the ZBM5 to that group then the relay turns on/off with a press of the button even though detach mode is enabled and the switch is not part of the zigbee group. If I unbind the group, the relay stops turning on/off when the button is pressed. So it looks like a firmware bug that turns the relay on/off when bound to a zigbee group even though detach mode is enabled.

A workaround is to bind the ZBM5 to individual bulbs rather than a zigbee group as the ZBM5 can be bound to multiple devices. There is no noticeable delay so no “popcorn effect”.

This workaround is not perfect as it is possible for the bulbs to become out of sync with each other as the switch sends a toggle command to individual bound devices (this is an edge case as the direct bindings are very reliable). To reduce the probability of this, I created an HA automation that triggers when one bulb turns off to then turn the other bulbs off forcing them back in sync. This sync fix does help if HA / zigbee controller is down but it is a very low probability that bulbs are out of sync and HA is down so I can live with that!

Stupid question, but how can the sync fix HA automation possibly run if HA or zigbee is down?

It can not. But that's not really necessary. That automation is only needed IF the bulbs get out of sync, and it serves purely as a self-healing mechanism.

That said, the whole point of using 'direct bindings' is somewhat lost. :slightly_smiling_face:

Another drawback of binding every bulb individually is that it is less efficient than using Zigbee groups, as the switch has to send a separate command to each bulb instead of a single group command. With four bulbs this is negligible, but in our case we want to control four groups containing 6 to 14 bulbs each—around 30 bulbs in total—so managing and maintaining individual bindings becomes cumbersome.

In my case, the fact that the relay is still switching is not a problem, because our lights are not connected directly to the switch. They are wired straight to the breaker panel and therefore receive constant power.

Whether this can truly be called a 'bug' is also debatable, since nowhere in SONOFF's specifications does it explicitly state that Zigbee groups must work together with 'Detach Relay Mode'. At least, I haven't been able to find that anywhere in their documentation.