Document installation and add systemd unit files
This commit is contained in:
parent
a6e721009e
commit
a67afb7e90
4 changed files with 50 additions and 8 deletions
34
README.md
34
README.md
|
@ -18,16 +18,36 @@ Ideas:
|
|||
- Camera video stream
|
||||
- Idle time (→ libseat)
|
||||
|
||||
## Installation and configuration
|
||||
## Installation
|
||||
|
||||
TBD
|
||||
### As a systemd _system_ service
|
||||
|
||||
Hassliebe uses different paths depending on whether it is run as root or as a normal user:
|
||||
- Download [the latest binary](https://git.moritzruth.de/moritzruth/Hassliebe/releases) and put it into `/usr/bin`.
|
||||
- Download [the unit file](distrib/systemd/system/hassliebe.service) and put it into `/etc/systemd/system`.
|
||||
- Create the configuration file (see below) at `/etc/hassliebe/config.toml`.
|
||||
- Enable and start the unit:
|
||||
|
||||
- `[data]`: `/var/lib/hassliebe` / `$XDG_DATA_HOME/hassliebe`
|
||||
- `[config]`: `/etc/hassliebe/config.toml` / `$XDG_CONFIG_HOME/hassliebe/config.toml`
|
||||
```sh
|
||||
systemctl enable hassliebe && systemctl start hassliebe
|
||||
```
|
||||
|
||||
Example:
|
||||
### As a systemd _user_ service
|
||||
|
||||
- Download [the latest binary](https://git.moritzruth.de/moritzruth/Hassliebe/releases) and put it into `~/.local/bin`.
|
||||
- Download [the unit file](distrib/systemd/user/hassliebe.service) and put it into `~/.local/share/systemd/user`.
|
||||
- Create the configuration file (see below) at `$XDG_CONFIG_HOME/hassliebe/config.toml`.
|
||||
- Enable and start the unit:
|
||||
|
||||
```sh
|
||||
systemctl --user enable hassliebe && systemctl --user start hassliebe
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Depending on whether Hassliebe is run as root or as a regular user, the configuration is read from
|
||||
`/etc/hassliebe/config.toml` or `$XDG_CONFIG_HOME/hassliebe/config.toml`.
|
||||
|
||||
### Example
|
||||
|
||||
```toml
|
||||
friendly_id = "my_pc" # Used as prefix for MQTT topics and Home Assistant IDs
|
||||
|
@ -124,7 +144,7 @@ Complex messages have these properties:
|
|||
- `timeout` (optional) — Controls how long the notification will stay.
|
||||
- `"default"` (default) — use the default value of the notification server
|
||||
- `"never"` — stay until manually dismissed
|
||||
- `{ ms: [millseconds] }` — stay for `[milliseconds]`
|
||||
- `{ "ms": [millseconds] }` — stay for `[milliseconds]`
|
||||
- `urgency` (optional) — One of: `"low"`, `"normal"` (default), `"critical"`.
|
||||
- `summary_text` — The primary text content, often used as title. Must not be empty.
|
||||
- `long_content` (optional) — Optional additional content
|
||||
|
|
11
distrib/systemd/system/hassliebe.service
Normal file
11
distrib/systemd/system/hassliebe.service
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Home Assistant integration daemon
|
||||
Documentation=https://git.moritzruth.de/moritzruth/Hassliebe
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/hassliebe
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
11
distrib/systemd/user/hassliebe.service
Normal file
11
distrib/systemd/user/hassliebe.service
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Home Assistant integration daemon
|
||||
Documentation=https://git.moritzruth.de/moritzruth/Hassliebe
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=%h/.local/bin/hassliebe
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
|
@ -104,7 +104,7 @@ async fn main() -> Result<()> {
|
|||
|
||||
if env::args().any(|a| a == "-v" || a == "--version" || a == "-h" || a == "--help") {
|
||||
println!("Hassliebe v{} is licensed under the Blue Oak Model License 1.0.0.", env!("CARGO_PKG_VERSION"));
|
||||
println!("See https://git.moritzruth.de/moritzruth/Hassliebe for more information.");
|
||||
println!("See {} for more information.", env!("CARGO_PKG_HOMEPAGE"));
|
||||
exit(exitcode::OK);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue