Autostart aller Home Assistant Dienste

      Kommentare deaktiviert für Autostart aller Home Assistant Dienste

Home Assistant (Kurz Zusammenfassung)

https://www.home-assistant.io/docs/autostart/systemd/

Datei anlegen (sudo nano /etc/systemd/system/[service_name]@[your user].service)

sudo nano /etc/systemd/system/home-assistant@homeassistant.service

Folgenden Inhalt in Datei kopieren (Shift + Insert)

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
ExecStart=/srv/homeassistant/bin/hass -c "/home/homeassistant/.homeassistant"

[Install]
WantedBy=multi-user.target

Aktivieren und starten

sudo systemctl --system daemon-reload
sudo systemctl enable home-assistant@homeassistant
sudo systemctl start home-assistant@homeassistant

Restart

sudo systemctl restart home-assistant@homeassistant

Configurator (Kurz Zusammenfassung)

sudo nano /etc/systemd/system/hassconfigurator.service

Folgenden Inhalt in Datei kopieren (Shift + Insert)

[Unit]
Description=HASS-PoC-Configurator
After=network.target

[Service]
Type=simple
#Set the path to your configurator.py location
ExecStart=/usr/bin/python3 /home/homeassistant/.homeassistant/configurator.py

[Install]
WantedBy=multi-user.target

Aktivieren und starten

sudo systemctl --system daemon-reload
sudo systemctl enable hassconfigurator.service
sudo systemctl start hassconfigurator.service

Wichtige systemd Befehle

Deamons neu laden

sudo systemctl --system daemon-reload

Service aktivieren/deaktivieren

sudo systemctl enable [service_name]@[your user]

sudo systemctl disable [service_name]@[your user]

Service starten / stoppen / neu starten / status

sudo systemctl start[service_name]@[your user]

sudo systemctl stop[service_name]@[your user]

sudo systemctl restart[service_name]@[your user]

sudo systemctl status[service_name]@[your user]

Service output loggen

Alles ausgeben

sudo journalctl -f -u [service_name]@[your user]

Nur Fehler ausgeben

sudo journalctl -f -u home-assistant@[your user] | grep -i 'error'