Ring Device integration via MQTT w/ Video Streaming

That’s exactly what I need, thanks! I basically did the same, but I need to debug it since it drained the whole battery of my ring doorbell in 1 day. I had the stop playing action as well, but I think I had to remove the snapshot from the mqtt camera since that caused a continuous 10 minutes recording throughout the day. Life got in the middle then, and I had to switch it off waiting for more time do debug. But this is really helpful!

Dear my friend, I have taken some steps forward, but I still can’t see.

ring-rtsp INF [RTSP] [conn 172.30.32.1:37764] opened
ring-rtsp INF [path 9c7613389e92_live] runOnDemand command started
ring-rtsp [Ingresso principale] Activating live stream via topic ring/d821efa8-94f4-4e2b-b04f-0319a6621505/camera/9c7613389e92/stream/command
ring-rtsp INF [path 9c7613389e92_live] runOnDemand command stopped
ring-rtsp INF [RTSP] [conn 172.30.32.1:37764] closed (source of path ‘9c7613389e92_live’ has timed out)
ring-rtsp [Ingresso principale] Deactivating live stream due to signal from RTSP server (no more active clients or publisher ended stream)

thank you

The snapshots themselves should be pretty light battery wise, especially since the default interval is fairly long (if you go with short intervals battery will certainly suffer, but still, killing one in a single days seems extreme). However, I’m pretty confident any automation which attempts to play the media stream somewhere else will be an absolute battery killer if you get more than a handful of motion events. The issue will be that, even if you switch the stream off using the stream switch, it’s very likely that the Home Assistant stream component will start the stream again 10 seconds later because it doesn’t time out the stream for ~5 minutes, so when it sees an interruption in the stream it just tries again.

I don’t really know how I could work around that because I can’t tell the difference between the stream component retrying the connecting when there is no consumer vs when someone is trying to view the stream. I wish the stream component in HA didn’t hold the stream open so long after there was no consumer, although it seems it was built with the idea of continuously streaming devices, not battery devices.

That being said, I personally just don’t think Ring battery powered cameras are great for this type of automation. I mean, even their wired cameras are quite limited, but the battery cameras are far worse, sometimes I debate if I should continue to try to support them at all.

I just installed this Addon and configured it as follows:

enable_cameras: true
snapshot_mode: 'on'
livestream_user: ''
livestream_pass: ''
enable_modes: false
enable_panic: false
beam_duration: 0
disarm_code: ''
mqtt_host: <auto_detect>
mqtt_port: <auto_detect>
mqtt_user: <auto_detect>
mqtt_password: <auto_detect>
branch: addon
debug: ring-*
ring_token: ''
location_ids:

It appears to work, but I have noticed that the exposed switch switch.front_door_live_stream is constantly being turned on at times when there is no ring or motion events??

When this happens I notice these entries in the addon logs:

2022-03-15T18:47:18.897Z ring-rtsp INF [RTSP] [conn 172.30.32.1:40258] opened
2022-03-15T18:47:18.899Z ring-rtsp INF [path 50f14aec3928_live] runOnDemand command started
2022-03-15T18:47:18.923Z ring-rtsp [Front Door] Activating live stream via topic ring/2c075b94-e033-4954-6256-7712a9156b9e/camera/50f14aec3928/stream/command
2022-03-15T18:47:18.925Z ring-mqtt [Front Door] Received set live stream state ON-DEMAND
2022-03-15T18:47:18.925Z ring-mqtt [Front Door] ring/2c075b94-e033-4954-6256-7712a9156b9e/camera/50f14aec3928/stream/state ON
2022-03-15T18:47:18.926Z ring-attr [Front Door] ring/2c075b94-e033-4954-6256-7712a9156b9e/camera/50f14aec3928/stream/attributes {"status":"activating"}
2022-03-15T18:47:18.926Z ring-mqtt [Front Door] Establishing connection to live stream
2022-03-15T18:47:18.987Z ring-rtsp [Front Door] Live stream is activating...
2022-03-15T18:47:19.580Z ring-attr [Front Door] ring/2c075b94-e033-4954-6256-7712a9156b9e/camera/50f14aec3928/stream/attributes {"status":"active"}
2022-03-15T18:47:19.674Z ring-rtsp [Front Door] Live stream is active!
2022-03-15T18:47:23.288Z ring-rtsp INF [RTSP] [conn 127.0.0.1:59098] opened
2022-03-15T18:47:23.332Z ring-rtsp INF [RTSP] [session 290675698] opened by 127.0.0.1:59098
2022-03-15T18:47:23.335Z ring-rtsp INF [RTSP] [session 290675698] is publishing to path '50f14aec3928_live', 3 tracks with TCP
2022-03-15T18:47:23.336Z ring-rtsp INF [RTSP] [session 730113710] opened by 172.30.32.1:40258
2022-03-15T18:47:23.340Z ring-rtsp INF [RTSP] [session 730113710] is reading from path '50f14aec3928_live', 3 tracks with TCP

Anyone know what might be triggering the switch?

I’ve scanned my automations and cannot seems to find anything that might trigger the addon, except when there is motion or someone rings the doorbell.

Can anyone help me with this problem? Deactivating live stream due to signal from RTSP server (no more active clients or publisher ended stream)

In meantime on log mqtt i read
New client connected from 172.30.33.4 as 9c7613389e92_live_pub (p2, c1, k60, u’addons’).
1647613433: Client 9c7613389e92_live_pub disconnected

This clearly shows something is connecting to the RTSP path, you’ve either configured the UI to “preload stream” or set it to auto or something else on your network is finding and connecting to that path. It’s impossible for me to predict what that might be, but something is doing it.

Also note that if you view any live stream then of course the switch will come on as the switch always indicates the state of the stream. If you view the stream in the UI then and then manually attempt to turn the stream off, the stream component in Home Assistant will just reconnect and restart the stream. You have to wait for the 5 minute timeout in Home Assistant for the stream to start.

Note that if something was manually toggling to stream on without connecting to the RTSP server, then you’d see lines like this just before the RTSP open:

2022-03-19T20:49:56.662Z ring-mqtt [Front Door] Received set live stream state ON
2022-03-19T20:49:56.663Z ring-mqtt [Front Door] Starting a keepalive stream for camera
2022-03-19T20:49:56.704Z ring-mqtt [Front Door] The keepalive stream has started

That’s your indication that the stream was turned on manually by the switch. However, if you don’t see this, then the stream was started by something connecting to the RTSP server.

You can try setting a username/password on the streams and see if that helps.

What is the actual problem? Those message are normal when the stream ends.

Thx.
OK on some of my other cams (non Ring) I do use the preload feature, it could be that I might have to check if I did that for the ring.

What’s more disappointing (and I read this from your documentation) is that once viewed, the cam stays on for 5 minutes no matter what.

I have the Ring video doorbell 2, its hard wired, but that hard wire is just a trickle charge and will not keep up with streaming.

How are others using the Ring cam with this integration and dealing with battery issues?

There’s really nothing I can do about this since this is Home Assistant behavior. The addon shuts down the stream within 10 seconds when there are no active clients.

You can try using the WebRTC integration to view instead, it will deactivate immediately when there is no viewer and has much lower latency. It works pretty well for 2-3 active cameras but seems to struggle after that. Eventually I hope to use WebRTC natively in the addon but just don’t have enough time right now.

Personally, I don’t own Ring battery camera and don’t generally design the video features with them in mind as I don’t consider them suitable for this type of integration due to their many limitations, even more than the regular Ring camera.

1 Like

In the meantime, thousand thanks for your reply.
It’s probably okay, but I can’t get access to the video stream.
This is my configuration in the config.
camera:

  • platform: generic
    name: Ring_mqtt
    stream_source: rtsp://03cabcc9-ring-mqtt:8554/9c7613389e92_live
    still_image_url: still_Image_URL":“https://192.168.178.147:8123{{ states.camera.ingresso_principale_snapshot.attributes.entity_picture }}”}

While entering this code, I can’t see anything.
For this I thought that the log has some problems.
This is the log of your brilliant addon …

2022-03-21T20:23:16.562Z ring-rtsp INF [RTSP] [conn 172.30.32.1:40630] opened
2022-03-21T20:23:16.568Z ring-rtsp INF [path 9c7613389e92_live] runOnDemand command started
2022-03-21T20:23:16.605Z ring-rtsp [Ingresso principale] Activating live stream via topic ring/d821efa8-94f4-4e2b-b04f-0319a6621505/camera/9c7613389e92/stream/command
2022-03-21T20:23:26.568Z ring-rtsp INF [path 9c7613389e92_live] runOnDemand command stopped
2022-03-21T20:23:26.570Z ring-rtsp INF [RTSP] [conn 172.30.32.1:40630] closed (source of path ‘9c7613389e92_live’ has timed out)
2022-03-21T20:23:26.571Z ring-rtsp [Ingresso principale] Deactivating live stream due to signal from RTSP server (no more active clients or publisher ended stream)
2022-03-21T20:23:27.016Z ring-mqtt [Ingresso principale] New motion event detected, updating the event recording URL

What am I doing wrong? can you help me? Thank you

Is that really all of the logs, or did you leave some out? If that is really all if the logs then the fact that the time from “runOnDemand command started” to “runOnDemand command stopped” is nearly exactly 10 seconds, while there’s absolutely no indication that the command sent by the on-demand script to start the stream was received by the ring-mqtt process, then it’s clear that the livestream script is unable to connect and properly send a message via MQTT or that, for whatever reason (perhaps security settings on MQTT broker) the message was sent (which seems to be the case) but not able to be received by the ring-mqtt process. See this message:

2022-03-21T20:23:16.605Z ring-rtsp [Ingresso principale] Activating live stream via topic ring/d821efa8-94f4-4e2b-b04f-0319a6621505/camera/9c7613389e92/stream/command

So the on-demand script started, and tried to send the command, however, there’s absolutely zero indication that ring-mqtt actually received this message. The very next line should be something like:

2022-03-21T20:23:16.633Z ring-mqtt [Ingresso principale] Received set live stream state ON-DEMAND

This would show that the command sent by the RTSP server onDemandScript, which is a small shell script run automatically any time a user connects to the RTSP path for the camera, was actually received by the main ring-mqtt process via the MQTT broker. Since that message didn’t arrive, then something is keeping this message from being delivered. The main ring-mqtt process and the RTSP server must be able to communicate via the ring topics using the MQTT broker.

My dear … now it seems to work …, by clicking on the card, the streaming starts even with audio … Putting on auto I don’t have the snapshot image, but it seems to be already quite better. I don’t know what my mistake was. I have restarted hassio several times.
GRAZIEE

HI There,

I am very new to HA. I have follow this guide with my very basis understand in HA or coding.
Follow accordingly to the steps and guide, i have managed to install the Mqtt ring app to HA and discovered all my ring door bells.

Also added in configuration yaml the cameras successfully. But once I create a picture glance card, it seems that the live feed and image feed cannot be connected at all?

Did i missed any configuration yaml entiry for mqtt? as i did not do anything on it as i had already install mqtt for homey hence everything is auto detect and connected included all the ID and password.

Appreciate your guidance

Not sure what is wrong.
My configuration Yaml is as below:

#Ring Front Door
camera:

  • platform: generic
    name: Front_Door_Live
    still_image_url: https://homeassistant:8123{{ states.camera.front_door_snapshot.attributes.entity_picture }}
    stream_source: rtsp://Login ID:password@03cabcc9-ring-mqtt:8554/54e019c5f73f_live
    #Ring Side Door
  • platform: generic
    name: Side_Door_Live
    still_image_url: https://homeassistant:8123{{ states.camera.side_door_snapshot.attributes.entity_picture }}
    stream_source: rtsp://login ID:password@03cabcc9-ring-mqtt:8554/54e019c840f3_live

mqtt:
broker: 192.168.1.43:1883
username: blank
password: blank
discovery: true
discovery_prefix: homeassistant
birth_message:
topic: ‘hass/status’
payload: ‘online’
qos: 0
retain: false

Appreciate your comments

Both entities had been created but it shows unavailable

this is the log created it seems like RTSP is not working, i not sure on this as i don’t remember installing any RTSPWeb, is this the issue i still cannot stream my Ring?

2022-03-25T08:01:22.549Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51168] opened
2022-03-25T08:01:22.564Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51168] closed (no one is publishing to path ‘54e019c5f73f_live’)
2022-03-25T08:01:30.632Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51214] opened
2022-03-25T08:01:30.641Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51214] closed (no one is publishing to path ‘54e019c840f3_live’)
2022-03-25T08:02:12.585Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51366] opened
2022-03-25T08:02:12.594Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51366] closed (no one is publishing to path ‘54e019c5f73f_live’)
2022-03-25T08:02:20.661Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51418] opened
2022-03-25T08:02:20.669Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51418] closed (no one is publishing to path ‘54e019c840f3_live’)
2022-03-25T08:03:12.616Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51582] opened
2022-03-25T08:03:12.625Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51582] closed (no one is publishing to path ‘54e019c5f73f_live’)
2022-03-25T08:03:20.687Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51628] opened
2022-03-25T08:03:20.699Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51628] closed (no one is publishing to path ‘54e019c840f3_live’)
2022-03-25T08:04:22.659Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51836] opened
2022-03-25T08:04:22.669Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51836] closed (no one is publishing to path ‘54e019c5f73f_live’)
2022-03-25T08:04:30.720Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51880] opened
2022-03-25T08:04:30.729Z ring-rtsp INF [RTSP] [conn 172.30.32.1:51880] closed (no one is publishing to path ‘54e019c840f3_live’)

Hello; thanks for this excellent work! I just got it setup by setting up a docker install of MQTT-Ring and auth’d my rind refresh token. it right away pulled down all my sensors.

My question is, does this have any negative effects on my Ring devices? As in, does it pull additional battery from the sensors in order to report their status by having this addon in HA?

Hoping someone can provide some sort of insight on this, thank you

The MQTT integration communicates to Ring Cloud, so it pulls only what is available in the cloud. Except of course if you have preloaded stream or a stream constantly open, then the battery device has a constant stream.

thank you!

Would it be difficult to integrate the Ring Glass Break Sensor? I realize that you would probably need one to test it out, so no worries if that’s the case, but figured I’d ask. Thanks!