Ring Alarm - MQTT Discovery Alarm integration

Got the integration up and running! This is very awesome.
Thanks acolytec3 for your work!
Thanks a ton to KageKeeper for your time and patience in helping this noob get things up and running.

1 Like

First off, thank you! This is working awesome for me. One thing I can’t figure out. Does this have the ability to detect when an alarm has been tripped? Essentially, I want to be able to turn on all the lights in my house if the alarm goes off. There is an alternative way I can probably do this using automation, by monitoring each of the sensors while the system is armed and triggering then, but it would certainly save work if I could just trigger based on the trip. Cheers!

The API probably does though I haven’t added anything like this to my script. I’ll take a look and see what kind of updates Ring sends back. I could have it fire off an mqtt message when the alarm trips. You’d have to set up some sort of automation to send a notification at that point though.

Just adding a “works for me.” I’m using hassio on a Pi, but curiosity finally killed the cat. I downloaded Virtualbox and created a Ubuntu VM and setup the script. Took about an hour or so. It’s cool to see all the stuff populate in Home Assistant. Now I need to figure out what to do for a permanent home for it, and that may be switching over to a NUC sooner than I’d planned. Being able to reuse the Ring sensors saves having to put up a second set of sensors to automate things. This is great!

I also became a curious one with this script. Turns out that you don’t necessarily have to have this working with HomeAssistant. I decided to build my own Raspberry Pi MQTT application on macOS from scratch and just having the Raspberry Pi run the MQTT broker as well as the script and I can happily receive notifications on my Mac. I can also trigger actions as well.

Basically what you can do with Ring Alarm MQTT is limitless. Really appreciate the work that @acolytec3 has done!

1 Like

Very true. The only Home Assistant specific pieces of this are the autodiscovery items. The rest is just posting status updates to your MQTT broker.

1 Like

How does one do this: Raspberry Pi MQTT application on macOS?

I can program through swift and such, but wouldn’t mind a starting point

I’m not sure I follow your specific question but the NodeJS script should theoretically run on MacOS. It’s not Raspberry Pi specific. I actually do my development on an Intel-based laptop running Ubuntu but the code should work fine on any Linux system running a reasonbly updated version of NodeJS.

I hear you about nodejs running everywhere. I was wondering how does one make notifications on MACOSX. I guess i can use google as well. :slight_smile:
BTW, your stuff is great! I use home assistant now more than the ring app as it’s faster.

Gotcha. Sorry, I can’t be of any help there beyond noting that all you need is some sort of code to subscribe to the MQTT notifications that the script posts. I guess you could also use the notification service in HA to send text updates to your phone and then have iMessage display them or something akin to that. There are tons of other integrations for the notification service and that way you can control it directly from HA rather than having to stand up a new app. Home Assistant Notifications

This applies to anyone that may be interested in developing their own application for iOS or macOS. Once you have your MQTT broker and the mqttAlarm.sh running, you need to think about what devices will communicate with each other.

For example, if you want your Mac to receive messages from the mqttAlarm script, you need to develop an application for it that implements the MQTT protocol. Now, what if you want to interact with these messages? Let’s say you have a button on your application that you can press to turn on an LED on a Raspberry Pi. The work now doubles because this means you must also write an application for the Raspberry Pi to handle the messages your Mac sends out. The Raspberry Pi application must also implement the MQTT protocol.

For me, the best library to use for iOS and macOS using the Swift language is CocoaMQTT. Implement that into your Xcode project via CocoaPods and you should be able to start using it. In terms of the Linux side of things, implement the official Eclipse Paho MQTT library either in your Python or Java program. I’m not sure about Android since I don’t own an Android device.

Btw, for Mac notifications, this is the code (Swift):

 func displayNotification() {
    let notification = NSUserNotification()
    notification.title = "Some Title"
    notification.subtitle = "Some Subtitle"
    notification.informativeText = "Some long message to display."
    let notificationCenter = NSUserNotificationCenter.default
    notificationCenter.deliver(notification)
}

This forum post is for HomeAssistant though so don’t want to go off topic. But hopefully that helps.

I spent quite a while banging my head against the wall trying to get this working in Docker so that I could run it on the same Pi as my hassio install, but I got nowhere.

Today I found an old first generation Pi model B in a drawer that I forgot I had, and I was able to get this up and running on that with minimal fuss. So far it works great! It would be nice if someone smarter than me made a pre-made docker container or Hassio add-on for this, but as-is I think having a separate dedicated pi for it is the way to go.

Thanks for all your work on this, @acolytec3!

Is there anyway to force the user to enter a Ring Alarm disarm code before letting them disarm? At the moment it looks like someone could just hit the Disarm button in the UI and disarm the system without a code. So if for instance you have HA on a wall tablet, an intruder can break in and hit Disarm? Thanks for your work on this.

I think it’s possible but I haven’t delved that much into the underlying API functionality. I can add it to my roadmap.

1 Like

I have created a HASSIO addon based on acolytec3 awesome work.

  1. Link to the URL is https://github.com/rs1932/ring-alarm-ha-integration
    for creating a custom repository and then installing it from there (HASSIO addon store)
  2. The plugin options are in the options - username, password, mqtt server etc.
  3. For the mqtt server, you have to enter mqtt://IP_ADDRESS
  4. I have not touched or modified acolytec3’s work, the addon uses git to pull in the code from his repository (I hope thats okay with you, acolytec3)

This is my first addon so I am sure there will be a better way to implement it, but it works for now.
RS

4 Likes

BOOM! There it is. I knew someone would get to it sooner than later!

I will be checking this out momentarily @rajansub. Thank you in advance!

Totally fine, @rajansub. Mine is derivative of someone else’s work too. Coincidentally, I actually just got a local add-on working for HassIO working last night, a side benefit of trying to learn how to use Docker. I’ve cleaned up the script a little bit too though won’t have any perceptible influence on the current function of the script. It’s interesting that it worked for you unmodified. I had to modify a couple of pieces of the mqttAlarm.js script to get it to work right within a container.
Feel free to keep working on yours though I will probably post mine to Dockerhub once I get it cleaned up a little more. I want to make the setup process within HassIO a little less painful then having to modify the raw config section of the add-on configuration page.

2 Likes

Just installed @rajansub’s addon, and it seems to be working flawlessly. I look forward to what you both do moving forward!

1 Like

Did the autodiscovery feature work with your version of the add-on? I had to add a separate option for autodiscovery in the config.json in order for it to work.

As far as I can tell it does.