21 lines
1.4 KiB
Markdown
21 lines
1.4 KiB
Markdown
# Home Assistant files
|
|
|
|
Three files to connect Home Assistant to Kilometer Log. They are the same as what the app shows under **Admin → Home Assistant**, filled in for a Volvo XC40.
|
|
|
|
| File | Where it goes |
|
|
|---|---|
|
|
| `configuration.yaml` | Add to Home Assistant's `configuration.yaml`, then restart Home Assistant. |
|
|
| `secrets.yaml.example` | Add the line to Home Assistant's `secrets.yaml`, with your `HA_TOKEN` after `Bearer `. |
|
|
| `automation.yaml` | *Settings → Automations & scenes → Create automation → ⋮ → Edit in YAML*: replace everything with it and save. |
|
|
|
|
Before you use them:
|
|
|
|
- **Plate:** replace `AB-123-C` in `configuration.yaml` with your car's plate.
|
|
- **Entity names:** if your car's entities have other names than `sensor.volvo_xc40_odometer` and `device_tracker.volvo_xc40_location`, change them in `automation.yaml`.
|
|
- **Address:** `configuration.yaml` reaches the app over Docker's internal network, at `http://kilometer-log:3000`.
|
|
- Home Assistant runs with `network_mode: host`? Use `http://127.0.0.1:3077` and uncomment the `ports:` lines in the compose file.
|
|
- Using the public address instead? Use the exact `https://` address, without a redirect.
|
|
|
|
To test it, open the automation and choose **Run actions**. After a minute, Admin → Home Assistant shows "First reading saved".
|
|
The automation reads the sensor directly, so this manual test works; older versions used `trigger.to_state` and failed when run by hand.
|