You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Containers/Home-Assistant.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -222,6 +222,65 @@ $ cd ~/IOTstack
222
222
$ docker-compose up -d
223
223
```
224
224
225
+
## Adding https access to your Home Assistant
226
+
227
+
Some HA integration (e.g google assistant) require your HA to be accessible
228
+
through https. This tells you how to use a [linuxserver swag container](https://docs.linuxserver.io/general/swag) ([Docker hub docs](https://hub.docker.com/r/linuxserver/swag)) to automatically generate a SSL-certificate and setup a reverse proxy.
229
+
230
+
1. First test your HA is working correctly: `http://raspberrypi.local:8123/` (assuming
231
+
your RPi hostname is raspberrypi)
232
+
2. Make sure you have duckdns working.
233
+
3. On your internet router, forward public port 443 to the RPi port 443
234
+
4. Add swag to ~/IOTstack/docker-compose.yml beneath the `services:`-line:
235
+
```
236
+
swag:
237
+
image: ghcr.io/linuxserver/swag
238
+
cap_add:
239
+
- NET_ADMIN
240
+
environment:
241
+
- PUID=1000
242
+
- PGID=1000
243
+
- TZ=Etc/UTC
244
+
- URL=<yourdomain>.duckdns.org
245
+
- SUBDOMAINS=wildcard
246
+
- VALIDATION=duckdns
247
+
- DUCKDNSTOKEN=<token>
248
+
- CERTPROVIDER=zerossl
249
+
- EMAIL=<e-mail> # required when using zerossl
250
+
volumes:
251
+
- ./volumes/swag/config:/config
252
+
ports:
253
+
- 443:443
254
+
restart: unless-stopped
255
+
networks:
256
+
- iotstack_nw
257
+
```
258
+
5. Start the swag container (creates the file to be edited in the next step): `cd ~/IOTstack && docker-compose up -d` and check it started OK `docker-compose logs -f swag`
259
+
6. Rename the file volumes/swag/config/nginx/proxy-confs/homeassistant.subdomain.conf.sample to remove .sample from the filename.
260
+
7. Enable reverse proxy to `raspberrypi.local` and fix homeassistant container name:
8. Add `use_x_forwarded_for` and `trusted_proxies` to your homeassistant [http config](https://www.home-assistant.io/integrations/http). For a default install the result will be:
272
+
```
273
+
http:
274
+
use_x_forwarded_for: true
275
+
trusted_proxies:
276
+
- 172.16.0.0/12
277
+
- 10.77.0.0/16
278
+
```
279
+
9. Refresh the stack: `cd ~/IOTstack && docker-compose stop && docker-compose up -d`
280
+
10. Test homeassistant is still working correctly: `http://raspberrypi.local:8123/` (assuming your RPi hostname is raspberrypi)
281
+
11. Test the reverse proxy is working correctly: `https://raspberrypi.local/` (note: https)
282
+
12. And finally test your router forwards correctly by accessing it from outside your LAN(e.g. using a mobile phone): `https://homeassistant.<yourdomain>.duckdns.org/`
0 commit comments