Ring Alarm - MQTT Discovery Alarm integration

Just posted my initial version (almost identical to @rajansub’s at the moment aside from minor edits to the package.json to simplify the NPM install process) if anyone wants to give it a try and confirm it’s working. This still requires local build but I’m going to work on the Docker images next.

Fired right up and works like a charm! You rock!

I was able to get this working in Docker without issues. This is the Dockerfile I created:

FROM ubuntu:18.04

RUN apt-get update; apt-get -y upgrade; apt-get -y install nodejs npm

RUN npm install mqtt async ring-alarm socket.io-client js-yaml

RUN mkdir /ring
COPY ring-alarm-HA-plugin /ring

COPY mqttAlarm.sh /ring/mqttAlarm.sh
RUN chmod a+x /ring/mqttAlarm.sh

ENTRYPOINT [“/ring/mqttAlarm.sh”]

I get the latest ubuntu 18.04 image, update it and install dependencies. I have your repo cloned to a subdirectory called “ring-alarm-HA-plugin” that I copy to a folder in the root directory. I then copy the 3 files that I have made changes to (yamlGenerator.sh, mqttAlarm.sh, mqttAlarm.js) Then I run the mqttAlarm.sh script and you are good to go.

I do use docker-compose to initialize the docker container, which requires a little more work than the above. Obviously this is specific to my use case. You can maybe make the mqttAlarm.sh script accept variables, and then your entrypoint can pass those in so you do not need to copy an edited mqttAlarm.sh file (the end user can just edit the Dockerfile and nothing else needs to be done).

Hope that helps or at least gives you direction.

Thanks for the pointers. I am hoping the script that the developer documents links to will make it reasonably painless. Hoping to get some time to try it this weekend.

@acolytec3 and @rajansub thank you so so so so much. This is awesoooome! Really great work fellas. When I bought the ring alarm, I wasn’t into home automation. After I bought the alarm, I got sucked into the rabbit hole and thought I was out of luck with the closed ring ecosystem. You guys broke that bad boy wide open!

One issue I’ve noticed with rajansub’s add on…when I restart home assistant, the add on breaks. I have to rebuild or restart it every time I restart HA. Not sure if that’s a known bug, but I thought I’d let you know.

I used acolytec3’s plugin and decided to check on rebooting HASSIO just now. I found the same thing… had to restart the plugin to get it the items to show up. It must start up before the MQTT server and not make the connection? I think I had the same problem with the plugin running on Virtual Box too though. If HASSIO restarted I had to restart the script.

Thats strange. I just rebooted my hassio and my plugin picked up right away and connected.
My MQTT server is separate from HASSIO though and did not go down. Wondering if that’s the difference.

I see that too in my hassio instance now that you’ve pointed it out. Admittedly, mine’s running on my dev laptop and only when I boot it up so all bets are off with comparison to how Hassio performs on a RPi3 that’s not constantly rebooting. It’s probably something goofy in how the autodiscovery process works with Hassio and having containers and all that. I’ll have to look at the interaction between the internal broker and the plugin. I know for sure tht’siat the plugin itself works fine across start-ups since I can see in the logs that it’s connecting to Ring and getting updates. At least in my case, it’s something to do with Hassio not recreating the alarm components in the front end every time the system reboots.

I also just checked…running @acolytec3’s addon in hassio with mqtt broker on same server…have to restart the addon after a restart of ha.

I am running hassio on 18.04 NUC if that makes a difference. Also using Hassio’s built in MQTT. That seems to be where the problem arises

Try the addon now. I delayed the start of the script by 30 seconds to give the MQTT server time to start up. Cant test since I do not use the inbuilt MQTT server.

Wow. Now that is lightning fast development. I’ll try it out when I get home. Thanks again. Superb work buddy

Will we be able to see locks with this eventually?

Ring doesn’t have any locks? Most locks would be added to HA through the appropriate means.

I’ve added my z-wave locks to Ring. There are benefits to this. You can manage access through the Ring app for all locks and users and unlocking the lock with the code, disarms the alarm.

Ring now has the ability to recognize a number of locks and control them. Info at https://support.ring.com/hc/en-us/articles/360017691131.

Sure. I knew that. I guess my question is what is the benefit of adding your lock to ring versus adding it to HA? With Ring integration you could do all of that functionality from within HA, yes?

Conceivably, yes. If your lock (or any other z-wave device - like the new dome siren or First Alert smoke alarm) is associated with your Ring Alarm system, then my script will get back a unique identifier for that device. That said, I’d have to build out a use case for each one in the script to create the autodiscovery and status update code. Right now, the script only support setting the base alarm mode and then contact and motion sensors (since those are the only things I have registered on my system). If someone who has these other devices is interested in sharing the API responses from Ring that the script produces, I can probably add those to the script. I’ll have to modify the logging output to output all the alarm devices and push a new version to the repo. This would allow me to add in monitoring for the status of these other devices. Actually controlling the locks is a completely different animal and would require additional development on the underlying API code (which I didn’t write). I do have a to-do to look at the underlying code and see if it’s possible to turn off the alarm using the code rather than just a simple button press but only so many spare minutes in a week, so it’s pretty far down on my list. :-/

@rajansub Even on .5, my devices are still not found upon restarting Hassio

Not to take anything away from the script here, but I wrote my own version that tries to fix all of the auto discovery issues, breaks the code into more functions, and includes a few other fixes/enhancements. I mostly wrote it for my personal use but thought perhaps some others might prefer a fully automatic configuration option so decided to share it as well.

1 Like