Ring Device integration via MQTT w/ Video Streaming

Yeah, I see that it’s been implemented in the Homebridge plugin and shown as switches in a hidden device. I don’t really know how to do something similar in HA as hidden attribute isn’t available via discovery, AFAIK.

I was thinking perhaps exposing something like a master panic switch where, once you toggle it, you still have to toggle a switch for “Fire” or “Police” within 10 seconds. If you toggle fire/police without first toggling panic, they are just ignored. That way it could still be automated, but be pretty safe from accidental trigger via UI.

Thoughts or other ideas are welcome.

For those looking to help with this project I’m looking for parties interested in testing support for for Ring smart lighting. I have pushed an update to the “dev” branch that is my first attempt to add this support.

I don’t actually have any Ring smart lighting so there almost certainly will be bugs (it could range anywhere from working perfectly to not working at all) so you have to be willing to live with possibly having issues.

It’s easier to test with native ring-mqtt.js since it’s easier to get logs, but if you only have Hass.io, I’ve created a “dev” version of the Hass.io addon which always pull the latest dev branch of ring-mqtt vs the master/release branch.

Thanks in advance!

-----Please only use the development addon below if you want to test the development branch of ring-mqtt otherwise the production plugin is what you want-----

Hey @tsightler, ive just tried migrating my setup to your new add-on and im getting the following error, any suggestions?

20-02-28 15:55:19 ERROR (SyncWorker_7) [hassio.docker.addon] Can’t build a98c085d/amd64-addon-ring_mqtt:3.0.1: The command ‘/bin/ash -o pipefail -c apk add --no-cache nodejs npm git’ returned a non-zero code: 3

That error is happening during the Docker build process and indicates that, for some reason, the container could not install the requested packages. I’d assume some type of network error or perhaps the Alpine repo services were down when you tried to install? Basically the command that was failling is this:

apk add --no-cache nodejs npm git

Which is literally just Docker attempting to install nodejs, npm and git into the container using the Alpine package manager, nothing special. I’d suggest just removing and trying again.

Sorry but I’m not sure what I need to remove? All I’ve done is added your repo to hassio then tried to hit install on the addon and it fails, not sure what else to try?

Just remove the repo (to clear any cached information) re-add the repository and try to install again. That’s all. You’re not even getting the plugin installed and I have no other reports of this issue so I’m just hoping that there was some transient issue unrelated to the plugin (the command that failed in your case is not something unique to this plugin, but to many plugins).

Tried this already, removed repo, restarted server, re-added repo and same error :cry:

Hmm…I don’t really have any great ideas on what this might be. I have no other reports of this issue and it’s happening before the addon even gets built, which is super weird. I’ve installed it on both of my test systems with no issues. What is you platform?

My best guess would be some type of networking issue like a firewall or something is blocking access to the Alpine repositories, but it’s totally just a guess. Are you using any kind of DNS adblocker or something like that? What DNS servers are you using?

Has anyone else seen this issue?

@tsightler thank you so much for maintaining this, I’ve been a user since early on and I wanted to take a second and give a little shoutout for all your awesomesauce work. Just upgraded to your latest release and hass addon. Working great, as always. One of the most reliable pieces in my entire HA stack :blue_heart:!

I think this “[x] to MQTT” pattern of running containers in docker for each IoT subsystem is a pretty great idea.

1 Like

So I just rebuilt a brand new Hassio install on another rpi, literally nothing else installed apart from mosquito, node-red, samba, and ssh, all of which installed fine, but I get the same exact error. Im using my routers dns, but I have tried adding google as well and same issue. Wonder if something is broken in HA land? Really stuck and very frustrated as I need to get this to work lol. Any suggestions would be greatly appreciated…

It’s just so weird. Based on stats from Github the addon has had roughly 150 downloads and, while I’ve had various minor issues reported during the beta cycle and a few feature requests, I’ve not had a single other report of a failure to install. Over the weekend alone I had about 3 people who reported success with the plugin so obviously they are getting it installed. I have two test instances of Hass.io and both install fine for me as well.

I’ve been trying to think of what this might be, or even how to troubleshoot it. Would you mind opening an issue on the Github page for the addon and we can work it there? I’m travelling this week for work, so my chances to work on this may be limited, but I may as for some logs, etc.

I’ve been considering publishing a version of the plugin that just pulls the docker image from docker hub rather than attempts to build it, so perhaps I could build a test one and you can try that.

Thanks for sticking with me. I should have followed your advice earlier, though I cannot imagine for one moment what is causing the issue, but I got the new pi connected to my iPhone personal hotspot, ran the install and it went through no problem. Reconnected back to my home network and all seems good. Wonder if my isp was blocking access to something, but all good now. Sorry, I should have tried this earlier, but its very strange as I have a pretty vanilla network…

Thanks @tcork! That is great to hear even if it is really strange. I had to think it was some type of networking issue or a problem with the Alpine Linux CDN system of some sort. When researching the possible causes I found a few cases of somewhat similar reports in other projects where, for reasons mostly unknown, the Alpine Linux repo could not be reached by a particular user, even though it could be reached for others. The most plausible theory was something wrong with the local mirror that the CDN was directing the user too.

The hackish workaround was to include a few additional mirrors manually into the /etc/apk/repositories file so maybe I’ll add that for some added protection against this issue in the future. Glad you managed to get it installed.

I have a ring contact sensor installed at the front door. From time to time it is getting status of “unavailable”, then “off” in seconds

2020-3-2 02:13:12 Front Door unavailable
2020-3-2 02:13:13 Front Door off
2020-3-2 06:13:12 Front Door unavailable
2020-3-2 06:13:15 Front Door off

I have some automations that are checking if status is “off” do something, else do something else. I’m assuming the status is only “off” and “on”.

Is this “unavailable” expected? If so I’d have to re-write some of the automations to account for this.

Looks this happens to other ring devices too.

Thanks!

While the sensor state itself can only be “on” and “off”, every MQTT device also includes an availability state as well. The idea is that devices monitoring the sensor need a way to notify if the sensor is actually online/offline.

The script currently monitors the websocket connection to Ring servers and sets the availability topic for the sensors based on the status of this connection. If the websocket connection is down, the availability state is set to “offline” and Home Assistant reports the state for that sensor as “unavailable”.

The websocket connection could drop for a number of reasons, typically small internet outages, Ring services outages, etc. You can see if this is the case by looking at the ring-mqtt logs as it will log “Location <location_id> is offline” and then back online during these events.

Now, the fact that you’re seeing it drop offline and then back online so quickly makes me thing that the websocket is disconnecting and then reconnecting just a few seconds later, so maybe I should add some type of delay, like 30-60 seconds, once the websocket connection goes offline, to give it time to reconnect without creating these transient online/offline events.

Regardless, unavailable is indeed a possible state, set by Home Assistant whenever the script can’t get status for the devices and tells Home Assistant the device is offline. Right now this is based completely on the scripts connection to the Ring servers, but in the future I plan to enhance this to report even for devices that are offline due to, for example, the battery going dead, etc. The plumbing for this is already there but I haven’t had time to complete it.

Got it. I’d have to consider this status to make the automation more robust.

From what I observed for the past few days, in all cases, it back to online after 1-3 seconds. What you suggested above should removed most if not all such cases.

Thanks!

Thanks for your work on this. I have Ring pathlights and a flood light battery, and I’m happy to help test.

I grabbed the dev branch of ring-mqtt (not using Hass.io), but not having any luck detecting smart lighting devices. It works fine for my alarm and doorbell components.

Hi all, I have pushed v3.1.0 which includes support for Ring smart lighting (thanks @blainux for the testing) and a number of miscellaneous fixes.

@tcork I also updated the Hass.io addon to 3.1.0 and included an attempt to work around the issue you were having with the install. Now, if the initial APK install fails, it tries up to two other Apline Linux repository mirrors. I’d be interested to see if this manages to work around your issues installing the plugin.

Still have a number of other minor updates and feature request to complete over the next few weeks, but it’s coming along nicely. Then I’ll start to work on v4 which will hopefully include proper device support in Home Assistant.

1 Like

@tsightler
You have one addon listed as “Production Release” and the other listed as “Release,” so when I add your repository I get an option of using 3.0.0 or 3.1.0. Was that your intention? After you pushed 3.1.0, I expected hassio to ask me to update the addon, rather than a second “Ring HassIO Add-on” to show up in the Add-On Store page.

Definitely not the intention. I’ll have to research why this happened as I’m not actually seeing this on my end. Probably some mistake in how I published the update. I assumed simply bumping the version number would cause Hass to prompt for an update.