Ring Device integration via MQTT w/ Video Streaming

I have a problem with my Ring camera setup via MQTT. It worked like a charm the last weeks and suddenly the livestream didn’t appear anymore when I opened the generic camera I have setup in Home Assistant. When I tried to re-setup the camera in the UI I got an time out and in the logs of the Ring MQTT addon I got these informations:

2023-02-08T14:53:12.975Z ring-rtsp [go2rtc] DBG [rtsp] new consumer stream=*******_live
2023-02-08T14:53:12.978Z ring-rtsp [go2rtc] DBG [streams] probe producer url=exec:/app/ring-mqtt/scripts/start-stream.sh ******* live ring/*******/camera/******* {output}
2023-02-08T14:53:12.980Z ring-rtsp [go2rtc] DBG [exec] run url="exec:/app/ring-mqtt/scripts/start-stream.sh ******* live ring/*******/camera/******* rtsp://localhost:8554/*******"
2023-02-08T14:53:13.004Z ring-rtsp [Haustür] Sending command to activate live stream ON-DEMAND
2023-02-08T14:53:13.011Z ring-mqtt [Haustür] Received set live stream state ON-DEMAND rtsp://localhost:8554/*******
2023-02-08T14:53:13.011Z ring-mqtt [Haustür] ring/*******/camera/*******/stream/state ON
2023-02-08T14:53:13.012Z ring-attr [Haustür] ring/*******/camera/*******/stream/attributes {"status":"activating"}
2023-02-08T14:53:13.013Z ring-mqtt [Haustür] Initializing a live stream session for Ring cloud
2023-02-08T14:53:13.096Z ring-rtsp [Haustür] State indicates live stream is activating
2023-02-08T14:53:13.615Z ring-mqtt [Haustür] Live stream session successfully initialized, starting worker
2023-02-08T14:53:13.621Z ring-wrtc [Haustür] Live stream WebRTC worker received start command
2023-02-08T14:53:13.681Z ring-wrtc [Haustür] Live stream transcoding process is starting
2023-02-08T14:53:13.864Z ring-wrtc [Haustür] Websocket signalling for Ring cloud connected successfully
2023-02-08T14:53:14.798Z ring-mqtt ERROR - Uncaught Exception
2023-02-08T14:53:14.798Z ring-mqtt Error: negotiate codecs failed.
2023-02-08T14:53:15.801Z ring-mqtt The ring-mqtt process is shutting down...
2023-02-08T14:53:15.803Z ring-mqtt Setting all devices offline...
2023-02-08T14:53:15.806Z ring-rtsp exit OK

Problems occurs on all my devices. Does anybody has an idea, what is going wrong?

This is the key message:

2023-02-08T14:53:14.798Z ring-mqtt Error: negotiate codecs failed.

Ring has suddenly started rolling out HEVC/H.265 video codec support and, based on the Ring forums, is seemingly just randomly enabling it on various cameras. You can revert to AVC/H.264 by enabling the new Legacy Video Mode option for the camera.

Now, indeed, the code shouldn’t crash on this case, and in the latest 5.1.3 release this error is now properly trapped and logged with a message about Legacy Video Mode.

I honestly have no idea what Ring is thinking here, there are still so many devices that don’t support H.265 downstream, and the forum is pretty much full of such issues. But even more confusing is the seeming randomness of it all. Users on the forum with mulitple cameras report the feature being enabled only a single camera, or a small number of cameras.

Now, it’s easy enough for me to enable H.265 support in ring-mqtt, but the problem is that there’s still a LOT of downstream devices that will not play back H.265, mostly due to licensing issues vs any actual technical limitations. Sure, I could also transcode the H.265 stream back to H.264, but as ring-mqtt is run on a lot of low power devices, that’s not terribly practical as it will mean a significant increase in CPU usage.

For now, enabling Legacy Video Mode is the best way to maintain compatibility with ring-mqtt and, honestly, with lots of other devices (for example, lots of reported issues with Echo Show integration not working after Ring “upgrades” their video capabilitiy).

Thanks for the comment, I already upgraded my plugin and the error message is gone. For me only one camera had this problem (front door), all other cameras working like a charm. Also the Echo Show says that the camera is not working properly (as you wrote). Interesting fact: I cannot see a possibility to enable legacy mode on my ring device, it is also a quite old one (2nd generation doorbell). So I guess I have to live with that or get another (newer) doorbell.

It doesn’t seem to be camera specific. They seem to be just randomly enabling it for devices. There are several topics on the Ring community forums about this issue, you may want to look there. There’s some advice as to what to do if you can’t find an option regarding Legacy Video Mode.

HEVC not supported? Not true as other are showing camera preview but one is not - Products / Security Cams - Ring Community

This all started back in late January but it seems to be showing up on more and more cameras. So far none of my 8 cameras have received this change.

I have an issue where the ring binary sensors (not the mqtt ones) get trigged frequently by motion caused by high wind events (trees blowing, camera shaking) or vehicles in the distance driving by at speed.

These motion events still trigger the HA official ring integration binary sensors, however, they do not cause any events to be registered by the official ring app so do not meet some motion score model I suspect to be considered useful to send an alert. (which is fine)

The issue I have is that I use the official ring binary sensors to trigger my workflow in a Node Red flow. This works fine in all times except for these ‘phantom’ triggers.

My main use case is to identity persons (as passed in by the ring-mqtt binary sensor) and only send notifications of such events by way of the HA app. (thus I have full control of what ring events I will receive)

The issue is that because these phantom events occur, the ring-mqtt sensor is not updated (as no real or useful motion/person event has occurred) so not state changes have occurred. If the last state was a person walking by, the isPerson state in the mqtt message is still true and thus in windy scenarios, my person trigger keeps going off because the HA ring binary sensor is super sensitive.

If I switch to using the ring-mqtt binary sensor, they seem to have a long ON state applied for when motion is detected (3-4 minutes) before turning off, which means not other meaningfully events are trigged during this time.

ASK; 1) Is it possible that the ring-mqtt sensor attribute [personDetected] could be rest back to false after a few seconds? OR
2) The ring-mqtt binary sensors state lifetime can be reduce / configured. Ideally it would match the HA ring binary sensors which toggle from ON/OFF within a few seconds. This would be the ideal for me as it seems to not be as sensitive to the events I have described above and so more accurate to real events.

Is any of the above asks possible now through config that I may have missed?

Thanks

Use this python script:

and create an automation to change the state of the binary sensors to off after 5 seconds of turning on.

This worked perfectly. Thanks Robert

1 Like

Glad it’s worked for you. :slight_smile:

I’m troubleshooting why I can’t get my live streaming to work. I would like to restrict the addon to only one ring location. But for the life of me I can’t get the config UI for the addon to take my location. I’ve tried all of these formats:
[“xxxxxxxxxxx”]
“xxxxxxxxx”
[“xxxxxxxxx”,]

The save button never lights up and lets me save the location. It seems like it doesn’t like how it’s formatted. Is there a config file somewhere I can go manually enter it?

Thanks for any help!

Hello,
When i try to add a Generic Camara, I get this error in the logs for the image url:

[homeassistant.components.generic.config_flow] Problem rendering template Template(“https://homeassistant:8123{{ states.camera.porte_entree_snapshot.attributes.entity_picture }}”): UndefinedError: ‘None’ has no attribute ‘attributes’

Thanks for your help!

Please can you tell us what was in your image url setting?

If possible please copy and paste that text from the image url in the user interface.

Also you may want to test the template in developer tools > template.

I got this sorted…I just changed to edit yaml mode and I could just manually shove the ID in there and it worked the first time! Not sure what I was doing wrong in the form…but I’ll take it :slight_smile:

First of all, wanted to say what an amazing addon this is.

I’ve got the RTSP stream going through Frigate… works like a champ. The only issue is the CPU usage… any idea what HWACCEL options work?

There is no transcoding in the addon, so hwaccel is unlikely to help (even on a RPi 4 the ffmpeg usage of for 8 streams is maybe 25% of a single core). The CPU usage is almost completely due to the fact that the WebRTC code for receiving the stream from Ring uses werift, which is a WebRTC implementation written in pure Javascript. It’s great stuff, but decoding an WebRTC stream in Javascript has a lot of CPU overhead. As this project is designed for on-demand vs 24x7 streaming, this isn’t much of an issue.

I know you already have an answer that works for you but, in the interest of being complete, i wanted to add some context.

These are not really “phantom events”, and it’s not about “sensitivity” they are simply the events detected by the camera. The native Ring integration polls for all events, so any event that shows up on the camera event history creates a state chage . On the other hand, ring-mqtt depends on notifications, which are much faster, but if you enable smart notifications, only events that get through this smart notifications filter (for example, person detection) will get through. If you have notifications enabled for all events then ring-mqtt and native Ring integration is identical.

ON state duration is just one possible trigger. However, ring-mqtt does send an updated “ON” for every event, and you can use something like “lastMotionTime” for the trigger instead, as that will trigger for every motion event even if state is already “ON”.

No because this would be technically incorrect, this field shows the status of the last detected motion event (as identified by the “lastMotionTime” attribute) and is independent of the existion ON/OFF state of the sensor.

ON state in ring-mqtt has always followed the expiration time for the event which is a property of the event, and is 180 seconds. This also matches the behavior of 1st generation Ring motion sensors which were the only motion sensors available at the time, so behavior was consistent between camera and alarm motion detection. In the current dev version, you can override this on a per-camera basis down to as low as 10 seconds since so many people don’t seem to understand that you can still just trigger on something other than “ON” state, if you want to get every motion event for some reason.

Thanks for this update. While I have a way of resolving this, its always nice to be able to do within the integration. Plus some nice additions as well. Thanks for investing in, and keeping this integration updated. Much appreciated!

1 Like

@tsightler Thank you for the new release. The new features are appreciated. From the release notes that appeared in the update (I am struggling to find them online now I have updated), you seemed to indicate that Gen2 motion sensors have a different (much shorter) cooldown time of 20 seconds, as opposed to 180 seconds (3 minutes) for Gen1 sensors. Have I understood this correctly, as that in itself is a major reason for me to upgrade most of my Gen1 motion sensors to Gen2. They are simply not reactive enough when trying to use them for lighting automations, and it should save me having an additional (different brand) motion sensor for lighting in each room where I need that reactivity.

Well, I guess I can’t be 100% sure but, until recently, I only owned 1st gen motion sensors so that was the only behavior I had ever seen from Ring devices. A few months ago I purchased a 2nd gen motion sensor to cover a different area in the house and it seems to stay activated for only 20 seconds. Personally, I dislike this, but to each their own, and I can live with it.

By far the biggest thing I dislike about the 2nd Gen motion sensor is that it seems far less sensitive than either of the 1st Gen sensors, even on the most sensitive setting. It actually wasn’t sensitive enough for the use case for which I purchased it and I ended up purchasing a 1st Gen sensor from eBay.

1 Like

Thanks for the insight. Pity the Gen2 ones are less sensitive. I have heard others say that about them as well, but it is the first I have heard that the cooldown period is quicker, which I would definitely appreciate for lighting automations. I guess I will need to purchase a single sensor to test with and then weigh up the pros and cons.

So this is mostly just me being nosey, but I’m super curious why does this matter for lighting automations? I use quite a number of motion sensors with 2-3 minute cooldown for lighting functions and I’ve never really perceived it as an issue, but I’m guessing it’s just some use case that I don’t have.