Ring Device integration via MQTT w/ Video Streaming

Thanks that worked!

Hello all!

‘Rebooting’ my HA server. Attempting to get ring-mqtt set up. I am doing the Docker install. I get this in the logs:

Refresh token is not valid. Unable to authenticate with Ring servers. See Refresh Tokens · dgreif/ring Wiki · GitHub

I was able to authenticate with Ring using the method described in the install instructions. I authenticated twice, just to make sure.

I receive “refreshToken”: “token”. I paste that into my docker-compose.yaml for the RINGTOKEN environment variable. The string that I get back has a space between the ‘:’ and the start of the token, but the yaml file does not like that, so I remove it. Would that cause an issue? I wouldn’t think so, but I do not know what else it could be.

Nevermind.

I did some more tinkering. The info one gets back from the authentication method, at least to me, is a bit unclear. It seemed to indicate that 'refreshToken": “token” all needed to be copied into the docker-compose.yaml.

This is not correct. For anyone else who might run into this in the future: You only need to copy the token portion, and DO NOT INCLUDE THE QUOTES! :slight_smile:

It’s working now.

Thank you!

1 Like

This has been a while ago, and I swore I saw a card for this add-on and now cannot find it. You’re card looks awesome, could you share the configuration? It appears some of the cards used are no longer maintained, though may still be usable.

This looks amazing! Loving the integration so far.
Can you please share the configuration for your card?

Thank you!!

I use a slightly different configuration these days, it’s just a picture glance card that looks like this:

The image itself is the still image from the snapshot camera which is pulled in automatically since the still image URL is defined in the generic camera settings. Clicking on the image itself plays back the currently selected event recording since that’s what I find I use the most, but you can always use the live stream camera as the primary entity if you prefer the opposite.

The buttons from left to right are:

Event Selector: This lets me quickly pick another event if I want to play back an event stream of something other than the last recorded motion/ding
Live Camera: Clicking on the camera icon in the very center opens the live stream. I find that I mostly use the snapshot and event stream, but on the occasions where I want to open the live stream, having the button right there is really nice
Motion Detection State
Light State/Toggle: This camera is a floodlight cam so I can both see the state and toggle it on/off
Event Stream State: The VHS icon indicates if an event stream is currently active
Live Stream State: The CCTV icon indicates if a live stream is currently active

In the past it was possible to use the Event/Live stream states to also toggle the stream off early rather than waiting for the HA stream to time out in 5 minutes, however, changes to the stream backend have made this less useful as now, while you can click the icon to stop the stream, HA will retry the stream again in 10 seconds or so, which reconnects the stream again, and it will do this until the 5 minute stream timeout expires.

In recent versions of HA you can overcome most of these limitations by using the RTSPtoWebRTC - Home Assistant (home-assistant.io) addon. I’ve actually found that using this integration with the RTSPtoWebRTC addon is actually the best of all worlds, except one. Using this has super fast startup, the video is low-latency (usually ~1 second of delay), the sound works (if you use RTSPtoWebRTC and not RTSPtoWeb), and the inactivity timeout is only 30 seconds, which which is pretty much ideal for Ring cameras (RTSPtoWeb also works but it doesn’t support audio and seems to have a longer inactivity timeout). The only disadvantage of this approach is that, at least so far, I’ve not been able to get this to work when I’m outside of my network, which is quite disappointing, but I think I know why. I’m actually thinking of building RTSPtoWebRTC directly into the ring-mqtt addon with some changes that I think might address this, but it’s a fast moving project right now so maybe it will be addressed in the coming months.

Anyway, here’s the config for that card (really, nothing special):

type: picture-glance
entities:
  - entity: select.front_bedroom_side_event_select
  - entity: camera.front_bedroom_side_live
  - entity: binary_sensor.front_bedroom_side_motion
  - entity: light.front_bedroom_side_light
  - entity: switch.front_bedroom_side_event_stream
  - entity: switch.front_bedroom_side_stream
camera_image: camera.front_bedroom_side_event
title: Front Bedroom Side
5 Likes

Always nice to see how someone else is using the glance card. I’d love to see new and better improvements so yes great!

What exactly is the ‘event select’. I just don’t really get what i’m looking at. I can select motion 1-5, ding 1-5 and on-demand 1-5. What are these events? When I change a selection, the history stays at motion 1.

And what do the switch.xxxxx_event_stream do?

It’s covered in the documentation, but event select basically does exactly what it says, selects the event recording that will be played back when you view the event stream (and also updates the URL attribute for downloading that recording). You can play back any of the 5 most recent recorded events by type so, for example, selecting “Motion 2” will cause the event stream to play back the 2nd most recent motion event while selecting “Ding 4” will cause the event stream to play back the 4th most recent doorbell press event. The default is “Motion 1” which will play back the most recently recorded motion event.

Mmm… missed that in the docs, thanks for explaining! Will look into the URL attributes. Again; thanks

I missed setting up the automations, I did so according to the docs, tnx for pointing it out!

I do however have a different question and I don’t know if i’m at the right place to ask, but I really want to receive a picture at motion or at pressing the ding. I have found 2 automations which pull the pictures from the live camera’s. I can’t seem to figure out what goes wrong, but it always misses the person in front of the camera. No matter if I add a delay up to 5 secs, it doesn’t seem to work. Automation is based on the following blueprint:

My settings:

Is this something which should just work and am I just missing something? Or am I doing something very much wrong?

It’s not really clear to me what you are attempting to do, it looks like you are maybe trying to grab an image from the livestream camera but you should just enable the snapshot feature in ring-mqtt and use that instead, although, if you have a battery/low power camera this will also be very limiting since the camera can’t take a snapshot while recording.

Best bet for a battery camera is to try to get the snapshot on motion because, if you wait for the ding, it will probably take too long for the stream to start. In the next version it will get the image from the push notification, so this should be improved, but this requires a Ring subscription for this feature to work.

This indeed is what I’m trying to do. I cannot find a good example automation of how things work with HA anywhere. This is pretty unfortunate for me because I’m not an extremely advanced user. I’m really struggling with this. How can I achieve this?

If you try and safe the image locally, does it capture it though? I mean, with someone in it?

I installed Ring MQTT and I’m not sure if i havent configured something correctly or what. I only have one single Ring A19 bulb that im trying to get into home assistant. But so far its not finding it. I logged into my ring account (same account on my phone that controls the bulb just fine). what am i missing? everything i read is all about cameras and alarm but im not finding anything about the bulbs. Thanks in advance for any help!

I don’t know anything about Ring bulbs, no user has ever reported anything about them and I have no idea how they appear in the API. I was under the impression that they still required being paired with a Ring Bridge, and thus would likely work as any other Ring Smart Lighting device, but it’s possible they have their own device type, however, even if this is the case it should clearly show in the addon logs as finding an unsupported device. Feel free to open a discussion or an issue on the project page and we can dig deeper.

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.

1 Like

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.

1 Like