Debian Codegraph @

docs/examples/home-assistant/index.md

raw
1 # Home Assistant
2
3 ## Overview
4
5 Home Assistant can receive Shoutrrr notifications in two ways.
6
7 Use the dedicated `homeassistant` service to create persistent notifications or call notify actions through the REST API with a long-lived access token.
8
9 Use a webhook URL only when an automation should run from an unauthenticated `POST` to `/api/webhook/<webhook_id>`.
10
11 ## REST notifications
12
13 Create a long-lived access token in your Home Assistant profile, then send to the REST API.
14
15 === "HTTPS (Default)"
16
17 ```url title="Home Assistant REST URL for HTTPS"
18 homeassistant://<LONG_LIVED_TOKEN>@<HA_HOST>
19 ```
20
21 === "HTTP"
22
23 ```url title="Home Assistant REST URL for HTTP"
24 homeassistant://<LONG_LIVED_TOKEN>@<HA_HOST>:8123/?disabletls=yes
25 ```
26
27 !!! Example
28 ```bash title="Send a persistent notification"
29 shoutrrr send --url "homeassistant://[email protected]:8123/?disabletls=yes&title=Update" --message "Hello, Home Assistant!"
30 ```
31
32 ```text title="Expected Output"
33 Notification sent
34 ```
35
36 Reuse `nid` when later messages should replace the same persistent notification instead of stacking.
37
38 ```url
39 homeassistant://[email protected]:8123/?disabletls=yes&nid=watchtower
40 ```
41
42 Call a notify action such as a companion-app notifier with `service`:
43
44 ```url
45 homeassistant://[email protected]?service=notify.mobile_app_phone
46 ```
47
48 ## Webhook trigger
49
50 Configure a webhook trigger in Home Assistant, then POST JSON to `/api/webhook/<WEBHOOK_ID>`.
51 In the automation, read the message from `{{ trigger.json.message }}`.
52
53 === "HTTPS (Default)"
54
55 ```url title="Generic Service URL for HTTPS"
56 generic://<HA_IP_ADDRESS>:<HA_PORT>/api/webhook/<WEBHOOK_ID>?template=json
57 ```
58
59 === "HTTP"
60
61 ```url title="Generic Service URL for HTTP"
62 generic://<HA_IP_ADDRESS>:<HA_PORT>/api/webhook/<WEBHOOK_ID>?template=json&disabletls=yes
63 ```
64
65 !!! Example
66 ```bash title="Send Command to a webhook"
67 shoutrrr send --url "generic://192.168.1.100:8123/api/webhook/abc123?template=json&disabletls=yes" --message "Hello, Home Assistant!"
68 ```
69
70 ```text title="Expected Output"
71 Notification sent
72 ```
73
74 !!! Note
75 Webhook IDs are unauthenticated. Treat them like passwords and keep `local_only` enabled unless internet access is required.