@@ -55,19 +55,28 @@ use your default NIC and listen on port `8080`.
55
55
56
56
If your system is using Systemd, you can use the following unit file to run the companion on system boot:
57
57
58
- ``` ini
59
- # sudo vi /etc/systemd/system/hacompanion.service
58
+ ``` shell
59
+ mkdir -p ${XDG_CONFIG_HOME:- $HOME / .config} /systemd/user
60
+ ${EDITOR:- vi} " ${XDG_CONFIG_HOME:- $HOME / .config} /systemd/user/hacompanion.service"
61
+ ```
60
62
63
+ ``` ini
61
64
[Unit]
62
65
Description =Home Assistant Desktop Companion
66
+ Documentation =https://github.com/tobias-kuendig/hacompanion
67
+ # Uncomment the line below if you are using NetworkManager to ensure hacompanion
68
+ # only starts after your host is online
69
+ # After=NetworkManager-wait-online.service
63
70
64
71
[Service]
65
- User =user-username # Change this
66
- Group =user-username # Change this
67
- ExecStart =/path/to/hacompanion -config =/home/yourname/.config/hacompanion.toml # Change this
68
- Type =simple
72
+ # Load ~/.config/hacompanion/env where you can for example set
73
+ # HASS_TOKEN, HASS_DEVICE_NAME etc.
74
+ EnvironmentFile =%E/hacompanion/env
75
+ # Make sure to set the absolute path to hacompanion correctly below
76
+ ExecStart =%h/.local/bin/hacompanion -config =%E/hacompanion.toml
69
77
Restart =on-failure
70
- RuntimeMaxSec =604800
78
+ RestartSec =5
79
+ Type =simple
71
80
72
81
[Install]
73
82
WantedBy =multi-user.target
@@ -76,9 +85,12 @@ WantedBy=multi-user.target
76
85
Start the companion by running:
77
86
78
87
``` bash
79
- sudo service hacompanion start
80
- # check status with
81
- # sudo service hacompanion status
88
+ systemctl --user daemon-reload
89
+ systemctl --user enable --now hacompanion
90
+ # check status with:
91
+ # systemctl --user status hacompanion
92
+ # and logs with:
93
+ # journalctl --user -xlf -u hacompanion
82
94
```
83
95
84
96
## Custom scripts
0 commit comments