| 1 |
# Home Assistant |
| 2 |
|
| 3 |
Upstream docs: <https://developers.home-assistant.io/docs/api/rest/> |
| 4 |
|
| 5 |
The Home Assistant service sends notifications through the REST API using a long-lived access token. |
| 6 |
By default it creates a persistent notification in the Home Assistant frontend. |
| 7 |
An optional `service` query parameter can target notify actions such as companion-app notifiers. |
| 8 |
|
| 9 |
## URL Format |
| 10 |
|
| 11 |
!!! info "" |
| 12 |
homeassistant://__`token`__@__`host`__[:__`port`__][/__`basepath`__] |
| 13 |
|
| 14 |
--8<-- "docs/services/push/homeassistant/config.md" |
| 15 |
|
| 16 |
## Getting Started |
| 17 |
|
| 18 |
1. Open your Home Assistant profile. |
| 19 |
2. Create a __Long-Lived Access Token__. |
| 20 |
3. Use the token as the URL username and your instance hostname as the host. |
| 21 |
|
| 22 |
When the port is omitted, HTTPS uses port `443` and HTTP (`disabletls=yes`) uses port `8123`. |
| 23 |
|
| 24 |
!!! example "HTTPS reverse proxy" |
| 25 |
```uri |
| 26 |
homeassistant://[email protected] |
| 27 |
``` |
| 28 |
|
| 29 |
!!! example "LAN HTTP" |
| 30 |
```uri |
| 31 |
homeassistant://[email protected]:8123/?disabletls=yes |
| 32 |
``` |
| 33 |
|
| 34 |
`disabletls=yes` sends the long-lived Bearer token over HTTP. Use it only on a trusted, isolated network. |
| 35 |
|
| 36 |
!!! example "Replace an existing persistent notification" |
| 37 |
```uri |
| 38 |
homeassistant://[email protected]:8123/?disabletls=yes&nid=watchtower&title=Update |
| 39 |
``` |
| 40 |
|
| 41 |
`disabletls=yes` sends the long-lived Bearer token over HTTP. Use it only on a trusted, isolated network. |
| 42 |
|
| 43 |
!!! example "Companion app notifier" |
| 44 |
```uri |
| 45 |
homeassistant://[email protected]?service=notify.mobile_app_phone |
| 46 |
``` |
| 47 |
|
| 48 |
## Parameters |
| 49 |
|
| 50 |
- __`title`__: Optional notification title. Omitted from the request when empty. |
| 51 |
- __`service`__: Home Assistant action. Empty defaults to `persistent_notification.create`. A value without a dot is sent as `notify/<value>`. A value with a dot is sent as `<domain>/<action>`. |
| 52 |
- __`targets`__: Comma-separated notify destinations. Sent as the Home Assistant `target` field and omitted for persistent notifications. |
| 53 |
- __`nid`__: Persistent notification ID. When set, Home Assistant overwrites the notification with that ID. Omitted when empty. |
| 54 |
- __`disabletls`__: Use HTTP instead of HTTPS. |
| 55 |
- __`skiptlsverify`__: Skip TLS certificate verification. Use only with self-signed certificates. |
| 56 |
|
| 57 |
The request is `POST /api/services/{domain}/{service}` with `Authorization: Bearer <token>` and a JSON body containing `message` plus any optional fields above. |
| 58 |
|
| 59 |
Webhook triggers that fire automations are not part of this service. Those endpoints do not use a long-lived access token. |