Ring Device integration via MQTT w/ Video Streaming

I did not see MQTT, but when I tried to configure it, it said that there was already a MQTT integration configured. So I edited “/config/.storage/core.config_entries” and removed everything related to MQTT (including Mosquitto), removed mosquitto and restarted. Then I enabled MQTT and then install Mosquitto and it works. Thanks!

This intergration does not allow you to control your Ring alarm directly without connecting to the Ring alarm servers. It simply allows you to surface most of the Ring alarm capabilities to Home Assistant which allows you to extend automations to others devices. For example I control lights based on Ring contact or motion sensors.

is this possible to do if i run it as a service? if this were the ring alarm service

ssh -l user host "screen -d -m systemctl restart ring-alarm-mqtt
"

source: https://serverfault.com/questions/36419/using-ssh-to-remotely-start-a-process

I’m sorry, but I’m not sure I understand the question. Yes, if you have installed the script on your host and added a service file to run it, then yes, you can start the service remotely with SSH using systemctl, but I’d think you’d just set the service to start automatically on boot.

WIth hassio, the service runs in a docker container and you can start it with the hassio GUI.

yes, but im trying to get it to restart automatically if no sensors are detecting (such as a home-assistant reboot)

I keep having door sensors go offline… before i integrate into HA, just wondering what will HA see when a sensor is offline?

Honestly, I’m not sure because I haven’t tested this scenario. I think it would just keep showing the prior reported state but there’s nothing in the code to handle this situation specifically so I’d say the current behavior is “undefined”.

In an ideal world the code would monitor the reachability state of each sensor and report that state individually, but right now I just took the easy way out and the code has a single reachability state for the entire alarm via the websocket. It has no understanding of individual sensors being offline and I’m not even sure how the API reports that. I can put it on my enhancement list, but it will probably be a few months before I pick up any development again.

Out of curiosity, why are your sensors going offline? I’ve had an alarm now for 4 months and none of my sensors have ever gone offline. Is it a distance thing or are you in a high interference environment?

i don’t know why they go offline… it’s happened only once during the month I’ve had ring, but one sensor went offline from 5am to around noon two days ago.

It’s on a window that has not been opened/closed in weeks. I was at work, so didn’t even do anything to it and it came back online on it’s own.

Thanks for all your work, @tsightler. Similar to @OB1, I am also experiencing sensors going offline. My Ring Alarm has a few motion sensors, a smoke/CO listener sensor, and a few contact sensors. I am using your integration on HASS.io and exposing everything to HomeKit through HA.

All of the Ring sensors are properly discovered by HA and your integration. I never experience any sensor issues in the Ring app directly and the sensors are working just fine.

After starting HA, all of the sensors are seen in HA and subsequently seen in HomeKit, no problem. Then, somewhere between 10 - 60 minutes, sensors will start going offline (“not responding” in HomeKit). It seems the smoke/CO listener (which presents two sensors) always goes offline first, then all my contact sensors go offline too. During all of this, the sensors never show any problem in the Ring app and are working (via the Ring app and functionality) just fine.

Interestingly, my Ring Alarm motion sensors and base alarm functionality (arm/disarm/home) never go offline in HA or HomeKit. Those always seem to be working and very stable. It is just my smoke/co listener and contact sensors that go offline.

If it makes any difference, I am running HASS.io in a VirtualBox VM on a Mac mini running the latest macOS. I also am using HA’s native Ring support to bring my doorbell, spotlight cam, and floodlight cam into HomeKit.

Any thoughts about what might be causing the smoke/CO and contact sensors to be going offline after 10 - 60 minutes, while the motion sensors and keypad stays functioning just fine?

Can you clarify exactly what you are seeing in HA? Do the sensors literally show “offline” state? It’s completely confusing because, as mentioned above, there is literally nothing in my code that monitors sensor state at all. Ever sensor uses a single availability topic that is global for the entire alarm. I’m struggling to understand how some sensors could show online while others are offline.

That being said, the debug log output from the ring-alarm-mqtt plugin should show any state changes at all. When the devices go offline, do you see anything there?

It’s even more confusing because you indicated that the motion sensors don’t have this problem, but the code path for the motion sensors and contact sensors is exactly the same. There’s effectively nothing different between them except the device class, and the entire purpose of that is to set the icon in HA, nothing more.

Thinking through the code path, I can’t come up with any explanation as to why this would happen. If you could open an issue on Github regarding this, and upload some logs there, I’d be happy to investigate, but I’ll definitely need debug log output of the issue occurring to have any chance to understand what is going on.

I have like 12 door sensors, a couple of motion sensors, and smoke/co listener, and flood/freeze sensors, and none of my devices have every gone offline so I don’t have anything to troubleshoot.

It is quite baffling. Just to clarify:

  • In Ring’s app, no sensors have any problems ever.
  • In Home Assistant (HASSIO), I see all the sensors as a row of icons across the top of the Overview page. Clicking any motion sensor, under “state history” it shows always available. Clicking any contact sensor or the smoke/co, under “state history” it shows intermittently available and unavailable.
  • In HomeKit, the motion sensors and contact sensors always start (after starting HA) as responding just fine. However, after some time (10 - 60 minutes, it seems), the contact sensors and smoke/co will change to “Not Responding” but the motion sensors are still working fine.

I can not seem to locate the Ring Alarm MQTT plugin logs, but I am seeing this in my /config/home-assistant.log, which is repeating every 10 seconds (thousands of entries now):

> 2019-04-08 14:13:24 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ring binary_sensor took longer than the scheduled update interval 0:00:10
> 
> 2019-04-08 14:13:45 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ring binary_sensor took longer than the scheduled update interval 0:00:10
> 
> 2019-04-08 14:14:18 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ring binary_sensor took longer than the scheduled update interval 0:00:10
> 
> 2019-04-08 14:14:39 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ring binary_sensor took longer than the scheduled update interval 0:00:10

Here is a screen shot of clicking the CO sensor in HA:

Does that help shed any light here? Thanks!

I believe the log messages that you posted are from the Home Assistant builtin Ring component which provides support for doorbell dings as well as doorbell/camera motion sensors, which are completely different from alarm motion sensors/devices (they don’t even use the same API).

Do you have the Ring component configured on your hassio setup? When you talk about motion sensors, are you referring to Ring camera/doorbell based motion sensors or alarm based motion sensors?

The logs for ring-alarm-mqtt should be visible if you click on the Addon and scroll down to logs. It will log any interruption to the Ring service, which is the only thing that should make the the alarm device show offline.

@tsightler yes, I do have both the native Ring component and also your Ring Alarm component. The native Ring component is working fine (as far as I can tell). I am purely talking about Ring Alarm devices/sensors. My Ring Alarm motion detectors work fine and are always available, but my Ring Alarm contact and smoke listener sensors are the ones that go offline as described in my previous posts.

Apologies about including the wrong logs in my last post; I am new to HA. Here is a chunk of recent logs from the ring-alarm-mqtt addon page (the “Logs” section at the bottom of the page). As you can see, it looks like the same log message is repeated for a sensor six times, then it shows the message for another sensor six times, then another… etc. I truncated the snippet to only include three sensors here, but my logs actually show the same pattern for more sensors.

2019-04-09T06:56:32.552Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/state OFF
2019-04-09T06:56:32.553Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:32.553Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/state OFF
2019-04-09T06:56:32.553Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:32.554Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/state OFF
2019-04-09T06:56:32.554Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:32.554Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/state OFF
2019-04-09T06:56:32.554Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:32.554Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/state OFF
2019-04-09T06:56:32.555Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:32.555Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/state OFF
2019-04-09T06:56:32.555Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/10042e7c-7821-4680-802d-40597cd36470/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:47.618Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/state OFF
2019-04-09T06:56:47.620Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:47.622Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/state OFF
2019-04-09T06:56:47.622Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:47.623Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/state OFF
2019-04-09T06:56:47.624Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:47.624Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/state OFF
2019-04-09T06:56:47.625Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:47.625Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/state OFF
2019-04-09T06:56:47.626Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:56:47.626Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/state OFF
2019-04-09T06:56:47.627Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/db3c7615-dec4-4cc9-85c5-cb8d4a41e6dc/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:58:39.032Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/state OFF
2019-04-09T06:58:39.034Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:58:39.035Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/state OFF
2019-04-09T06:58:39.035Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:58:39.036Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/state OFF
2019-04-09T06:58:39.036Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:58:39.037Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/state OFF
2019-04-09T06:58:39.037Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:58:39.037Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/state OFF
2019-04-09T06:58:39.038Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/attributes {"battery_level":100,"tamper_status":"ok"}
2019-04-09T06:58:39.038Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/state OFF
2019-04-09T06:58:39.041Z ring-alarm-mqtt ring/alarm/842bd7ee-2ce9-475f-aaa9-8c6cbb09f204/binary_sensor/a99748c3-54a7-49bb-b54b-e6656a7236e8/attributes {"battery_level":100,"tamper_status":"ok"}

Based on the logs you have provided to this point it’s difficult for me to guess. I’d need the full log output from the script for me to really be able to understand what it happening. Perhaps you can create an issue on the Github page and provide a zip file with the full log output? Or, you can email me directly using the same name at Gmail and we can troubleshoot, although I won’t be able to do so for the next week or so.

Based on the small log snippets posted so far, my theory is that, for some reason, your HA instance is loosing connectivity to the Ring servers. This is based on the fact that you see entries in the log with the ring component failing polling and those seem to coincide (at least in the screenshots) with the times that the ring alarm devices are offline as well. That’s two completely different services having difficulty communicating with Ring at the same time, even though they use different APIs.

However, as far as I can tell, the builtin Ring component does not surface connectivity issues like this to the UI, it will just silently fail in the background and you will miss events. I know this first hand as I also have several cameras that I use the Ring component for. I can literally unplug my internet connection and HA will never report the cameras being offline (well, at least not in the time I’ve waited for it, i.e. 10 minutes or so).

The script for the Ring alarm does report availability state so you see sensors as unavailable if the script detects that it hasn’t been able to communicate over the websocket for more than 60 seconds. I thought it was important for an alarm component to monitor and show the state of the connection.

I believe the issue you are seeing with the mulitple sensors is related to a known bug in the code where, if the connection is interrupted and then reestablished, the script creates duplicate devices. If you’re seeing updates for 6 duplicate devices I’m guessing you’ve seen at least 5 disconnects of the websocket since the last script restart. It’s a bug I’ve been meaning to fix but I don’t really see disconnects in my environment and it’s mostly cosmetic anyway (the same device getting the same update status 6 times doesn’t really hurt anything).

If you don’t think this is the case, please let me know, but yet again, without full logs, or at least some snippets from around the time the failures occur, I’m somewhat having to guess.

The only thing that I’m at a loss to explain at all with this theory is why your alarm motion sensors don’t go offline. That’s confusing as heck! Would you be able to post a screenshot of a motion sensor and a contact sensor showing the same timeframe with one offline and one online? It would just be interesting.

Mr. t,

My sensor went offline again, so i dumped the JSON info from the ring server while it was offline, then i went and played with the sensor (opened the lid) and that brought the sensor back online. Comparing the JSON info between offline and online, the only difference is the following:

general:
v2:
adapterType: zwave
adapterZid: 1111111-9999-2399-ab20-b3a9379c027d
batteryLevel: 99
batteryStatus: full
catalogId: ad784575-3333-4444-5555-6666e1349f0a
categoryId: 5
commStatus: error (<<<---- means offline)

when the sensor is online and working, ring reports the following:

 commStatus: ok

If you feel like it, you may want to add a check for commStatus.

I successfully installed this add-on about 2 weeks ago and everything worked great. Today, I am trying to install the add-on on a fresh install of Hassio on a raspberry pi 3b, and now I get this error:

19-04-11 23:05:39 INFO (MainThread) [hassio.addons.git] Clone add-on https://github.com/rs1932/ring-alarm-hassio-addon repository
19-04-11 23:05:40 WARNING (MainThread) [hassio.addons.data] Can’t read /data/addons/git/5e5dfff6/config.json: required key not provided @ data[‘arch’]. Got None
19-04-11 23:05:40 INFO (MainThread) [hassio.addons] Load add-ons: 55 all - 0 new - 0 remove

Thanks for providing this, very useful. So in your case it seems that the device really is offline from Ring’s perspective. I could add a check for commStatus and use that as per-device availability topic although I wonder what the reported status is for such a device as, it seems from the post above that devices that are offline already report unknown status, which is all I could really do with this.

I guess I need to play with taking some of my devices offline and see how the code behaves.

I believe recent hassio version require the arch key to be present in any addon to explicitly list which architectures the addon supports. I see there is already a pull request which adds this support to the script but no response. You might try just using the https://github.com/hjanum/ring-alarm-hassio-addon source instead.

I’m considering including support for hassio directly into my tree, but I’m on the fence about it since I don’t use hassio and really don’t have time to maintain/support it properly. I already get more questions/support request about this script than I anticipated and it’s a challenge trying to figure out how to balance sharing the code while not just frustrating HA users.

I think the right thing to do is perform more testing with hassio, make sure that it works perfectly, and document a clear step-by-step guide so that a beginning HA user can accomplish this as easily as possible. I won’t have time to do that for at least a couple of months.

1 Like

I cloned the repository into my own so that I could add the arch key. However, No matter what I do I cannot make this work on my hassio .91.2 on a rpi. Feel free to use my repository for testing if you would like. I can’t guarantee that it will work, but its there if you want to try. Once the original developer of the hassio add-on updates the code mine will likely be taken down.

Link may help, https://github.com/ajgrinnell/ringAlarm. Again, once the other code has been updated mine will come down. I just set this up for my own testing.