[Bug / Template Analysis]: Sonoff Zigbee Bridge Pro (ZBBridge-P) deterministic 44-second factory reset wipe loop caused by GPIO27 Button1 hold timeout
Tasmota issue (arendst/Tasmota)
PROBLEM DESCRIPTION
A clear and concise description of what the problem is.
The Sonoff Zigbee Bridge Pro (ZBBridge-P) wipes its entire Tasmota configuration to factory defaults ~44–70 seconds after every boot when the canonical "Sonoff Zigbee Pro" template (the one published for this device) is applied and activated with Module 0. The device reboots with RestartReason: Software reset CPU and comes back with Module 1 (ESP32-DevKit), empty MQTT settings and the default topic — while the default configuration (no Zigbee template) runs stable for days.
Root cause, verified by code audit and a live hardware test: the canonical template maps GPIO27 to Button1 (32). On this board GPIO27 reads LOW continuously even with INPUT_PULLUP enabled (verified live via Berry: gpio.pin_mode(27,5) then gpio.digital_read(27) → 0, repeatedly). Tasmota's button handler therefore sees an endless button hold:
tasmota_support/support_button_v4.ino:351—if (TasmotaGlobal.uptime < 4) { return; }→ 4 s boot lockouttasmota_support/support_button_v4.ino:463—Button.hold_timer[button_index]++;every debounce tick while the input reads pressed- threshold at
support_button_v4.ino:488:loops_per_second * hold_time_extent * Settings->param[P_HOLD_TIME] / 10withIMMINENT_RESET_FACTOR = 10(tasmota.h:187) and defaultSetOption32 = 40→ 20 ticks/s × 10 × 40/10 = 800 ticks = 40 s support_button_v4.ino:490-491— executesReset 1viaExecuteCommand(scmnd, SRC_BUTTON)support_tasmota.ino:1625-1628—restart_flag = 211→SettingsDefault()→ full factory wipe + restart
4 s boot lockout + 40 s hold = the deterministic ~44 s wipe (observed 45–70 s depending on loop rate under WiFi/MQTT/Zigbee load).
Setting GPIO27 to 0 (None) in the template makes the device fully stable (verified 40+ minutes with the Zigbee coordinator and MQTT active).
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
- Read the Contributing Guide and Policy and the Code of Conduct
- Searched the problem in issues
- Searched the problem in discussions
- Searched the problem in the docs
- Searched the problem in the chat
- Problem is not scripter related, in this case open a discussion and tag gemu2015
- Device used (e.g., Sonoff Basic): Sonoff Zigbee Bridge Pro (ZBBridge-P, ESP32-D0WD-V3 + CC2652P)
- Tasmota binary firmware version number used:
15.3.0.1(7568d93-zbbrdgpro)and15.6.0(release-zbbrdgpro)— the wipe reproduces on both- Pre-compiled
- Self-compiled
- Flashing tools used:
esptool.pyv5.4.0 (serial UART) and OTA fromota.tasmota.com - Provide the output of command:
Backlog Template; Module; GPIO 255:
Configuration output here:
# Current configuration (WITH the workaround applied: GPIO27 = None instead of Button1):
{"NAME":"Sonoff Zigbee Pro","ARCH":"ESP32","GPIO":[0,0,576,0,480,0,0,0,0,1,1,5792,0,0,0,3552,0,320,5793,3584,0,640,608,0,0,0,0,0,1,0,0,0,0,0,0,1],"FLAG":0,"BASE":1}
{"Module":{"0":"Sonoff Zigbee Pro"}}
GPIO2 = LedLink_i (576)
GPIO4 = Buzzer (480)
GPIO13 = User (1)
GPIO14 = User (1)
GPIO15 = Zigbee Rst1 (5792)
GPIO19 = Zigbee Tx (3552)
GPIO21 = Led_i1 (320)
GPIO22 = Zigbee Rst2 (5793)
GPIO23 = Zigbee Rx (3584)
GPIO25 = I2C SDA1 (640)
GPIO26 = I2C SCL1 (608)
GPIO27 = None (0) <-- the canonical template has Button1 (32) here, which triggers the wipe
GPIO33 = User (1)
GPIO39 = User (1)
- If using rules, provide the output of this command:
Backlog Rule1; Rule2; Rule3:
Rules output here:
{"Rule1":{"State":"OFF","Once":"OFF","StopOnError":"OFF","Length":0,"Free":511,"Rules":""}}
(no rules are configured on this device)
- Provide the output of this command:
Status 0:
STATUS 0 output here:
{
"Status": {
"Module": 0,
"DeviceName": "Tasmota",
"FriendlyName": ["Tasmota"],
"Topic": "<BRIDGE_ID>",
"ButtonTopic": "0",
"Power": "0",
"PowerLock": "0",
"PowerOnState": 3,
"LedState": 1,
"LedMask": "FFFF",
"SaveData": 1,
"SaveState": 1,
"SwitchTopic": "0",
"ButtonRetain": 0,
"SwitchRetain": 0,
"SensorRetain": 0,
"PowerRetain": 0,
"InfoRetain": 0,
"StateRetain": 0,
"StatusRetain": 0
},
"StatusPRM": {
"Baudrate": 115200,
"SerialConfig": "8N1",
"GroupTopic": "tasmotas",
"OtaUrl": "http://ota.tasmota.com/tasmota32/release/tasmota32-zbbrdgpro.bin",
"RestartReason": "Software reset CPU",
"Uptime": "0T00:36:04",
"StartupUTC": "2026-09-24T15:23:53",
"Sleep": 0,
"CfgHolder": 4617,
"BootCount": 8,
"BCResetTime": "2026-09-24T15:31:58",
"SaveCount": 22
},
"StatusFWR": {
"Version": "15.6.0(release-zbbrdgpro)",
"BuildDateTime": "2026-08-25T09:15:28",
"Core": "3.3.8",
"SDK": "5.5.4.260407",
"CpuFrequency": 160,
"Hardware": "ESP32-D0WD-V3 v3.1",
"CR": "477/699"
},
"StatusLOG": {
"SerialLog": 3,
"WebLog": 4,
"MqttLog": 0,
"FileLog": 0,
"SysLog": 0,
"LogHost": "",
"LogPort": 514,
"SSId": ["<REDACTED_SSID>", ""],
"TelePeriod": 300,
"Resolution": "558180C0",
"SetOption": ["0000800B","2805C80001000600013C5A0A192800000000","00008080","00006000","00004000","00000000"]
},
"StatusMEM": {
"ProgramSize": 1563,
"Free": 292,
"Heap": 167,
"StackLowMark": 3,
"PsrMax": 2048,
"PsrFree": 2033,
"ProgramFlashSize": 4096,
"FlashSize": 4096,
"FlashChipId": "1640C8",
"FlashFrequency": 40,
"FlashMode": "DIO",
"Drivers": "1,2,!4,!8,9,10,12,!16,!20,!21,23,24,29,!35,38,!41,50,52,!59,62,!68,82,!121",
"Sensors": "1,2,5,6,127",
"I2CDriver": ""
},
"StatusNET": {
"Hostname": "<BRIDGE_ID>-0932",
"IPAddress": "192.168.x.x",
"Gateway": "192.168.x.x",
"Subnetmask": "255.255.255.0",
"DNSServer1": "8.8.8.8",
"DNSServer2": "8.8.4.4",
"Mac": "<REDACTED_MAC>",
"Webserver": 2,
"HTTP_API": 1,
"WifiConfig": 4,
"WifiPower": 16.0
},
"StatusMQT": {
"MqttHost": "192.168.x.x",
"MqttPort": 1883,
"MqttClientMask": "DVES_%06X",
"MqttClient": "DVES_<MACSUFFIX>",
"MqttUser": "<REDACTED_MQTT_USER>",
"MqttCount": 1,
"MqttTLS": 0,
"MAX_PACKET_SIZE": 1200,
"KEEPALIVE": 30,
"SOCKET_TIMEOUT": 4
},
"StatusSTS": {
"Uptime": "0T00:36:04",
"UptimeSec": 2164,
"Heap": 167,
"SleepMode": "Dynamic",
"Sleep": 0,
"LoadAvg": 999,
"MqttCount": 1,
"Berry": {"HeapUsed": 3, "Objects": 42},
"Wifi": {
"AP": 1,
"SSId": "<REDACTED_SSID>",
"BSSId": "<REDACTED_BSSID>",
"Channel": 6,
"Mode": "HT20",
"RSSI": 98,
"Signal": -51,
"LinkCount": 1,
"Downtime": "0T00:00:04"
},
"Hostname": "<BRIDGE_ID>-0932",
"IPAddress": "192.168.x.x"
}
}
- Set
weblogto 4 and then, when you experience your issue, provide the output of the Console log:
Console output here:
# Boot with the canonical template (GPIO27 = Button1). Serial UART capture @115200:
00:00:19 MQT: ZbState Status:1 Message:"CCxxxx ZNP booted" Revision:20240710
00:00:23.929 ZIG: ZbZNPSent 2700
00:00:24.950 ZIG: {"ZbZNPReceived":"4F800D0004"}
00:00:25.971 ZIG: {"ZbZNPReceived":"4F80080200"}
00:00:25.973 ZIG: timeout, goto label 99
00:00:25.982 MQT: ZbState Status:99 Message:"Abort"
00:00:25.988 ZIG: Stopping (99)
# (the Status:99 abort is a separate transient observation; the device stays up and
# responsive — HTTP `Status 0` answered normally at uptime 62 s)
# Between uptime 63 s and 70 s the device reboots by itself (RestartReason: "Software reset CPU").
# Next boot comes up in factory defaults:
# Module: 1 (ESP32-DevKit), Topic: tasmota_F3E3A4, MqttHost: (empty), BootCount: 1, SaveCount: 4
TO REPRODUCE
Steps to reproduce the behavior:
- Flash
tasmota32-zbbrdgpro.factory.binon a Sonoff Zigbee Bridge Pro (ZBBridge-P). - Apply the canonical template published for this device and activate it:(this is the template published at https://templates.blakadder.com/sonoff_ZBBridge-P.html — note GPIO27 =
Template {"NAME":"Sonoff Zigbee Pro","GPIO":[0,0,576,0,480,0,0,0,0,1,1,5792,0,0,0,3552,0,320,5793,3584,0,640,608,32,0,0,0,0,0,1,0,0,0,0,0,0],"FLAG":0,"BASE":1} Module 0Button1 (32)) - Wait ~45–70 s after boot: the device reboots by itself and comes back with factory-default configuration (
Module 1, empty MQTT, default topictasmota_%06X). Deterministic — reproduced 8+ times on 15.3.0.1 and on 15.6.0. - Change the template so GPIO27 =
0 (None)(position 23 of the GPIO array) and repeat: the device is stable indefinitely.
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen.
The device should boot and stay stable with the canonical template. Reset 1 should only execute when the button is physically held for the configured hold time — not when the button input idles LOW on the board.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
Not applicable — evidence captured via serial UART console and HTTP API (logs included above).
ADDITIONAL CONTEXT
Add any other context about the problem here.
- The wipe signature matches
Reset 1exactly: all Tasmota settings are reset to defaults (Module, Template, MQTT, Topic, Sleep, stored SSId entries) while the ESP32/ESP-IDF WiFi NVS may keep the radio associated until the next power cycle. - Important nuance for anyone working around this:
SetOption40 1alone does not prevent the wipe —param[P_HOLD_IGNORE]is only evaluated inside thebutton_restrictbranch (support_button_v4.ino:480-486).SetOption1 1alone does prevent it (routes the hold logic into the restrict branch). - Workaround applied and verified: template with GPIO27 =
0 (None)plusSetOption1 1,SetOption40 1,SetOption65 1→ stable 40+ minutes with the Zigbee coordinator and MQTT active. - GPIO27 hardware evidence: with INPUT_PULLUP explicitly enabled via Berry (
gpio.pin_mode(27,5)),gpio.digital_read(27)returns0on every sample. We then polled the pin continuously for 120 s (~230 samples) while the physical button was pressed several times during the window: the level never left0— pressing produces no transition either. So on this unit the pin is held LOW regardless of the button state (stuck button, button not reaching GPIO27, or a board-level pull-down). We could not determine whether this is specific to our unit or board-level; if other ZBBridge Pro owners can run the two Berry commands above and report the value, that would settle whether the published template should change GPIO27 to0. - Suggestion: update the published ZBBridge-P template (GPIO27 →
0) or document the requiredSetOption1 1guard for this device. - Separate transient observation (possibly unrelated): on the very first boot after
Module 0activation the ZNP coordinator start timed out waiting forUTIL_GET_DEVICE_INFO(2000 ms) and aborted withStatus:99; subsequent boots started the coordinator normally.
(Please, remember to close the issue when the problem has been addressed)
Source: arendst/Tasmota