HA/Z2M Watchdog not working properly

Hi,

I am facing issues with the watchdog while using zigbee2mqtt addon.
I guess (as a developer) the watchdog is a homeassistant feature which is wrapped around the addons to ensure each addon got the watchdog feature.

So far so good. I have 2 networks. My main network and a subnetwork. Main network is using ZHA in my apartment, and my second subnetwork is in the cellar and each device in the cellar will connect to that subnetwork using zigbee2mqtt. Now my subnet cellar wlan connects a SLZB06. As the connection to the cellar is not the best (around ~9 mbit connection) speedtest shows around 3mbit download and 4 mbit upload. I can open HA and other stuff its just not loaded in an instant, but it works smoothless.

My issue is sometimes the connection the to SLZB06 drops due to the bad network connection between 3 floors.
This should be no issue as it only occurs sometimes and the SLZB06 will be back after few seconds.
And now the zigbee2mqtt addon dropps the connection due to timeout (which is fine and understandable) and tries to restart the service exactly two more times. But i get the log wrtten → “Starting Zigbee2MQTT without watchdog.” which is wrong as i did not start the service by hand again, it was (i expected as configured) the watchdog which restarts the service. But why only 2 more times and then stopps ? Watchdog should watch my process and restart it all the time till i disable the watchdog.

I run homeassistant using docker in linux mint.
My HomeAssistant zigbee2mqtt is configured as followed (user and password removed for screenshot).

(i cannot add 2nd screenshot getting 422 error no text.)
But my z2m watchdog is enabled! (see screenshot in comment)

My zigbee2mqtt log for this issue. The last successful connection attempt @19:14:19 was me pressing start button in HomeAssistant zigbee2mqtt addon:

[2025-01-26 18:33:42] info: 	zh:zstack:znp: Opening TCP socket with 192.168.11.88:6638
[2025-01-26 18:33:42] info: 	zh:zstack:znp: Socket connected
[2025-01-26 18:33:42] info: 	zh:zstack:znp: Socket ready
[2025-01-26 18:33:42] info: 	zh:zstack:znp: Writing CC2530/CC2531 skip bootloader payload
[2025-01-26 18:33:43] info: 	zh:zstack:znp: Skip bootloader for CC2652/CC1352
[2025-01-26 18:33:43] info: 	z2m: zigbee-herdsman started (resumed)
[2025-01-26 18:33:43] info: 	z2m: Coordinator firmware version: '{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20221226,"transportrev":2},"type":"zStack3x0"}'
[2025-01-26 18:33:43] info: 	z2m: 0xf84477fffe2ca7f9 (0xf84477fffe2ca7f9): UFO-R11 - Moes Universal smart IR remote control (EndDevice)
[2025-01-26 18:33:43] info: 	z2m: Steckdose_Waschmaschine (0x70b3d52b600fc44c): TS011F_plug_3 - Tuya Smart plug (with power monitoring by polling) (Router)
[2025-01-26 18:33:43] info: 	z2m: Temps_Orangen (0xa4c1382f0c27dcb4): TH02Z - Tuya Temperature and humidity sensor (EndDevice)
[2025-01-26 18:33:43] info: 	z2m: 0xa4c1386d1affb810 (0xa4c1386d1affb810): SNZB-03 - eWeLink Motion sensor (EndDevice)
[2025-01-26 18:33:43] info: 	z2m: 0xa4c138cffb42bd99 (0xa4c138cffb42bd99): WL-19DWZ - Tuya Contact sensor (EndDevice)
[2025-01-26 18:33:43] info: 	z2m: Currently 5 devices are joined.
[2025-01-26 18:33:43] info: 	z2m: Connecting to MQTT server at mqtt://172.30.32.1:1883
[2025-01-26 18:33:43] info: 	z2m: Connected to MQTT server
[2025-01-26 18:33:43] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"online"}'
[2025-01-26 18:33:43] info: 	z2m: Started frontend on port 8099
[2025-01-26 18:33:43] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xf84477fffe2ca7f9', payload '{"battery":100,"ir_code_to_send":null,"learn_ir_code":null,"learned_ir_code":"Bx4NZQa8AdsEgAMBiwHgAQNAE8APQAtAA0APwAfAC8APQAdAA0AXQAPgDwtAG+A7A+ADX+ADT+AXF+APH+AHQ+ALJ0ATwANAL0ALQAfgZQPAAeALd0ABgBcBvAGACQGLAUAJwAEAvCABAItgAUAH4AsDQAHAF0ABQAsB2wSAA0ALQANAD0ABQAdAAwHRMUJHAYsBQAtAA0ABQCcAvCABQA8BvAGAA0ALQANAD8AHwAvAD0AHQAMAvCABAIsgAYALAYsBQANAC0ABQAtAA0ABQAfgCwNAAcAXQAHgCwtAE0BTQAdAAUAHQANAAUAXQAFAD+ADA8AXwAfgAxvgAwtAAUAjQANAF0ABQAdAA0ATwAPADwC8IAEAiyABQAXgCwNAAcAXQAHAC+AHB0ABwBNAAeALC8AT4AsHQAHAF0ABwAvgBwdAAcATQAGACwK8AYsgAUAF4AsD4APzQB9ADwu8AYsB2wSLAdsEiwE=","linkquality":109,"voltage":1500}'
[2025-01-26 18:33:43] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Steckdose_Waschmaschine', payload '{"child_lock":null,"current":0.01,"energy":3.08,"indicator_mode":null,"linkquality":58,"power":0,"power_outage_memory":"on","state":"ON","update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":234}'
[2025-01-26 18:33:43] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Temps_Orangen', payload '{"battery":100,"humidity":65.88,"linkquality":51,"temperature":11.19,"voltage":3000}'
[2025-01-26 18:33:43] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xa4c1386d1affb810', payload '{"battery":100,"battery_low":false,"linkquality":32,"occupancy":false,"voltage":3000}'
[2025-01-26 18:33:43] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0xa4c138cffb42bd99', payload '{"battery":100,"battery_low":false,"contact":true,"linkquality":0,"voltage":2900}'
[2025-01-26 18:33:43] info: 	z2m: Zigbee2MQTT started!
[2025-01-26 18:33:48] info: 	z2m:mqtt: MQTT publish: topic 'homeassistant/binary_sensor/1221051039810110150109113116116_0x00124b0031d8060e/connection_state/config', payload '{"device":{"hw_version":"zStack3x0 20221226","identifiers":["zigbee2mqtt_bridge_0x00124b0031d8060e"],"manufacturer":"Zigbee2MQTT","model":"Bridge","name":"Zigbee2MQTT Bridge","sw_version":"2.0.0"},"device_class":"connectivity","entity_category":"diagnostic","name":"Connection state","object_id":"zigbee2mqtt_bridge_connection_state","origin":{"name":"Zigbee2MQTT","sw":"2.0.0","url":"https://www.zigbee2mqtt.io"},"payload_off":"offline","payload_on":"online","state_topic":"zigbee2mqtt/bridge/state","unique_id":"bridge_0x00124b0031d8060e_connection_state_zigbee2mqtt","value_template":"{{ value_json.state }}"}'
[2025-01-26 18:34:39] error: 	zh:zstack:znp: Socket error Error: read ETIMEDOUT
[2025-01-26 18:34:39] info: 	zh:zstack:znp: Port closed
[2025-01-26 18:34:39] info: 	zh:zstack:znp: closing
[2025-01-26 18:34:39] error: 	z2m: Adapter disconnected, stopping
[2025-01-26 18:34:39] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"offline"}'
[2025-01-26 18:34:39] info: 	z2m: Disconnecting from MQTT server
[2025-01-26 18:34:39] info: 	z2m: Stopping zigbee-herdsman...
[2025-01-26 18:34:39] info: 	z2m: Stopped zigbee-herdsman
[2025-01-26 18:34:39] info: 	z2m: Stopped Zigbee2MQTT
[18:34:43] INFO: Preparing to start...
[18:34:43] INFO: Socat not enabled
[18:34:43] INFO: Starting Zigbee2MQTT...
Starting Zigbee2MQTT without watchdog.
[2025-01-26 18:34:44] info: 	z2m: Logging to console, file (filename: log.log)
[2025-01-26 18:34:44] info: 	z2m: Starting Zigbee2MQTT version 2.0.0 (commit #unknown)
[2025-01-26 18:34:44] info: 	z2m: Starting zigbee-herdsman (3.2.1)
[2025-01-26 18:34:44] info: 	zh:zstack:znp: Opening TCP socket with 192.168.11.88:6638
[2025-01-26 18:34:50] error: 	zh:zstack:znp: Socket error Error: connect EHOSTUNREACH 192.168.11.88:6638
[2025-01-26 18:34:50] error: 	z2m: Error while starting zigbee-herdsman
[2025-01-26 18:34:50] error: 	z2m: Failed to start zigbee-herdsman
[2025-01-26 18:34:50] error: 	z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start_crashes-runtime.html for possible solutions
[2025-01-26 18:34:50] error: 	z2m: Exiting...
[2025-01-26 18:34:50] error: 	z2m: Error: Error while opening socket
    at Socket.<anonymous> (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:158:24)
    at Socket.emit (node:events:530:35)
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:90:21)
/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:264
  var er = new ERR_STREAM_WRITE_AFTER_END();
           ^
Error: write after end
    at writeAfterEnd (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:264:12)
    at DerivedLogger.Writable.write (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:300:21)
    at DerivedLogger.log (/app/node_modules/.pnpm/[email protected]/node_modules/winston/lib/winston/logger.js:231:12)
    at Logger.log (/app/lib/util/logger.ts:198:25)
    at Logger.info (/app/lib/util/logger.ts:211:14)
    at Znp.onPortClose (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:88:16)
    at Object.onceWrapper (node:events:633:26)
    at Socket.emit (node:events:518:28)
    at TCP.<anonymous> (node:net:343:12)
[18:34:53] INFO: Preparing to start...
[18:34:53] INFO: Socat not enabled
[18:34:53] INFO: Starting Zigbee2MQTT...
Starting Zigbee2MQTT without watchdog.
[2025-01-26 18:34:54] info: 	z2m: Logging to console, file (filename: log.log)
[2025-01-26 18:34:54] info: 	z2m: Starting Zigbee2MQTT version 2.0.0 (commit #unknown)
[2025-01-26 18:34:54] info: 	z2m: Starting zigbee-herdsman (3.2.1)
[2025-01-26 18:34:54] info: 	zh:zstack:znp: Opening TCP socket with 192.168.11.88:6638
[2025-01-26 18:34:57] error: 	zh:zstack:znp: Socket error Error: connect EHOSTUNREACH 192.168.11.88:6638
[2025-01-26 18:34:57] error: 	z2m: Error while starting zigbee-herdsman
[2025-01-26 18:34:57] error: 	z2m: Failed to start zigbee-herdsman
[2025-01-26 18:34:57] error: 	z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start_crashes-runtime.html for possible solutions
[2025-01-26 18:34:57] error: 	z2m: Exiting...
[2025-01-26 18:34:58] error: 	z2m: Error: Error while opening socket
    at Socket.<anonymous> (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:158:24)
    at Socket.emit (node:events:530:35)
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:90:21)
/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:264
  var er = new ERR_STREAM_WRITE_AFTER_END();
           ^
Error: write after end
    at writeAfterEnd (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:264:12)
    at DerivedLogger.Writable.write (/app/node_modules/.pnpm/[email protected]/node_modules/readable-stream/lib/_stream_writable.js:300:21)
    at DerivedLogger.log (/app/node_modules/.pnpm/[email protected]/node_modules/winston/lib/winston/logger.js:231:12)
    at Logger.log (/app/lib/util/logger.ts:198:25)
    at Logger.info (/app/lib/util/logger.ts:211:14)
    at Znp.onPortClose (/app/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:88:16)
    at Object.onceWrapper (node:events:633:26)
    at Socket.emit (node:events:518:28)
    at TCP.<anonymous> (node:net:343:12)
[19:14:18] INFO: Preparing to start...
[19:14:18] INFO: Socat not enabled
[19:14:18] INFO: Starting Zigbee2MQTT...
Starting Zigbee2MQTT without watchdog.
[2025-01-26 19:14:19] info: 	z2m: Logging to console, file (filename: log.log)
[2025-01-26 19:14:19] info: 	z2m: Starting Zigbee2MQTT version 2.0.0 (commit #unknown)
[2025-01-26 19:14:19] info: 	z2m: Starting zigbee-herdsman (3.2.1)
[2025-01-26 19:14:19] info: 	zh:zstack:znp: Opening TCP socket with 192.168.11.88:6638
[2025-01-26 19:14:19] info: 	zh:zstack:znp: Socket connected
[2025-01-26 19:14:19] info: 	zh:zstack:znp: Socket ready
[2025-01-26 19:14:19] info: 	zh:zstack:znp: Writing CC2530/CC2531 skip bootloader payload
[2025-01-26 19:14:20] info: 	zh:zstack:znp: Skip bootloader for CC2652/CC1352
[2025-01-26 19:14:21] info: 	z2m: zigbee-herdsman started (resumed)
[2025-01-26 19:14:21] info: 	z2m: Coordinator firmware version: '{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20221226,"transportrev":2},"type":"zStack3x0"}'
[2025-01-26 19:14:21] info: 	z2m: 0xf84477fffe2ca7f9 (0xf84477fffe2ca7f9): UFO-R11 - Moes Universal smart IR remote control (EndDevice)
[2025-01-26 19:14:21] info: 	z2m: Steckdose_Waschmaschine (0x70b3d52b600fc44c): TS011F_plug_3 - Tuya Smart plug (with power monitoring by polling) (Router)
[2025-01-26 19:14:21] info: 	z2m: Temps_Orangen (0xa4c1382f0c27dcb4): TH02Z - Tuya Temperature and humidity sensor (EndDevice)
[2025-01-26 19:14:21] info: 	z2m: 0xa4c1386d1affb810 (0xa4c1386d1affb810): SNZB-03 - eWeLink Motion sensor (EndDevice)
[2025-01-26 19:14:21] info: 	z2m: 0xa4c138cffb42bd99 (0xa4c138cffb42bd99): WL-19DWZ - Tuya Contact sensor (EndDevice)
[2025-01-26 19:14:21] info: 	z2m: Currently 5 devices are joined.
[2025-01-26 19:14:21] info: 	z2m: Connecting to MQTT server at mqtt://172.30.32.1:1883
[2025-01-26 19:14:21] info: 	z2m: Connected to MQTT server
[2025-01-26 19:14:21] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"online"}'

Anyone got some infos or idea whats going wrong with my watchdog ?

z2m Watchdog enabled

Hi rootjumper you have to make the following settings in the configuration under watchdog. To do this, click on Show unused optional configuration options and then enter the following, for example 1,5,15,30,60

Hey Mate,

Thanks for that information.
I just set those values as you said.

We see and big thanks, i dont know how i failed setting these values…
Thanks! I’ll give feedback if that solves my issue.

Update: Solved by setting the watchdog parameters.