Zigbee2MQTT fails to start with SONOFF Dongle on Windows issue and its solution

The issue

Zigbee2MQTT fails to start with SONOFF Dongle-LMG21/-PMG24/-M on Windows. The error log looks like the following:

[2026-02-03 22:08:40] info: z2m: Logging to console, file (filename: log.log)
[2026-02-03 22:08:40] info: z2m: Starting Zigbee2MQTT version 2.8.0 (commit #b0b02c30)
[2026-02-03 22:08:40] info: z2m: Starting zigbee-herdsman (9.0.2)
[2026-02-03 22:08:40] info: zh:ember: Using default stack config.
[2026-02-03 22:08:40] info: zh:ember: ======== Ember Adapter Starting ========
[2026-02-03 22:08:40] info: zh:ember:ezsp: ======== EZSP starting ========
[2026-02-03 22:08:40] info: zh:ember:uart:ash: ======== ASH Adapter reset ========
[2026-02-03 22:08:40] info: zh:ember:uart:ash: Serial port opened
[2026-02-03 22:08:40] info: zh:ember:uart:ash: ======== ASH starting ========
[2026-02-03 22:08:45] info: zh:ember:uart:ash: ======== ASH Adapter reset ========
[2026-02-03 22:08:45] info: zh:ember:uart:ash: ======== ASH starting ========
[2026-02-03 22:08:51] info: zh:ember:uart:ash: ======== ASH Adapter reset ========
[2026-02-03 22:08:51] info: zh:ember:uart:ash: ======== ASH starting ========
[2026-02-03 22:08:56] info: zh:ember:uart:ash: ======== ASH Adapter reset ========
[2026-02-03 22:08:56] info: zh:ember:uart:ash: ======== ASH starting ========
[2026-02-03 22:09:02] info: zh:ember:uart:ash: ======== ASH Adapter reset ========
[2026-02-03 22:09:02] info: zh:ember:uart:ash: ======== ASH starting ========
[2026-02-03 22:09:07] error: z2m: Error while starting zigbee-herdsman
[2026-02-03 22:09:07] error: z2m: Failed to start zigbee-herdsman
[2026-02-03 22:09:07] error: z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start_crashes-runtime.html for possible solutions
[2026-02-03 22:09:07] error: z2m: Exiting...
[2026-02-03 22:09:07] error: z2m: Error: Failed to start EZSP layer with status=HOST_FATAL_ERROR.

The reason

Zigbee2MQTT relies on SerialPort library to communicate with SONOFF Dongle. The default behavior of SerialPort windows library will pull down the DTR pin which cause SONOFF Dongle into reboot loop.

The option that controls this behavior is hupcl in SerialPort but Zigbee2MQTT (and also ember-zli) doesn’t expose it. A temporary (also ugly) fix would be adding hupcl: false to the serialOpts object of source code file zigbee-herdsman/src/adapter/ember/uart/ash.ts at master · Koenkk/zigbee-herdsman · GitHub at line 457, maybe after xoff: false,.

The solution

Install Zigbee2MQTT

Prerequisite: install Node.js 24, run command corepack enable to enable pnpm.

Pull Zigbee2MQTT source code:

git clone --depth 1 https://github.com/Koenkk/zigbee2mqtt/

Go into zigbee2mqtt root directory, and install dependencies.

pnpm install --frozen-lockfile

Add option hupcl: false to serialOpts

Open file zigbee2mqtt\node_modules\zigbee-herdsman\dist\adapter\ember\uart\ash.js, add option hupcl: false to serialOpts. For example:

const serialOpts = {
    path: this.portOptions.path,
    baudRate: typeof this.portOptions.baudRate === "number" ? this.portOptions.baudRate : 115200,
    rtscts: typeof this.portOptions.rtscts === "boolean" ? this.portOptions.rtscts : false,
    autoOpen: false,
    parity: "none",
    stopBits: 1,
    xon: false,
    xoff: false,
    hupcl: false,
};

Build and start

pnpm run build
pnpm start

Verify but it should work

Once Zigbee2MQTT is started, visit its onboarding page, such as http://localhost:8080.

Choose the right options, such as:

  • Coordinator/Adapter Port/Path: COM7
  • Coordinator/Adapter Type/Stack/Driver: ember
  • Coordinator/Adapter Baudrate: 115200
  • Coordinator/Adapter Hardware Flow Control (“rtscts: true”): false

Or, you can create the configuration.yaml file manually if you are familiar with Zigbee2MQTT.

Good news!

Zigbee2MQTT maintainer Nerivec has just published a better solution. Please refer to Can't start on Windows with adapters using CP210x serial chip · Issue #28743 · Koenkk/zigbee2mqtt · GitHub, and help us test it.

If it works in all conditions, Nerivec will merge the modification to zigbee-herdsman which Zigbee2MQTT relies on.