Z2m with Sonoff Dongle-M doesn't restart after power lost

Dear Collegues,

I have installed 2pcs dongles (Dongle-E(USB) and Dongle-M(Ethernet). After power (in home) is off/on, the z2m with Dongle-M not started. Watchdog is enabled. In this time Dongle-E after power off/on is ok.
Could You advice, please, what should i do?

Best regards,
Sergey

Check if they are swapping holes on you by talking to the stick, not the virtual hole…

The TTY ports can sometimes change internally, so it is suggested to use the /serial/by-id/ URL that always talks to your dongle by serial number so it is always right.
You can find out what that is by using:

and looking for it under all hardware, something like this:

Once you have the long URL use that instead of the ttyxxx one. Zigbee2mqtt will not start , can not find the usb0 port - #5 by Saoshen

If you are using a Container installation, this is how to see the /serial/by-id/\ URL:
ls -l /dev/serial/by-id Be sure to include the /dev/serial/by-id in front of the response as you need to tell it the full path.

Hello Sir_Goodenough!

It’s actual in case if Dongle-M connected USB. But, I am using ethernet connection. In hardware this connection is not available.

Best regards,
Sergey

Since the Sonoff Dongle-M is powered through PoE I suspect that after power is back your HA server/Z2M is booting/starting faster than the Dongle-M itself. Hence Z2M is trying to connect to the Dongle-M but can not reach it because the dongle is not ready yet.

As a next step to narrow down on the problem I would try to power the Dongle-M using a PoE injector rather than powering the device through your PoE switch/router since it takes some additional time until the switch/router provides power to the dongle through it’s PoE ports after a power blackout.

Anyway, there are plenty of complaints about the Sonoff Dongle Max. I advise you to go through this thread. Maybe it will help.

Hello Tamsy!
I think like You, that problem in time booting of network (main router and mesh systems). That more later than Dongle-M try to start. After some attempts Dongle in state fault. What You think - is possible to automaticaly restart Z2M after 2 min after power is on?

Before fiddling around with automatically restarting HA (which isn’t a recommendable way) I would really try to use a PoE+ injector to get the Dongle-M to boot immediately after power is back (rather than to wait for the PoE router/switch to boot and provide power to the coordinator. Those PoE+ injectors got quite cheap nowadays and easily to get in many online stores.

Hello Tamsy! I will try Your idea, but with USB power at the first. If started in normal after power in home is off/on You are right.

Hi SergeyT,

I believe the problem is related to the network startup sequence after a power outage.

You can create a Home Assistant automation to delay the startup of Zigbee2MQTT by 2 minutes.

First, disable “Start on boot” in the Zigbee2MQTT add-on settings.

Then, create a new automation using the following YAML:

alias: Zigbee2MQTT Delayed Startup
description: Start Zigbee2MQTT 120 seconds after Home Assistant starts

triggers:
  - trigger: homeassistant
    event: start

conditions: []

actions:
  - delay:
      hours: 0
      minutes: 2
      seconds: 0

  - action: hassio.app_start
    data:
      app: 45df7312_zigbee2mqtt

mode: single

Make sure to replace 45df7312_zigbee2mqtt with your actual Zigbee2MQTT add-on slug if it is different.

Hope this helps!