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
_Home Assistant integration to expose an API to retrieve the camera stream source URL._
8
8
9
-
For example, it allows you to [import](#importing-cameras-from-home-assistant-to-go2rtc-and-frigate) Tuya, Nest and possibly other cameras to go2rtc and Frigate.
9
+
For example, it allows you to [import](#importing-cameras-from-home-assistant-to-go2rtc-or-frigate) Tuya, Nest and possibly other cameras to [go2rtc](https://github.com/alexxit/go2rtc) or [Frigate](https://github.com/blakeblackshear/frigate).
10
10
11
-
Note, however, that **this integration will only work if you are already able to view your camera stream in Home Assistant using[HLS](https://www.home-assistant.io/integrations/stream/)**.
11
+
Note, however, that **this integration will only work if you are already able to view your camera stream in Home Assistant through[HLS](https://www.home-assistant.io/integrations/stream/)**.
12
12
13
-
**For cameras that exclusively only work via WebRTC**(through the [RTSPToWebRTC Home Assistant integration](https://www.home-assistant.io/integrations/rtsp_to_webrtc/)), this method will not help. It is the case for [some specific Nest and Tuya cameras](https://github.com/felipecrs/hass-expose-camera-stream-source/issues/5), for example.
13
+
**For cameras that exclusively work through WebRTC**this integrationwill not help. It is the case for [certain Nest and Tuya cameras](https://github.com/felipecrs/hass-expose-camera-stream-source/issues/5), for example.
14
14
15
-
If that is your case:
15
+
Here are some alternatives:
16
16
17
-
- Nest WebRTC-native cameras are supported natively in go2rtc, see [here](https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#source-nest) for more details.
18
-
- Tuya WebRTC-native cameras are not supported either by Home Assistant or go2rtc. If you need it, you can express your interest in:
19
-
-https://github.com/AlexxIT/go2rtc/issues/315 (being worked on by @seydx, but you can [try it already](https://github.com/AlexxIT/go2rtc/issues/315#issuecomment-2905955963))
17
+
- Nest WebRTC-only cameras are supported natively in go2rtc through the [Nest source](https://github.com/AlexxIT/go2rtc?tab=readme-ov-file#source-nest).
18
+
- Tuya WebRTC-only cameras are not supported by Home Assistant, but native support in go2rtc is being worked on by @seydx, and you can [try it already](https://github.com/AlexxIT/go2rtc/issues/315#issuecomment-2905955963).
20
19
- Cameras that only support still images can be added to go2rtc through [this method](https://github.com/felipecrs/hass-expose-camera-stream-source/issues/53).
21
20
22
21
## Installation
@@ -37,98 +36,50 @@ Easiest install is via [HACS](https://hacs.xyz/):
37
36
38
37
Now the integration should be active.
39
38
40
-
## Importing cameras from Home Assistant to go2rtc and Frigate
41
-
42
-
This integration can be used to import cameras from Home Assistant to [go2rtc](https://github.com/alexxit/go2rtc) and [Frigate](https://github.com/blakeblackshear/frigate), **including cameras which does not expose a RTSP feed by default, like some Tuya and Nest cameras**.
43
-
44
-
### When go2rtc is running within the Frigate add-on
45
-
46
-
<details>
47
-
<summary>Click here to show</summary>
48
-
49
-
If you are running go2rtc within the Frigate add-on, you can use the following configuration:
50
-
51
-
> [!IMPORTANT]
52
-
> If using Frigate 0.16 Beta or newer, change the paths below from `/config/` to `/homeassistant/`.
39
+
## Importing cameras from Home Assistant to go2rtc or Frigate
40
+
41
+
This integration can be used to import cameras from Home Assistant to [go2rtc](https://github.com/alexxit/go2rtc) or [Frigate](https://github.com/blakeblackshear/frigate).
42
+
43
+
> [!IMPORTANT]
44
+
> Before importing to go2rtc, let's make sure a stream source is available for your camera. Simply run this command in the [Terminal](https://github.com/hassio-addons/addon-ssh) or [VS Code add-on](https://github.com/hassio-addons/addon-vscode):
> **Replacing** `camera.my_camera` with your camera entity ID.
51
+
>
52
+
> If you have **no access to add-ons**, you will need to replace `${SUPERVISOR_TOKEN}` with your Home Assistant long-lived access token and `http://supervisor/core` with the IP address or URL of your Home Assistant. Read below for more details. If you are on Windows, you can run that command in PowerShell by changing `curl` to `curl.exe`.
53
+
>
54
+
> After running it, it should output an RTSP or HTTP URL.
55
+
>
56
+
> **If it did not**, sorry but stream source is not available for your camera.
57
+
>
58
+
> **If it did, copy this URL and try to play it in [VLC](https://www.videolan.org/vlc/)**.
59
+
>
60
+
> Be quick though, some URLs expire after a few seconds if no connection is made. You can generate a new one by running the command again.
61
+
>
62
+
> **If it does not play in VLC**, it will not play in go2rtc or Frigate either. Sorry.
63
+
64
+
Here is an example of how to do it in your go2rtc configuration file:
Where `camera.my_camera` is the Home Assistant entity ID for the camera that you want to import the stream from.
73
-
74
-
</details>
75
-
76
-
### When go2rtc is running within Frigate via docker
77
-
78
-
<details>
79
-
<summary>Click here to show</summary>
80
-
81
-
When go2rtc is running within Frigate via docker, you need to prepare a Bash script to mount it to the Frigate container. Here is how the script should look like:
82
-
83
-
```bash
84
-
#!/usr/bin/env bash
85
-
86
-
set -eu
87
-
88
-
HA_TOKEN="${HA_TOKEN:?"HA_TOKEN is not set, make sure to have this environment variable set with your Home Assisant long-lived token."}"
Where `192.168.1.10` is your Home Assistant's IP address.
95
-
96
-
Paste the content above in a file named `get_ha_stream.sh`, and place it in your Frigate's `config` directory, beside your `frigate.yaml`. Then, give it execution permission with the following command:
97
-
98
-
```console
99
-
chmod +x /path/to/your/config/get_ha_stream.sh
100
-
```
101
-
102
-
You will also need a long-lived access token from Home Assistant. To generate one:
103
-
104
-
1. Go to your Home Assistant profile page: [](https://my.home-assistant.io/redirect/profile/)
105
-
2. Scroll down to _Long-Lived Access Token_, and click in _Create Token_.
106
-
3. Give it a name, like `go2rtc` and press _Ok_.
107
-
4. Copy your generated access token and save it. We will need it soon.
108
-
109
-
Now, you need to make sure your token is added as the `HA_TOKEN` environment variable. If you use Docker Compose, you just need to add something like the below in your configuration:
Where `camera.my_camera` is the Home Assistant entity ID for the camera that you want to import the stream from.
144
-
145
-
</details>
146
-
147
-
### When go2rtc is installed as an add-on
148
-
149
-
<details>
150
-
<summary>Click here to show</summary>
151
-
152
-
If you are running go2rtc as an add-on in Home Assistant, the process is a little simpler (if not, check [here](#when-go2rtc-is-running-via-docker)). Here's an example of the go2rtc configuration:
Where `camera.my_camera` is the Home Assistant entity ID for the camera that you want to import the stream from.
163
-
164
-
The `get_stream.sh` script is included by this integration. You can use it to get the stream source URL for any camera in Home Assistant from inside of any add-on.
165
-
166
-
Then, you can consume your go2rtc's `my_camera` stream in other applications like Frigate or other NVRs:
167
-
168
-
- `rtsp://192.168.1.10:8554/my_camera`
169
-
170
-
Where `192.168.1.10` is the IP which you can access the go2rtc interfaces (for add-on users it's the same IP as your Home Assistant).
94
+
**Replacing** `camera.my_camera` with your Home Assistant camera entity ID.
171
95
172
-
> **Tip:** Try to first play the RTSP link above in VLC before adding to Frigate or other NVRs, to ensure everything is working up to this point.
96
+
Note that **you do not need to replace `${SUPERVISOR_TOKEN}` or make any further changes** if you are running go2rtc through the [WebRTC integration](https://github.com/AlexxIT/WebRTC), [go2rtc add-on](https://github.com/AlexxIT/go2rtc#go2rtc-home-assistant-add-on), or [Frigate add-on](https://docs.frigate.video/frigate/installation#home-assistant-addon).
173
97
174
-
</details>
175
-
176
-
### When go2rtc is running via docker
177
-
178
-
<details>
179
-
<summary>Click here to show</summary>
180
-
181
-
When go2rtc is not running as a Home Assistant add-on, you need to prepare a Bash script and mount it to the go2rtc container. Here is how the script should look like:
182
-
183
-
```bash
184
-
#!/usr/bin/env bash
185
-
186
-
set -eu
187
-
188
-
HA_TOKEN="${HA_TOKEN:?"HA_TOKEN is not set, make sure to have this environment variable set with your Home Assisant long-lived token."}"
Where `192.168.1.10` is your Home Assistant's IP address.
195
-
196
-
Paste the content above in a file named `get_ha_stream.sh`, and place it beside your `go2rtc.yaml`. Then, give it execution permission with the following command:
197
-
198
-
```console
199
-
chmod +x /path/to/your/get_ha_stream.sh
200
-
```
201
-
202
-
You will also need a long-lived access token from Home Assistant. To generate one:
203
-
204
-
1. Go to your Home Assistant profile page: [](https://my.home-assistant.io/redirect/profile/)
205
-
2. Scroll down to _Long-Lived Access Token_, and click in _Create Token_.
206
-
3. Give it a name, like `go2rtc` and press _Ok_.
207
-
4. Copy your generated access token and save it. We will need it soon.
208
-
209
-
Now, you need to make sure the script you created earlier is mounted in the go2rtc container, and your token is added as the `HA_TOKEN` environment variable. If you use Docker Compose, you just need to add something like the below in your configuration:
And here is an example of the go2rtc configuration:
227
-
228
-
```yaml
229
-
# go2rtc.yaml
230
-
231
-
streams:
232
-
my_camera:
233
-
- echo:/config/get_ha_stream.sh camera.my_camera
234
-
```
235
-
236
-
Where `camera.my_camera` is the Home Assistant entity ID for the camera that you want to import the stream from.
237
-
238
-
Then, you can consume your go2rtc's `my_camera` stream in other applications like Frigate or other NVRs:
239
-
240
-
- `rtsp://192.168.1.10:8554/my_camera`
241
-
242
-
Where `192.168.1.10` is the IP which you can access the go2rtc interfaces (for add-on users it's the same IP as your Home Assistant).
243
-
244
-
> **Tip:** Try to first play the RTSP link above in VLC before adding to Frigate or other NVRs, to ensure everything is working up to this point.
245
-
246
-
</details>
247
-
248
-
### When go2rtc is running via the WebRTC integration
249
-
250
-
<details>
251
-
<summary>Click here to show</summary>
252
-
253
-
When go2rtc is not running as a Home Assistant add-on neither via an add-on, but as part of the WebRTC integration, you need to prepare a Bash script in your `/config` directory.
254
-
255
-
First, you will need a long-lived access token from Home Assistant. To generate one:
98
+
**Otherwise**, you need to replace `${SUPERVISOR_TOKEN}` with your Home Assistant long-lived access token. To generate one:
256
99
257
100
1. Go to your Home Assistant profile page: [](https://my.home-assistant.io/redirect/profile/)
258
101
2. Scroll down to _Long-Lived Access Token_, and click in _Create Token_.
259
102
3. Give it a name, like `go2rtc` and press _Ok_.
260
-
4. Copy your generated access token and save it. We will need it soon.
261
-
262
-
Then, you can create the script. Here is how the script should look like:
263
-
264
-
```bash
265
-
#!/usr/bin/env bash
266
-
267
-
set -eu
268
-
269
-
HA_TOKEN="<put your long-lived access token here>"
Paste the content above in a file named `get_ha_stream.sh`, and place it in Home Assistant's `/config` directory. Do not forget to put your long-lived access token in the script's placeholder.
276
103
277
-
Then, give it execution permission with the following command:
278
-
279
-
```console
280
-
chmod +x /config/get_ha_stream.sh
281
-
```
282
-
283
-
And here is an example of the go2rtc configuration:
104
+
**Additionally**, you need to replace `http://supervisor/core` with the IP address or URL of your Home Assistant instance. Example:
Where `camera.my_camera` is the Home Assistant entity ID for the camera that you want to import the stream from.
294
-
295
-
Then, you can consume your go2rtc's `my_camera` stream in other applications like Frigate or other NVRs:
296
-
297
-
- `rtsp://192.168.1.10:8554/my_camera`
298
-
299
-
Where `192.168.1.10` is the IP which you can access the go2rtc interfaces (for add-on users it's the same IP as your Home Assistant).
300
-
301
-
> **Tip:** Try to first play the RTSP link above in VLC before adding to Frigate or other NVRs, to ensure everything is working up to this point.
302
-
303
-
</details>
304
-
305
112
## Bonus: importing Tuya cameras to go2rtc without Home Assistant
306
113
307
114
This repository also provides a script that is able to operate without Home Assistant, allowing you to import Tuya cameras to go2rtc without the need of Home Assistant.
0 commit comments