domoticz-zigbee2mqtt-plugin icon indicating copy to clipboard operation
domoticz-zigbee2mqtt-plugin copied to clipboard

The plugin does not start after restarting the raspberry pi

Open elpaul opened this issue 5 years ago • 15 comments

Hi all! Great job Stanislav! I have such a problem. The plugin works perfectly but, after a power outage or restart from Domoticz or console or reboot raspberry pi, the plugin does not start. I have to enter the devices (in Domoticz) and manually disable and enable the plugin, then it starts working again.

Additional information Zigbee2MQTT version: 1.6.0. Python version: 3.7.3 Domoticz version: V4.10717 Plugin version: 0.19

elpaul avatar Oct 05 '19 08:10 elpaul

Hi, I've got the same problem. I reboot my Raspberry 03:00 AM and after that the plugin doesn't work anymore. The log starts with a long list of mqtt errors. When I disable and enable the plugin it reads the devices correctly from mqtt and enables all devces without any errors.

Additional information Zigbee2MQTT version: 1.6.0. Python version: 3.5.3 Domoticz version: V4.10717 Plugin version: 0.19

JochemLangerak avatar Oct 16 '19 06:10 JochemLangerak

Most likely it happens because your MQTT server starts after Domoticz initialize plugin. Could you please try to start Domoticz after MQTT server and check if everything is ok?

stas-demydiuk avatar Oct 26 '19 05:10 stas-demydiuk

You're right. If I run domoticz after mosquitto, everything is OK.

elpaul avatar Oct 26 '19 05:10 elpaul

Hello, I've got the same problem. How can I modify the order of starting MQTT server and domoticz plugin initialization ? Thank you and sorry for my english !!

TirryK avatar Dec 16 '19 09:12 TirryK

I have the same problem. Every reboot the zigbee2mqtt is not working with domoticz...must be restarted the domoticz.service. What can i do?

blooesky avatar Feb 14 '20 07:02 blooesky

Please make sure you have such order of starting services: MQTT -> zigbee2mqtt -> Domoticz

stas-demydiuk avatar Feb 16 '20 18:02 stas-demydiuk

First start it is Domoticz and after mqtt,but i don't know how to change the stratup order. If mqtt server started first everyfing works fine.

blooesky avatar Feb 17 '20 12:02 blooesky

Faced the same problem this week. I run zigbee2mqtt, mosquitto, and domoticz via LXC so maybe the details will differ a bit. p.s. This should work if you followed the Domoticz Wiki.

Do a 'systemctl edit domoticz' and save the following:

[Unit] After = zigbee2mqtt

This will override the After option from the original domoticz service file to start after zigbee2mqtt. @stas-demydiuk IMHO this should be handled by the plugin. In this scenario, mosquitto and zigbeee2mqtt run on the same host. This is not applicable when someone has f.e. a dedicated pi-mosquitto broker running on the local LAN. Is trying to reconnect (for X nr of times) plugin wise an option?

jstam84 avatar Apr 06 '20 06:04 jstam84

Agree, would be great if someone create PR to add such behavior

stas-demydiuk avatar Apr 06 '20 07:04 stas-demydiuk

I have the same problem. Modifying the service start order does not solve it in my setup. I suspect the real problem is that even if the zigbee2mqtt service is started, it might still be waiting for the ZigBee usb controller to connect/start. Would be great if the plugin recognizes this state and reconnects when zigbee2mqtt is actually ready.

d-EScape avatar Apr 22 '20 09:04 d-EScape

I have the same problem. Modifying the service start order does not solve it in my setup. I suspect the real problem is that even if the zigbee2mqtt service is started, it might still be waiting for the ZigBee usb controller to connect/start. Would be great if the plugin recognizes this state and reconnects when zigbee2mqtt is actually ready.

This is not plugin problem. This is Domoticz problem...

kovainfo avatar Apr 22 '20 10:04 kovainfo

Some solution ?

kevin11121147 avatar May 19 '20 13:05 kevin11121147

Hi Stanislav, I have the same problem. After rebooting the Pi, domoticz is unable to connect to the Zigbee2MQTT devices. changing the startup order does not solve this. When I simply change the 'Zigbee pairing' setting in the hardware setting of the Zigbee2MQTT device, all devices can be reached. A domoticz domoticz.txt log file is attached that shows the behaviour.

Huppeltje16 avatar Jul 08 '20 18:07 Huppeltje16

this help https://domoticz.com/forum/viewtopic.php?t=30846 :)

sudo nano /etc/init.d/domoticz.sh

locate the line that starts with DAEMON_ARGS="$DAEMON_ARGS -daemonname $NAME insert this after that line (20 is an example)

DAEMON_ARGS="$DAEMON_ARGS -startupdelay 20"

save the file and do sudo systemctl daemon-reload

kevin11121147 avatar Jul 08 '20 18:07 kevin11121147

this help https://domoticz.com/forum/viewtopic.php?t=30846 :)

sudo nano /etc/init.d/domoticz.sh

locate the line that starts with DAEMON_ARGS="$DAEMON_ARGS -daemonname $NAME insert this after that line (20 is an example)

DAEMON_ARGS="$DAEMON_ARGS -startupdelay 20"

save the file and do sudo systemctl daemon-reload

Hi Kevin, this seemed to do the trick, but after a reboot through crontab, the plugin needed a reset by changing the setting again. Does anyone have a way to automate this reset?

Huppeltje16 avatar Jul 09 '20 05:07 Huppeltje16

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 30 '22 18:08 stale[bot]