quick question, how do you get the camera_image: camera.localtion.event camera? Is that the same as camera.location.snapshot?
Would this disadvantage you speak of affect setting this up?
Real-Time Picture-in-Picture Camera Feeds on your TV with Home Assistant | Sean Blanchfield
Iām able to get this working with all my cameraās except my ring cameras, and Iām assuming itās since the url of the script calls the public domain address which would be considered outside my network.
I wouldnāt think so. That setup uses WebRTC Camera addon which works fine with ring-mqtt in my testing. Are you using the same method for all of your other cameras?
Itās just whichever camera you want to come up automatically when you click the image. In the end, yes, itās the snapshot camera, assuming you configured the Still Image URL for the camera to the snapshot image. I mean, you can use any image you want, but I like the snapshot images to be there, then I can click the image to see the most recently recorded event (or other selected event), or click the camera icon to see a live stream.
You can set it up however you personally like, this is just my setup.
Yup, in testing all I did was swap out my ring camera entity with another camera entity and called the script again. The others all come up, the 2 ring cameras donāt load.
I donāt know anything about your setup. Are the other cameras using RTSP? Are the cameras, HA instance and ring-mqtt addon all running on the same local network?
If the other cameras are also RTSP then itās hard to see how these two things can be different because basically the setup for a normal RTSP camera is:
Native Camera RTSP Stream ā RTSPtoWebRTC ā PIPup
While for Ring with ring-mqtt itās:
Ring Camera ā Ring Server RTP Stream ā ring-mqtt RTSP Stream ā RTSPtoWebRTC ā PIPup
So, from the RTSP perspective, thereās no difference in network path, itās just that the stream has two extra hops before it gets to the RTSP server, while most ānormalā cameras do RTSP locally. Basically, ring-mqtt just functions as an RTSP gateway for Ring cameras so, from the RTSP server on, the behavior should be the same.
Since I know that ring-mqtt works with RTSPtoWebRTC, then itās hard to understand why it wouldnāt work. Maybe itās simply the extra delay in setting up the stream since Ring cameras are on-demand so it takes 2-3 seconds for the stream to start, I donāt know.
However, you might have more success using Scrypted vs ring-mqtt for this use case. It offers native WebRTC (and RTSP) re-broadcast and its video pipeline is far more sophisticated vs ring-mqtt since itās focus is on video vs ring-mqtt being primarily focused on sensors. I highly recommend Scrypted if you are wanting advanced integration with Ring camera video functions as ring-mqtt will never offer this level of video integration capability. Heck, sometimes I think I should just remove video support from ring-mqtt because Scrypted does it better, but itās quite a heavy app for some systems so I keep it in there for now.
Quickly looked into Scrypted, it appears it will run on HA but not integrate into it to view the cameras? It seems to support google home, apple homekit and alexa.
Unless Iām looking at a completely different Scrypted lol
EDIT:
OK, I see how it works. First install the ring plugin, authenticate, then using the rebroadcast plugin you can broadcast a webrtc stream, and it provides the rtsp stream url. Loaded those up as a generic camera, put that entity in the script for pipup and Iāve got a working live view of my front and side doorbells on my tv. Thanks for pointing me in the right direction!
I donāt know why Scrypted works and ring-mqtt doesnāt since they basically do the same thing, even use the same API on the back side, but the stream processing in Scrypted is significantly more advanced and it uses a native RTSP server implementation instead of gatewaying the stream via rtsp-simple-server.
However, Scrypted does one even better, it can provide a native WebRTC rebroadcast as well, which means you could pull the stream directly from Scrypted without having to gateway to RTSP and back to WebRTC as the blog above suggest.
In the end, Iām guessing you could have probably just setup a manual channel in RTSPtoWeb (or RTSPtoWebRTC) and just used that in the script with ring-mqtt, but Iām glad you managed to get it working.
If I ever get an Android TV, I guess Iāll have to play with it to see why it doesnāt work out of box, although with the changes in v5 to use WebRTC on the Ring side maybe it will work going forward. Hopefully in a few months weāll have native WebRTC playback in HA with Ring cameras which is really the ideal scenario.
Iāve been playing around a bit with this integration the last couple of days. And I wanted to share my experiences, first off: love this integration!. I have a running subscription with Ring, so I should be able to download the vids, and that seems to work (btw, maybe a suggestion to your manual; the downloader service should be enabled, didnāt have that at first).
What I found very important to understand is if there is a Live video, it doesnāt detect motion. I know it has been mentioned number of times before, but it is really key. Besides this, it is important to understand the motion doesnāt work separately from the ring.com app. Motion zones and motion-free schedules get respected, even from the app. Makes perfect sense, but it had to sink down a bit for me. The Live motion part comes really into play for me because I have been playing around with RTSPtothewebRTC docker container, when connected to HA, HA pushes the stream to this server and keeps it constant running.
I have 2 ring cameraās. A videodoorbell Pro2 and a spotlight cam. Both are added just fine to MQTT and with the running streaming server I managed to add both of them as a generic camera (@tsightler just a quick headsup, in your readme it still says you have to add them by adding to the config.yaml, this possibility has been removed).
The thing I cannot seem to get my head on is the āevent-selectā and āevent-streamā. I wanted to create the same camera card as mentioned above, want to use the event selectors too. Where does the event-stream look for the videoās. What is supposed to happen when I click the cassette? Iād imagine it should start the video corresponding with the downloaded one based on motion1 - 5, right?
The event stream is just a separate RTSP path that streams the recording of the selected event directly from the recording URL instead of streaming the live view from the camera. It really doing the same thing as downloading that recording, but instead of writing it to disk, itās streaming the recording back as a camera so it can be viewed on demand just by connecting to the RTSP URL. To use it in HA, you just add another generic camera to HA that uses the RTSP URL ending with _event
instead of _live
, thatās literally all there is to it.
Effectively, for my setup, each individual Ring camera is represented by three cameras in HA, the snapshot camera, the live camera, and the event camera. The snapshot camera is an MQTT camera, so itās automatically discovered as long as MQTT is setup, and it of course limited to only still images since MQTT canāt really do streaming, but thatās perfect for snapshots. The live and event cameras user RTSP so you need to add each camera separately and the recommended setup is the use the snapshot camera as the source for the still image URL for both the live and event cameras.
Then, when configuring the picture glance card, you just use whichever camera you want to come up when you click the picture as the āCamera Entityā of the picture glance card, and the add the other one as just as a secondary entity in the āEntitiesā section of the picture glance card which will give you an icon to click to bring up that camera. In my case I like the event camera to come up when I click the image, so the event camera is the āCamera Entityā, while the live camera is in the āEntitiesā section so I can easily access either live or selected event with just a single click.
Nothing, the cassette is just an āactiveā indicator to show if the event stream is currently active or not. You can use the icon to stop the stream manually, but you cannot start an event stream manually because, unlike the live stream, thereās really no reason to start an event stream if thereās nobody viewing it. On the other hand, starting a live stream manually might be useful for manually triggering a recording via an automation based on something other than a Ring device.
The event stream always plays the recording directly from the URL where it is stored on Ringās servers, it does not play back downloaded recordings.
Thanks a lot for your answers! The _event camera I was missing! I can now see the latest event. I have these 3 entities for my cameraās too. I donāt seem to get how to add the still image url to my cameraās. If I try and proxy them, Iām getting a 401 unauthorized. But do you still need it, because the Generic camera integration seems to get the still image from the feed. Or does it start a live event to grap this still picture?
Right, so downloading the MP4 is just for reference / backup. I experimented a bit yesterday with the switching from motion 1 to 5 and if the ring api reports back the movie itāll get played by the event camera so yes, thanks a lot!
You just use the URL to your HA instance with the template which pulls the image from the HA camera proxy for the snapshot camera. The template resolves to the value of the entity_picture attribute, which includes the authentication token needed for accessing the still image via the camera proxy. You canāt just hard code the URL, unless you provide a username/password, because the token changes every 5 minutes, which is why I recommend using the template to resolve the path so it will always have the current token.
If you donāt provide the still image URL I believe it starts a stream to generate the image, which is less than ideal IMO.
Great AddOn!
Iām trying to use the snapshots in an automations in order to save them on motion. I tried this by calling the following on motion, to download the image from the attribute (based on this post: Using a variable (attribute) as a url for downloading - #12 by CrouchingWorm).
service: downloader.download_file
data_template:
url: https://192.168.2.253:8123/api/camera_proxy/camera.front_door_snapshot?token=3fa23de984a746b5a9e1cf3b06a6114100ceba5a5b8615f12bae0b05c9b2bce4
subdir: Doorbell/May 2022/
filename: Bell Snapshot - {{ now().strftime("%d-%m-%Y- %H.%M.%S") }}.jpg
This results in all sorts of security notifications from HA:
Now I understand this does not directly have to do with the AddOn, but maybe there are other of itās users here that try to accomplish the same. The downloader is to be called after the following in an automation:
- conditions:
- condition: trigger
id: doorbell_oncameramotion
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.front_door_live_stream
- service: timer.start
data:
duration: '00:04:00'
target:
entity_id: timer.front_door_camera_stream
- service: camera.snapshot
data:
filename: >-
/media/Doorbell/{{ now().strftime("%B %Y") }}/Motion Snapshot -
{{ now().strftime("%d-%m-%Y- %H.%M.%S") }}.jpg
target:
entity_id: camera.03cabcc9_ring_mqtt
- service: camera.record
data:
filename: >-
/media/Doorbell/{{ now().strftime("%B %Y") }}/Motion Video - {{
now().strftime("%d-%m-%Y- %H.%M.%S") }}.mp4
duration: 240
target:
entity_id: camera.03cabcc9_ring_mqtt
- conditions:
- condition: trigger
id: timer_finish
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.front_door_live_stream
The later video recording works, but downloading the snapshot doesnāt. Am I missing something?
Right I agree it is less than ideal, but I canāt seem to get it to work.
Unknown error occurred is the error if I add the follwoing:
http://192.168.21.9:8123{{ states.camera.voordeur_snapshot.attributes.entity_picture }}
The IP is 100% correct and the camer.voordeur_snapshot is the correct snapshot camera.
And advise to troublwshoot the unknown error?
This is caused by a bug in the 2022.4.x releases of Home Assistant which causes HA to be unable to generate a name for a URL with a template in certain cases. I believe it should be fixed in the 2022.5 release which I think was released just today.
If you donāt want to upgrade right away a viable workaround is to add ā/.ā immediate after the port number in the URL so the URL above would become:
http://192.168.21.9:8123/.{{ states.camera.voordeur_snapshot.attributes.entity_picture }}
Just did a refresh, but the docker container hasnāt been updated yet, tnx ! Iāll wait for the new version then, thanks! Itās updating now
With the /. Iām getting a error it didnāt return a valid still image.
Humpfffā¦ with the 2022.5 it gives the same result, doesnāt return a valid still image. This worked 100% sure in the configuration.yaml config.ā¦ osi-layer 8ā¦ made a typo. Works, thanks! again!
That solved my question too.
@tsightler not sure why, but the live video feed is no longer working for me. Iām getting the error below in the logsā¦ Iām running v4.9.1 on HA 2022.5.1
The addon is reporting that it is successfully connected, and if I double check the stream_source URL under the info sensor entity, it still matches whatās in the configuration.yaml file.
Any ideas?
Logger: homeassistant.components.stream.stream.camera.front_door_video
Source: components/stream/__init__.py:347
Integration: Stream (documentation, issues)
First occurred: 19:47:09 (25 occurrences)
Last logged: 20:39:12
Error from stream worker: Error opening stream (INVALIDDATA, Invalid data found when processing input) rtsp://xxxxxxxx-ring-mqtt:8554/xxxxxxxxxxxx_live
Itās pretty much impossible to tell from the limited information provided but you should check the UI configuration for camera since configuration.yaml is no longer a valid method for configuration the Generic Camera component of HA. Iāve tested the 4.9.1 release with 2022.5.1 and everything continues to work as expected.
Ah sorry for the lack of info. Rather then configuring via configuration.yaml, how should I be configuring the camera now?