Zigbee2mqtt keeps restarting

Hi, I have Zigbee2MQTT as add-on on my Raspberry running HomeAssistant OS and I noticed that sometimes the add-on is not reachable, in the logs I can see that continues to restart the service randomly(Watchdog is enabled), sometimes happen after 2 hours, sometimes after 2 minutes.
I have a Sonoff ZBDongle-E, I set up adapter: ember and flashed the firmware version 7.4.4 .

Here are the logs:

[11:11:38] INFO: Preparing to start...
[11:11:39] INFO: Socat not enabled
[11:11:40] INFO: Starting Zigbee2MQTT...
Starting Zigbee2MQTT without watchdog.
[2025-02-20 11:12:05] info: 	z2m: Logging to console, file (filename: log.log)
[2025-02-20 11:12:05] info: 	z2m: Starting Zigbee2MQTT version 2.1.1 (commit #unknown)
[2025-02-20 11:12:05] info: 	z2m: Starting zigbee-herdsman (3.2.5)
[2025-02-20 11:12:06] info: 	zh:ember: Using default stack config.
[2025-02-20 11:12:06] info: 	zh:ember: ======== Ember Adapter Starting ========
[2025-02-20 11:12:06] info: 	zh:ember:ezsp: ======== EZSP starting ========
[2025-02-20 11:12:06] info: 	zh:ember:uart:ash: ======== ASH Adapter reset ========
[2025-02-20 11:12:06] info: 	zh:ember:uart:ash: RTS/CTS config is off, enabling software flow control.
[2025-02-20 11:12:06] info: 	zh:ember:uart:ash: Serial port opened
[2025-02-20 11:12:06] info: 	zh:ember:uart:ash: ======== ASH starting ========
[2025-02-20 11:12:07] info: 	zh:ember:uart:ash: ======== ASH connected ========
[2025-02-20 11:12:07] info: 	zh:ember:uart:ash: ======== ASH started ========
[2025-02-20 11:12:07] info: 	zh:ember:ezsp: ======== EZSP started ========
[2025-02-20 11:12:07] info: 	zh:ember: Adapter EZSP protocol version (13) lower than Host. Switched.
[2025-02-20 11:12:07] info: 	zh:ember: Adapter version info: {"ezsp":13,"revision":"7.4.4 [GA]","build":0,"major":7,"minor":4,"patch":4,"special":0,"type":170}
[2025-02-20 11:12:08] info: 	zh:ember: [STACK STATUS] Network up.
[2025-02-20 11:12:08] info: 	zh:ember: [INIT TC] Adapter network matches config.
[2025-02-20 11:12:08] info: 	zh:ember: [CONCENTRATOR] Started source route discovery. 1247ms until next broadcast.
[2025-02-20 11:12:08] info: 	z2m: zigbee-herdsman started (resumed)
[2025-02-20 11:12:08] info: 	z2m: Coordinator firmware version: '{"meta":{"build":0,"ezsp":13,"major":7,"minor":4,"patch":4,"revision":"7.4.4 [GA]","special":0,"type":170},"type":"EmberZNet"}'
[2025-02-20 11:12:08] info: 	z2m: Allagamento acquaio (0xb0c7defffe610b94): E2202 - IKEA BADRING water leakage sensor (EndDevice)
[2025-02-20 11:12:08] info: 	z2m: Allagamento lavastoviglie (0xb0c7defffe63e94f): E2202 - IKEA BADRING water leakage sensor (EndDevice)
[2025-02-20 11:12:08] info: 	z2m: Currently 2 devices are joined.
[2025-02-20 11:12:08] info: 	z2m: Connecting to MQTT server at mqtt://core-mosquitto:1883
[2025-02-20 11:12:10] info: 	z2m: Connected to MQTT server
[2025-02-20 11:12:11] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"online"}'
[2025-02-20 11:12:12] info: 	z2m: Started frontend on port 8099
[2025-02-20 11:12:12] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Allagamento acquaio', payload '{"battery":100,"identify":null,"linkquality":76,"update":{"installed_version":16777223,"latest_version":16777223,"state":"idle"},"water_leak":false}'
[2025-02-20 11:12:12] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Allagamento lavastoviglie', payload '{"battery":100,"identify":null,"linkquality":52,"update":{"installed_version":16777223,"latest_version":16777223,"state":"idle"},"water_leak":false}'
[2025-02-20 11:12:12] info: 	z2m: Zigbee2MQTT started!
[2025-02-20 11:12:17] info: 	z2m:mqtt: MQTT publish: topic 'homeassistant/binary_sensor/1221051039810110150109113116116_0x7cc6b6fffe817618/connection_state/config', payload '{"device":{"hw_version":"EmberZNet 7.4.4 [GA]","identifiers":["zigbee2mqtt_bridge_0x7cc6b6fffe817618"],"manufacturer":"Zigbee2MQTT","model":"Bridge","name":"Zigbee2MQTT Bridge","sw_version":"2.1.1"},"device_class":"connectivity","entity_category":"diagnostic","name":"Connection state","object_id":"zigbee2mqtt_bridge_connection_state","origin":{"name":"Zigbee2MQTT","sw":"2.1.1","url":"https://www.zigbee2mqtt.io"},"payload_off":"offline","payload_on":"online","state_topic":"zigbee2mqtt/bridge/state","unique_id":"bridge_0x7cc6b6fffe817618_connection_state_zigbee2mqtt","value_template":"{{ value_json.state }}"}'
[2025-02-20 11:14:49] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Allagamento acquaio', payload '{"battery":100,"identify":null,"linkquality":92,"update":{"installed_version":16777223,"latest_version":16777223,"state":"idle"},"water_leak":false}'
[11:20:33] INFO: Preparing to start...
[11:20:34] INFO: Socat not enabled
[11:20:34] INFO: Starting Zigbee2MQTT...
Starting Zigbee2MQTT without watchdog.
[2025-02-20 11:20:52] info: 	z2m: Logging to console, file (filename: log.log)
[2025-02-20 11:20:52] info: 	z2m: Starting Zigbee2MQTT version 2.1.1 (commit #unknown)
[2025-02-20 11:20:52] info: 	z2m: Starting zigbee-herdsman (3.2.5)
[2025-02-20 11:20:53] info: 	zh:ember: Using default stack config.
[2025-02-20 11:20:53] info: 	zh:ember: ======== Ember Adapter Starting ========
[2025-02-20 11:20:53] info: 	zh:ember:ezsp: ======== EZSP starting ========
[2025-02-20 11:20:53] info: 	zh:ember:uart:ash: ======== ASH Adapter reset ========
[2025-02-20 11:20:53] info: 	zh:ember:uart:ash: RTS/CTS config is off, enabling software flow control.
[2025-02-20 11:20:53] info: 	zh:ember:uart:ash: Serial port opened
[2025-02-20 11:20:53] info: 	zh:ember:uart:ash: ======== ASH starting ========
[2025-02-20 11:20:54] info: 	zh:ember:uart:ash: ======== ASH connected ========
[2025-02-20 11:20:54] info: 	zh:ember:uart:ash: ======== ASH started ========
[2025-02-20 11:20:54] info: 	zh:ember:ezsp: ======== EZSP started ========
[2025-02-20 11:20:54] info: 	zh:ember: Adapter EZSP protocol version (13) lower than Host. Switched.
[2025-02-20 11:20:54] info: 	zh:ember: Adapter version info: {"ezsp":13,"revision":"7.4.4 [GA]","build":0,"major":7,"minor":4,"patch":4,"special":0,"type":170}
[2025-02-20 11:20:55] info: 	zh:ember: [STACK STATUS] Network up.
[2025-02-20 11:20:55] info: 	zh:ember: [INIT TC] Adapter network matches config.
[2025-02-20 11:20:55] info: 	zh:ember: [CONCENTRATOR] Started source route discovery. 1247ms until next broadcast.
[2025-02-20 11:20:55] info: 	z2m: zigbee-herdsman started (resumed)
[2025-02-20 11:20:55] info: 	z2m: Coordinator firmware version: '{"meta":{"build":0,"ezsp":13,"major":7,"minor":4,"patch":4,"revision":"7.4.4 [GA]","special":0,"type":170},"type":"EmberZNet"}'
[2025-02-20 11:20:55] info: 	z2m: Allagamento acquaio (0xb0c7defffe610b94): E2202 - IKEA BADRING water leakage sensor (EndDevice)
[2025-02-20 11:20:55] info: 	z2m: Allagamento lavastoviglie (0xb0c7defffe63e94f): E2202 - IKEA BADRING water leakage sensor (EndDevice)
[2025-02-20 11:20:55] info: 	z2m: Currently 2 devices are joined.
[2025-02-20 11:20:55] info: 	z2m: Connecting to MQTT server at mqtt://core-mosquitto:1883
[2025-02-20 11:21:04] info: 	z2m: Connected to MQTT server
[2025-02-20 11:21:04] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"online"}'
[2025-02-20 11:21:11] info: 	z2m: Started frontend on port 8099
[2025-02-20 11:21:11] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Allagamento acquaio', payload '{"battery":100,"identify":null,"linkquality":76,"update":{"installed_version":16777223,"latest_version":16777223,"state":"idle"},"water_leak":false}'
[2025-02-20 11:21:11] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Allagamento lavastoviglie', payload '{"battery":100,"identify":null,"linkquality":52,"update":{"installed_version":16777223,"latest_version":16777223,"state":"idle"},"water_leak":false}'
[2025-02-20 11:21:11] info: 	z2m: Zigbee2MQTT started!
[2025-02-20 11:21:16] info: 	z2m:mqtt: MQTT publish: topic 'homeassistant/binary_sensor/1221051039810110150109113116116_0x7cc6b6fffe817618/connection_state/config', payload '{"device":{"hw_version":"EmberZNet 7.4.4 [GA]","identifiers":["zigbee2mqtt_bridge_0x7cc6b6fffe817618"],"manufacturer":"Zigbee2MQTT","model":"Bridge","name":"Zigbee2MQTT Bridge","sw_version":"2.1.1"},"device_class":"connectivity","entity_category":"diagnostic","name":"Connection state","object_id":"zigbee2mqtt_bridge_connection_state","origin":{"name":"Zigbee2MQTT","sw":"2.1.1","url":"https://www.zigbee2mqtt.io"},"payload_off":"offline","payload_on":"online","state_topic":"zigbee2mqtt/bridge/state","unique_id":"bridge_0x7cc6b6fffe817618_connection_state_zigbee2mqtt","value_template":"{{ value_json.state }}"}'

My configuration:

Socat:

enabled: false
master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
options: "-d -d"
log: false

Server:

server: mqtt://core-mosquitto:1883
user: mqtt-user
password: mypassword

Serial:

port: >-
  /dev/serial/by-id/usb-Itead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_V2_9440f292ab0eef118818b22a433abf1e-if00-port0
adapter: ember

Is anyone know why and what can I do?
Thank you

Just a basic thing and maybe I’m off: is your RPi up to all of this?
Did you check CPU/RAM usage?

I’m using around 800 MB of RAM(total is 1GB) and the CPU peaks of 20% maximum

I don’t know about the current, average usage with HAOS but I wonder if that’s correct plus, what’s the situation when Z2M crashes?
Did you install a new version of Z2M which might be the cause?

Also, 1Gb in total is very limited…

I’m using a Raspberry Pi 3 Model B, I monitored the RAM and CPU usage for more than 1 hour: the peak of the CPU was around 40% and the usage of the RAM is stable at 800 MB, sometimes lower.

I also have a Raspberry Pi 4 but I can’t use HA in OS mode and I read that Zigbee2MQTT only works in OS mode…

A RPi3…

Why can’t you use HAOS?

I wonder what these number are when Z2M crashes…

What is OS Mode ? My Zigbee2MQTT runs bare-metal on Debian, on another computer than my HA.

I think of yes. Installed via the official repository.

I’m using HAOS on RPi3

I don’t have this info, but I’ll check soon

I mean HomeAssistant OS and not running HomeAssistant on another system(like Raspbian, Debian, Ubuntu, etc.)

Zigbee2MQTT can be installed bare metal , as a docker container or a HA OS add-on.

Since your Pi 3 only has 1 Gb memory, Zigbee2MQTT as an add-on might be to much for the Pi 3.

1 Like

I also have a Raspberry Pi 4 with a lot of functions(NAS, streaming, etc). I installed Home Assistant but I can’t add Z2M and other add-ons I need, which is the procedure to ad add-ons?
Thank you

Bare metal install:

Docker install:

No add-ons if not running HA OS

If you created a backup upon installing you could revert that.

Ok, but then I can use it via HA?

Thank you

Yes, no problem. HA talks to MQTT, Zigbee2MQTT talks to MQTT. Independent how it is installed.

First Zigbee2MQTT had a LOT for breaking changes in version 2.0, so if you did not read the release notes and check your config then do that as a first step.

Secondly you might think you only need 800Mb of your 1024Mb available due to your sensors, but those sensors show you allocated memory.
If you have 200Mb free and a program tries to allocate 250Mb, then you are OOM, but your sensors will not show it, because the amount could not get to the allocated state.
Also If a prorgram tries to allocate 10Mb in a unbroken section, then you might be OOM also, if you can not find a free section of 10Mb in the 200Mb you have available.
And again it does not show on the your sensor.

1 Like