zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

SONOFF MINI-ZB2GS-L: `detach_relay_mode` briefly reported as DISABLE every ~18h, because endpoint 2 reports `detachRelayMode2: 0`

Open altessier-ai opened this issue 1 month ago β€’ 2 comments

What happened?

On a SONOFF MINI-ZB2GS-L (fw 1.0.4 / build 4100) with detach_relay_outlet1 and detach_relay_outlet2 set to ENABLE, Z2M publishes detach_relay_mode as DISABLE / DISABLE for 0 to 15 minutes, every ~18 h 12 min, then switches back to ENABLE by itself. The relay mode on the device never actually changes. This is a decoding problem.

The device sends two kinds of customClusterEwelink reports:

  1. Every ~15 minutes, from endpoint 1 only: {"detachRelayMode2":3}, which is correct (bit 0 + bit 1 = outlet1 + outlet2 enabled).
  2. Every ~18 h 12 min, a full burst (genGroups, genOnOff startUpOnOff, delayed power-on…) on both endpoints. In this burst, endpoint 1 reports detachRelayMode2: 3 and endpoint 2 reports detachRelayMode2: 0.

The attribute only makes sense on endpoint 1, where it holds a bitmap for all outlets. sonoffExtend.detachRelayModeControl() in src/devices/sonoff.ts doesn't check msg.endpoint, so the value 0 from endpoint 2 overwrites the state and both outlets are published as DISABLE. The state stays wrong until the next 15-minute report from endpoint 1 restores it. That's why the duration of the false DISABLE goes from 0 to 15 minutes and grows by a few minutes with each cycle (18 h 12 min is not a multiple of 15 min).

Debug log (two occurrences, same pattern):

[2026-11-01 03:39:03] debug: z2m: Received Zigbee message from 'mini_zb2gs', type 'attributeReport', cluster 'customClusterEwelink', data '{"delayedPowerOnState":0,"delayedPowerOnTime":0,"detachRelayMode2":3}' from endpoint 1 with groupID 0
[2026-11-01 03:39:03] debug: z2m: Received Zigbee message from 'mini_zb2gs', type 'attributeReport', cluster 'customClusterEwelink', data '{"delayedPowerOnState":0,"delayedPowerOnTime":0,"detachRelayMode2":0}' from endpoint 2 with groupID 0
[2026-11-01 03:39:03] info:  z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/mini_zb2gs', payload '{... "detach_relay_mode":{"detach_relay_outlet1":"DISABLE","detach_relay_outlet2":"DISABLE","detach_relay_outlet3":"DISABLE"} ...}'

[2026-11-04 04:37:15] debug: z2m: Received Zigbee message from 'mini_zb2gs', type 'attributeReport', cluster 'customClusterEwelink', data '{"delayedPowerOnState":0,"delayedPowerOnTime":0,"detachRelayMode2":3}' from endpoint 1 with groupID 0
[2026-11-04 04:37:18] debug: z2m: Received Zigbee message from 'mini_zb2gs', type 'attributeReport', cluster 'customClusterEwelink', data '{"delayedPowerOnState":0,"delayedPowerOnTime":0,"detachRelayMode2":0}' from endpoint 2 with groupID 0
  -> detach_relay_mode published as DISABLE/DISABLE
[2026-11-04 04:51:14] debug: z2m: Received Zigbee message from 'mini_zb2gs', type 'attributeReport', cluster 'customClusterEwelink', data '{"detachRelayMode2":3}' from endpoint 1 with groupID 0
  -> detach_relay_mode published as ENABLE/ENABLE again

Over 10 days of Home Assistant history: 16 false DISABLE episodes, all exactly ~18 h 12 min apart, lasting 0 to 14.4 min. In a whole day of debug logs, endpoint 1 always reports 3 (72 reports) and endpoint 2 always reports 0 (2 reports).

What did you expect to happen?

detach_relay_mode should stay ENABLE / ENABLE. The converter should ignore detachRelayMode2 when it comes from any endpoint other than endpoint 1. For example, in the fromZigbee converter of detachRelayModeControl:

if (msg.endpoint.ID !== 1) return;

(Alternatively, scope it per model if some multi-gang SONOFF devices report it from another endpoint.)

How to reproduce it (minimal and precise)

  1. Pair a MINI-ZB2GS-L and set detach_relay_outlet1 and detach_relay_outlet2 to ENABLE.
  2. Set log_level: debug and leave it running for at least 18–19 hours.
  3. Watch for the full report burst on both endpoints: endpoint 2 reports detachRelayMode2: 0, and detach_relay_mode flips to DISABLE until the next 15-minute report from endpoint 1.

Zigbee2MQTT version

2.14.3 (Home Assistant add-on 2.14.3-1)

Adapter firmware version

Z-Stack 3.x.0, revision 20260310

Adapter

SMLIGHT SLZB-MR2U (zstack, over TCP)

Setup

Home Assistant OS, Zigbee2MQTT add-on

Device database.db entry

{"id":28,"type":"EndDevice","manufId":4742,"manufName":"SONOFF","powerSource":"Mains (single phase)","modelId":"MINI-ZB2GS-L","epList":[1,2],"endpoints":{"1":{"inClusterList":[0,3,4,6,32,2821,64599,64529],"outClusterList":[3,6,25]},"2":{"inClusterList":[0,3,4,6,64529],"outClusterList":[3,6]}},"hwVersion":0,"dateCode":"20250821","swBuildId":"1.0.4","zclVersion":8,"interviewCompleted":true}

Notes

  • Possibly related to #33361 (the same device sends a burst of reports every 15 minutes). This issue is about the decoding of the endpoint 2 value, not the report frequency.
  • The same burst also reports delayedPowerOnTime: 0, which Home Assistant rejects for delayed_power_on_time_l1/l2 (Invalid value ... 0 (range 0.5 - 3599.5)). This is a separate, minor issue: the exposed minimum is 0.5, but the device reports 0.

altessier-ai avatar Nov 05 '26 06:11 altessier-ai

cc @cubez2mdeveloper

andrei-lazarov avatar Nov 05 '26 11:11 andrei-lazarov

Thanks for the detailed investigation and logs. The endpoint-specific reports are very helpful.

We'll review this behavior with our team and investigate the reported endpoint handling. We'll share any further findings or updates here.

CubeZ2mDeveloper avatar Nov 09 '26 06:11 CubeZ2mDeveloper