I am using Dietpi as operating system & home -assistant, mqtt broker & zigbee2mqtt application on my nuc. In past i was using dietpi provided mqtt broker but recently i switched to rumqttd
" https://github.com/bytebeamio/rumqtt/tree/main/rumqttd "
i am now getting little trouble, in past when i was reboot the system home-assistant, zigbee2mqtt & mqtt broker all apps work after reboot but now my apps start but those are not communicate with each other. i have to give manually these commands systemctl restart zigbee2mqtt & then systemctl restart rumqttd then communication start working between all three of them.
I have write my rumqttd service file also the dietpi mosqitto service file. please guide me how i can fix this trouble & i want all three apps start working by itself every time after reboot.
only attached things zigbee2mqtt usb coordinator on USB, either-net wire & power wire. all data is written on self contain ssd. all dietpi standard installation.
root@wyse:~# journalctl -u zigbee2mqtt && journalctl -u rumqttd
Aug 26 13:52:10 wyse systemd[1]: Started zigbee2mqtt.service - zigbee2mqtt.
Aug 26 13:52:10 wyse systemd[1]: Started rumqttd.service - rumqttd.
this time homeassistant not showing sensors values. All three apllications home-assistant, rumqttd, zigbee2mqtt working. but those are not communicated with each other yet.
in all service files i made “StandardOutput=inherit” for more logs, still after just reboot sensors are not online
root@wyse:~# systemctl status zigbee2mqtt && systemctl status rumqttd && systemctl status home-assistant
● zigbee2mqtt.service - zigbee2mqtt
Loaded: loaded (/etc/systemd/system/zigbee2mqtt.service; enabled; preset: enabled)
Active: active (running) since Sun 2023-08-27 06:51:02 MDT; 2min 21s ago
Main PID: 488 (npm start)
Tasks: 31 (limit: 4496)
Memory: 160.3M
CPU: 10.450s
CGroup: /system.slice/zigbee2mqtt.service
├─488 "npm start"
├─809 sh -c "node index.js"
└─810 node index.js
Aug 27 06:51:02 wyse systemd[1]: Started zigbee2mqtt.service - zigbee2mqtt.
Aug 27 06:51:06 wyse npm[488]: > zigbee2mqtt@1.30.2 start
Aug 27 06:51:06 wyse npm[488]: > node index.js
Aug 27 06:51:07 wyse npm[810]: Zigbee2MQTT requires node version ^14 || ^16 || ^18 || ^19, you are running v20.5.1!
● rumqttd.service - rumqttd
Loaded: loaded (/etc/systemd/system/rumqttd.service; enabled; preset: enabled)
Active: active (running) since Sun 2023-08-27 06:51:02 MDT; 2min 21s ago
Main PID: 480 (rumqttd_active)
Tasks: 4 (limit: 4496)
Memory: 16.9M
CPU: 50ms
CGroup: /system.slice/rumqttd.service
└─480 /mnt/dietpi_userdata/rumqttd/rumqttd_active -c /mnt/dietpi_userdata/rumqttd/rumqttd.toml
Aug 27 06:51:02 wyse systemd[1]: Started rumqttd.service - rumqttd.
Aug 27 06:51:02 wyse rumqttd_active[480]:
Aug 27 06:51:02 wyse rumqttd_active[480]: ___ _ _ __ __ ___ _____ _____ ___
Aug 27 06:51:02 wyse rumqttd_active[480]: | _ \ | | | \/ |/ _ \_ _|_ _| \
Aug 27 06:51:02 wyse rumqttd_active[480]: | / |_| | |\/| | (_) || | | | | |) |
Aug 27 06:51:02 wyse rumqttd_active[480]: |_|_\\___/|_| |_|\__\_\|_| |_| |___/
Aug 27 06:51:02 wyse rumqttd_active[480]:
● home-assistant.service - Home Assistant (DietPi)
Loaded: loaded (/etc/systemd/system/home-assistant.service; enabled; preset: enabled)
Active: active (running) since Sun 2023-08-27 06:51:02 MDT; 2min 21s ago
Main PID: 479 (hass)
Tasks: 22 (limit: 4496)
Memory: 350.1M
CPU: 21.915s
CGroup: /system.slice/home-assistant.service
└─479 /home/homeassistant/.pyenv/versions/3.11.4/bin/python3.11 /home/homeassistant/.pyenv/versions/3.11.4/bin/hass -c /mnt/dietpi_userdata/homeassistant
Aug 27 06:51:02 wyse systemd[1]: Started home-assistant.service - Home Assistant (DietPi).
Aug 27 06:51:11 wyse Home Assistant[479]: 2023-08-27 06:51:11.344 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
Aug 27 06:51:46 wyse Home Assistant[479]: 2023-08-27 06:51:46.464 WARNING (Thread-5) [pychromecast.socket_client] [Android TV(192.168.1.91):8009] Heartbeat timeout, resetting connection
Aug 27 06:51:47 wyse Home Assistant[479]: 2023-08-27 06:51:47.044 WARNING (Thread-6) [pychromecast.socket_client] [gini(192.168.1.71):8009] Heartbeat timeout, resetting connection
As per my general sense, As rumqttd(mqtt broker) is standalone program. zigbee2mqtt & home assistant need to connect with username & password to mqtt broker. so i guess first mqtt broker need to start then zigbee2mqtt & home assistant on second position. this is my guess i am not expert in this. Is in dietpi software installed app there is any priority to start up? as mqtt broker install by dietpi works as zigbee2mqtt as custom app. so mqtt broker start before zigbee2mqtt. but now rumqttd & zigbee2mqtt comes on same custom app priority. thanks
You can set dependencies in your service files. Systemd services has options like Requires=,After=, Wants= and Before=.
I think you can simply use Before= and After=, you can edit them via dietpi-services.
If unit foo.service contains the setting Before=bar.service and both units are being started, bar.service 's start-up is delayed until foo.service has finished starting up. After= is the inverse of Before= , i.e. while Before= ensures that the configured unit is started before the listed unit begins starting up, After= ensures the opposite, that the listed unit is fully started up before the configured unit is started. https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=
I edited & added before & after in my service files. even then after reboot sensors are not coming online. sensors are come online after “systemctl restart zigbee2mqtt” & then “systemctl restart rumqttd”