zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

MINI-ZBDIM does not work properly when setup with single button (momentary)

Open papperone opened this issue 4 months ago • 15 comments

What happened?

When the device is setup as momentary and connected to a single button (L - S1) the button can turn ON the load (short press), dimmer it up and down (long press) but it will never goes to OFF with again short press. The only way to turn it off is to long press and hold it until brightness is 1%. from the Z2M GUI (or Home Assistant) I can toggle ON and OFF without any problem.

What did you expect to happen?

toggle ON/OFF the load with short press not just ON when OFF and never OFF when ON

How to reproduce it (minimal and precise)

as said, short press from OFF turn the device ON but then there's no way to turn if OFF with short press

Zigbee2MQTT version

2.12.1

Adapter firmware version

7.4.5 [GA]

Adapter

Sonoff Dongle MAX Pro

Setup

Zigbee2MQTT on his own LXC container, ProxMox server; Home Assistant is on a VM on the same ProxMox server but it's irrelevant for the issue I have

Device database.db entry

{"id":102,"type":"Router","ieeeAddr":"0xf044d3fffef388c7","nwkAddr":62703,"manufId":4742,"manufName":"SONOFF","powerSource":"Mains (single phase)","modelId":"MINI-ZBDIM","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":257,"inClusterList":[0,3,4,5,6,8,2820,2821,64599,64529],"outClusterList":[25],"clusters":{"genOnOff":{"attributes":{"onOff":0,"startUpOnOff":0}},"genLevelCtrl":{"attributes":{"currentLevel":0}},"genBasic":{"attributes":{"modelId":"MINI-ZBDIM","manufacturerName":"SONOFF","powerSource":1,"zclVersion":8,"appVersion":0,"stackVersion":0,"hwVersion":0,"dateCode":"20251205","swBuildId":"1.0.5"}},"haElectricalMeasurement":{"attributes":{"rmsVoltage":0,"rmsCurrent":0,"activePower":0}},"customClusterEwelink":{"attributes":{"17":"\u0004\u0005\u0005\u0010\u0001\u0001\u0002","33":0,"16388":0,"16389":0,"networkLed":1,"calibrationStatus":3,"transitionTime":10,"externalTriggerMode":1,"delayedPowerOnState":0,"minBrightnessThreshold":33,"maxBrightnessThreshold":255,"dimmingLightRate":3,"levelForCalibration":0,"acCurrentCurrentValue":0,"acCurrentVoltageValue":220860,"acCurrentPowerValue":90,"delayedPowerOnTime":1,"calibrationProgress":100,"setCalibrationAction":"\u0001\u0001\u0001","faultCode":84017152}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x449fdafffe99f68a","endpointID":1},{"cluster":8,"type":"endpoint","deviceIeeeAddress":"0x449fdafffe99f68a","endpointID":1},{"cluster":64529,"type":"endpoint","deviceIeeeAddress":"0x449fdafffe99f68a","endpointID":1}],"configuredReportings":[{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":65000,"repChange":1},{"cluster":8,"attrId":0,"minRepIntval":5,"maxRepIntval":65000,"repChange":1},{"cluster":64529,"attrId":28678,"minRepIntval":10,"maxRepIntval":65000,"repChange":0}],"meta":{"onLevelSupported":false}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":0,"stackVersion":0,"hwVersion":0,"dateCode":"20251205","swBuildId":"1.0.5","zclVersion":8,"interviewCompleted":true,"interviewState":"SUCCESSFUL","meta":{"configured":"0.0.0"},"lastSeen":1783791361182}

Debug log

No response

Notes

No response

papperone avatar Jul 11 '26 17:07 papperone

This seems like a device issue, so please contact Sonoff cc @cubez2mdeveloper

andrei-lazarov avatar Jul 12 '26 02:07 andrei-lazarov

This seems like a device issue, so please contact Sonoff cc @CubeZ2mDeveloper

I did but while searching for hints I saw that ZHA users have similar issue that seems had been solved with a quirk but I'm not that expert to understand more than this...

papperone avatar Jul 12 '26 10:07 papperone

Can you link that?

andrei-lazarov avatar Jul 12 '26 11:07 andrei-lazarov

Can you link that?

here it is https://community.home-assistant.io/t/sonoff-mini-zbdim-with-momentary-switch-in-zha-only-dims-one-way/1014470

papperone avatar Jul 12 '26 11:07 papperone

Hi @papperone ,

Thank you for reporting this issue and for providing the detailed description.

We have received your feedback regarding the MINI-ZBDIM toggle behavior when used with a single momentary switch. Our team will arrange to reproduce this issue on our side and investigate the root cause.

We will update this thread once we have any progress. In the meantime, please feel free to share any additional information that may help with the investigation.

Thanks again for your patience and for helping us improve the product.

CubeZ2mDeveloper avatar Jul 13 '26 07:07 CubeZ2mDeveloper

Hi @papperone ,

We've completed our investigation and would like to provide an update.

Please note that Single Push Button (1-way momentary switch) mode cannot be selected by triple-pressing the device button.

As described in our official documentation:

"Single Push Button (1-way momentary switch): setup via eWeLink or Home Assistant only; device button not supported."

This can be found in the MINI DIM FAQ, Section 6 – What types of external switches are compatible and how to control the device using external switches?, under the Note section:

https://help.sonoff.tech/docs/wl1jzfUJ

In Zigbee2MQTT, please set External trigger mode to pulse. Once configured:

  • Short press: Toggle the light On/Off
  • Long press: Adjust the brightness (brighten/dim)

This is the expected behavior for the Single Push Button mode.

If the issue still persists after setting External trigger mode to pulse, please let us know. We'll be happy to continue investigating and assist you further.

Thank you for your patience and support.

CubeZ2mDeveloper avatar Jul 15 '26 09:07 CubeZ2mDeveloper

I have this issues as well. I tried to select External trigger mode to pulse in Z2M. Also I use dev mode. Write to it [27.08.2026, 00:19:45] zhc:tz: Wrote '{"externalTriggerMode":1}' to 'customClusterEwelink' and read from it [27.08.2026, 00:20:08] zhc:tz: Read result of 'customClusterEwelink': {"externalTriggerMode":1} But when I push switch I can tun ON. When I press again it just going down to 1% and stay at 1%, I have two MINI-ZBDIM and they behave exactly.

Firmware ID 1.0.5 20251205 Firmware version 4101

PS. Looks like we have inverted polarity here(So in my case momentary switch NO but looks like firmware expect NC). Will test a little bit more later.

a1ien avatar Aug 26 '26 21:08 a1ien

I have this issues as well. I tried to select External trigger mode to pulse in Z2M. Also I use dev mode. Write to it [27.08.2026, 00:19:45] zhc:tz: Wrote '{"externalTriggerMode":1}' to 'customClusterEwelink' and read from it [27.08.2026, 00:20:08] zhc:tz: Read result of 'customClusterEwelink': {"externalTriggerMode":1} But when I push switch I can tun ON. When I press again it just going down to 1% and stay at 1%, I have two MINI-ZBDIM and they behave exactly.

Firmware ID 1.0.5 20251205 Firmware version 4101

PS. Looks like we have inverted polarity here(So in my case momentary switch NO but looks like firmware expect NC). Will test a little bit more later.

Hi @a1ien ,

Thank you for the additional report.

We performed another test on our side using the MINI-ZBDIM with a single momentary button and External trigger mode set to Pulse, but we are still unable to reproduce the issue.

In our test, the behavior was as expected:

  • First short press: OFF → ON, with brightness changing from 0 to 191.
  • Second short press: ON → OFF, with brightness changing from 191 back to 0.
  • The device remained OFF afterwards and did not enter the dimming state.

For reference, the relevant log from our test is:

[2026-08-27 15:47:43] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xbc8d7efffe22254d', payload '{"brightness":0,...,"external_trigger_mode":"pulse",...,"state":"OFF",...}'

[2026-08-27 15:47:45] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xbc8d7efffe22254d', payload '{"brightness":0,...,"external_trigger_mode":"pulse",...,"state":"ON",...}'

[2026-08-27 15:47:45] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xbc8d7efffe22254d', payload '{"brightness":191,...,"external_trigger_mode":"pulse",...,"state":"ON",...}'

[2026-08-27 15:47:52] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xbc8d7efffe22254d', payload '{"brightness":191,...,"external_trigger_mode":"pulse",...,"state":"OFF",...}'

[2026-08-27 15:47:52] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xbc8d7efffe22254d', payload '{"brightness":0,...,"external_trigger_mode":"pulse",...,"state":"OFF",...}'

The device was running firmware 1.0.5 (4101) during this test.

Could you please provide the full Zigbee2MQTT log covering both the first and second button presses when the issue occurs? It would also be helpful if you could share the exact wiring/setup of the external momentary switch.

This will help us compare the device behavior and determine why it differs between our test environment and yours.

Thank you for your help with the investigation.

CubeZ2mDeveloper avatar Aug 27 '26 07:08 CubeZ2mDeveloper

Hi @CubeZ2mDeveloper,

As I mentioned, it looks like I found the problem. What type of momentary switch are you using? My button is NO (Normally Open).

When I use an NC (Normally Closed) momentary button, everything works as expected.

So, if I understand correctly, the momentary switch is expected to generate a pulse by interrupting the Live connection (Live → disconnected). Is that how it is supposed to work?

I’m asking because most momentary wall switches are Normally Open (NO), meaning they generate a pulse by connecting the Live line (disconnected → Live) when pressed.

a1ien avatar Aug 27 '26 07:08 a1ien

Thank you for the additional information. This is indeed interesting.

We have checked our test setup again, and we are also using a NO (Normally Open) momentary switch, with the following behavior:

  • Normally: disconnected
  • Button pressed: disconnected → Live
  • Button released: Live → disconnected

The wiring is also connected according to the official MINI-ZBDIM wiring diagram provided by SONOFF.

With this setup and External trigger mode set to Pulse, everything works as expected in our testing: the first press turns the light ON, and the second press turns it OFF normally, with the brightness changing accordingly.

Since you have found that using an NC (Normally Closed) switch works correctly on your side, that's useful information. If you are willing to share it, the debug log from the NO switch when the issue occurred would be helpful for us to compare with our test results.

For reference, our wiring follows the official SONOFF documentation:

MINI-ZBDIM – SONOFF Help Center

Thank you again for sharing your findings.

CubeZ2mDeveloper avatar Aug 27 '26 09:08 CubeZ2mDeveloper

[27/08/2026, 12:34:07] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":0,"calibration_progress":100,"calibration_status":"calibrated","current":0,"delayed_power_on_state":false,"delayed_power_on_time":54,"dimmer_transition_time":0,"dimming_light_rate":"5x","external_trigger_mode":"edge","level_for_calibration":0,"linkquality":180,"max_brightness_threshold":94,"min_brightness_threshold":19,"power":0.09,"power_on_behavior":"previous","set_calibration_action":"start","state":"OFF",,"voltage":225.12}'
Initial state


[27/08/2026, 12:34:07] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":0,"external_trigger_mode":"edge","power":0.09,"state":"OFF","voltage":225.12}'

[27/08/2026, 12:34:32] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":0,"external_trigger_mode":"pulse","power":0.09,"state":"OFF","voltage":225.12}' # change to pulse

[27/08/2026, 12:34:51] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":0,"external_trigger_mode":"pulse","power":0.09,"state":"ON","voltage":225.12}' # toggele momentary switch

[27/08/2026, 12:34:51] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":255,"external_trigger_mode":"pulse","power":0.09,"state":"ON","voltage":225.12}' 

[27/08/2026, 12:34:52] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":255,"current":0.04,"external_trigger_mode":"pulse","state":"ON","voltage":225.12}'

[27/08/2026, 12:34:54] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":255,"current":0.04,"external_trigger_mode":"pulse","power":7.21,"state":"ON","voltage":224.78}'

[27/08/2026, 12:34:57] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":255,"current":0.04,"external_trigger_mode":"pulse","state":"ON","voltage":224.78}'

[27/08/2026, 12:34:57] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":255,"current":0.1,"external_trigger_mode":"pulse","power":7.21,"state":"ON","voltage":224.78}' 
 
[27/08/2026, 12:35:00] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.1,"external_trigger_mode":"pulse","state":"ON","voltage":224.78}' # toggle again
 
[27/08/2026, 12:35:02] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.06,"external_trigger_mode":"pulse","state":"ON","voltage":224.78}' 

[27/08/2026, 12:35:02] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.06,"external_trigger_mode":"pulse","power":11.77,"state":"ON","voltage":224.78}'

[27/08/2026, 12:35:03] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.06,"external_trigger_mode":"pulse","power":11.77,"state":"ON","voltage":225.58}'

[27/08/2026, 12:35:07] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.02,"external_trigger_mode":"pulse","power":11.77,"state":"ON","voltage":225.58}' # togle again

[27/08/2026, 12:35:08] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.02,"external_trigger_mode":"pulse","power":1.23,"state":"ON","voltage":225.47}'

[27/08/2026, 12:35:10] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":255,"current":0.02,"external_trigger_mode":"pulse","power":1.23,"state":"ON","voltage":225.47}'

[27/08/2026, 12:35:12] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":255,"current":0.07,"external_trigger_mode":"pulse","power":1.23,"state":"ON","voltage":225.47}'

[27/08/2026, 12:35:12] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":255,"current":0.07,"external_trigger_mode":"pulse","power":13.85,"state":"ON","voltage":225.47}'

[27/08/2026, 12:35:12] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":255,"current":0.07,"external_trigger_mode":"pulse","power":13.85,"state":"ON","voltage":225.93}'

[27/08/2026, 12:35:16] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.07,"external_trigger_mode":"pulse","power":13.85,"state":"ON","voltage":225.93}'

[27/08/2026, 12:35:17] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.08,"external_trigger_mode":"pulse","power":13.85,"state":"ON","voltage":225.93}'

[27/08/2026, 12:35:17] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.08,"external_trigger_mode":"pulse","power":13.85,"state":"ON","voltage":225.93}'

[27/08/2026, 12:35:18] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.08,"external_trigger_mode":"pulse","power":13.85,"state":"ON","voltage":225.93}'

[27/08/2026, 12:35:19] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.08,"external_trigger_mode":"pulse","power":17.59,"state":"ON","voltage":225.7}'

[27/08/2026, 12:35:22] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.08,"external_trigger_mode":"pulse","power":1.23,"state":"ON","voltage":225.7}'

[27/08/2026, 12:35:22] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.02,"external_trigger_mode":"pulse","power":1.23,"state":"ON","voltage":225.7}'

[27/08/2026, 12:35:23] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.02,"external_trigger_mode":"pulse","power":1.23,"state":"ON","voltage":224.89}' # switch to enge mode again

[27/08/2026, 12:35:24] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.02,"external_trigger_mode":"edge","power":1.23,"state":"ON","voltage":224.89}'

[27/08/2026, 12:35:27] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.02,"external_trigger_mode":"edge","power":1.22,"state":"ON","voltage":225.35}'

[27/08/2026, 12:35:28] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":1,"current":0.02,"external_trigger_mode":"edge","power":1.22,"state":"OFF","voltage":225.35}'

[27/08/2026, 12:35:31] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":0,"current":0.02,"external_trigger_mode":"edge","power":1.22,"state":"OFF","voltage":225.35}'

[27/08/2026, 12:35:32] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":0,"external_trigger_mode":"edge","power":1.22,"state":"OFF","voltage":225.35}'

[27/08/2026, 12:35:32] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":0,"external_trigger_mode":"edge","power":0.48,"state":"OFF","voltage":225.35}'

[27/08/2026, 12:35:33] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Living_room_1', payload '{"brightness":0,"external_trigger_mode":"edge","power":0.48,"state":"OFF","voltage":225.35}'

Do we need power cycle after we change from edge to pulse

I have wall switch that I can convert from edge to momentary by using spring. And currently it used without spring so i simulate momentary switch manually.

I can try to do power cycle after switching from edge to pulse.

Can confirm that you need do power cycle after you switch from edge to pulse. After that MINI-ZBDIM work as expected

a1ien avatar Aug 27 '26 09:08 a1ien

Thank you for the detailed testing and logs.

We were able to reproduce a similar behavior when using an NC (Normally Closed) momentary switch.

Just to clarify the terminology:

  • NO (Normally Open): the circuit is normally disconnected. When the button is pressed, the circuit becomes connected to Live. When the button is released, it returns to the disconnected state.
  • NC (Normally Closed): the circuit is normally connected to Live. When the button is pressed, the circuit is disconnected from Live. When the button is released, it returns to the connected state.

In our testing, the NC momentary switch can cause the MINI-ZBDIM to enter the dimming behavior instead of performing the expected ON/OFF toggle. This can result in the light remaining ON after a subsequent press.

This is consistent with the behavior described in the official SONOFF documentation for the Single Push Button (1-Way Momentary Switch):

S1 or S2: Short press to turn on/off (at preset brightness) Press and hold to brighten on the first use, and press and hold again to dim.

[MINI-ZBDIM – SONOFF Help Center (FAQ)](https://help.sonoff.tech/docs/wl1jzfUJ#FAQ)

Therefore, we recommend using a NO (Normally Open) momentary switch with the MINI-ZBDIM. This should avoid unintentionally triggering the dimming behavior and provide the expected short-press ON/OFF operation.

Thank you again for sharing your findings and helping us investigate this behavior.

CubeZ2mDeveloper avatar Aug 28 '26 07:08 CubeZ2mDeveloper

Thank you for the response. As I said, I have a NO (Normally Open) momentary switch, and I also expect NO to be the correct type of switch.

However, as I mentioned in my previous message, there is another important detail: if you switch the External trigger mode from edge to pulse without disconnecting the device from mains power, you get this weird behavior.

I can confirm that you need to disconnect the device from mains power and power it on again after changing from edge to pulse. After a full power cycle, the MINI-ZBDIM works as expected.

So it seems that simply changing the setting from edge to pulse is not enough while the device remains powered. The new mode only starts working correctly after a full mains power cycle.

a1ien avatar Aug 28 '26 07:08 a1ien

Thank you for the response. As I said, I have a NO (Normally Open) momentary switch, and I also expect NO to be the correct type of switch.

However, as I mentioned in my previous message, there is another important detail: if you switch the External trigger mode from edge to pulse without disconnecting the device from mains power, you get this weird behavior.

I can confirm that you need to disconnect the device from mains power and power it on again after changing from edge to pulse. After a full power cycle, the MINI-ZBDIM works as expected.

So it seems that simply changing the setting from edge to pulse is not enough while the device remains powered. The new mode only starts working correctly after a full mains power cycle.

thanks, I'm sure I've tried a full power cycle after changing the switch type, no luck on my side; I've ordered a second unit to test, exactly the same behavior so I've returned both and bought a MOES dimmer that worked as a charm immediately after wiring it in the same way as the sonoff were wired; for me this time it's a big disappointment with this sonoff device, it should not be so complicated to setup a dimmer switch, like my experience with the MOES device I have now and I'm happy with !!

papperone avatar Aug 29 '26 13:08 papperone

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Oct 29 '26 00:10 github-actions[bot]