Announcement

Collapse
No announcement yet.

Can Homeseer monitor Ring Alarm sensor status/alarm condition

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • risquare
    replied
    If there is an API than integration with HS3 is a breeze using Big5 plug-in.

    Leave a comment:


  • jmartin
    replied
    I know this thread is several months old now but it seemed like a good place to both reply to your question and provide some details for others. Happy Holidays by the way!

    I've been a HomeSeer user for 16 years. All old X-10 stuff. Still works! I recently updated from HS2 running on my PC to HS3 running on a Zee S2 (Raspberry Pi). Works well!

    I also recently added a bunch of stuff from Ring into my home. A ring doorbell, 3 of the battery powered outdoor cameras and a full ring alarm system.

    The alarm system in my home consists of the base station, 3 keypads, 2 motion detectors, 13 door/window contact sensors, 3 of the First Alert CO/Smoke detectors and a panic button.

    I too wanted to know if I could see the state of the alarm system and monitor the various sensors. I did a lot of internet searching and contacted HomeSeer to see if there was a way to do it with Z-Wave.

    Since the Ring and HomeSeer are both hubs, you can't connect them together with Z-Wave. And a single Z-Wave device can only belong to a single Z-Wave network so using that method wouldn't work.

    So in my research I found a couple of GIT projects related to Ring.:
    1 - Someone wrote an unofficial Ring API - https://github.com/dgreif/ring
    2 - Someone took that work and created a program to integrate the Ring products with MQTT for HomeAssistant.

    I looked at both and originally thought I might take the Ring API info and try to make a plug-in. I'm a crap programmer so decided to skip that. Next I read up on MQTT and found it to be very interesting and there is a LOT of information out there on it. There is also a HomeSeer plug-in called mcsMQTT that allows discovered MQTT devices (topics) to be make into virtual devices in HomeSeer. Then you can monitor and control things. In reading about the Ring-Alarm-MQTT project it was specifically designed for HomeAssistant but it said it would work with generic MQTT systems. so I thought I'd give it a try. So I focused on learning some MQTT stuff and found it is very lightweight so I ordered a Raspberry Pi 4, stuck in a 32GB MicroSD card that I installed Raspian Linux, connected it to a monitor, keyboard, mouse and my home network, booted the system and started messing around with what it takes to get an integration together. I also like to document step by step the process so here it is:

    Downloaded Raspbian Buster with desktop and recommended software from
    https://www.raspberrypi.org/downloads/raspbian/
    This is the Linux operating system for the Pi


    Downloaded balenaEtcher from
    https://www.balena.io/etcher/
    This is a tool to take the downloaded ZIP file of the OS and load it to the 32GB MicroSD card

    Once this is done and the MicroSD is in the Pi, power it up. Wait for GUI.

    Note the IP address in the Welcome to Raspberry Pi
    Open terminal and do ifconfig and note MAC address (ether) of eth0
    xx:xx:xx:xx:xx:xx

    Go to your router and setup a DHCP reservation. This will make sure the Pi always gets the same IP Address. This is important as we will be telling HomeSeer where to connect to and that's the IP Address of this system. It needs to stay the same unless you get all fancy and setup DNS and a name.

    Follow along in welcome dialog:
    Set country, language and timezone
    Setup new password for the “pi” account. This username and password is for the Pi Linux OS. Later we'll create a username and password for the MQTT stuff.
    Setup screen. Let it know if there is a black border around the screen. Check the box if there is and on next boot resolution will scale to fit
    Skip WiFi network setup. I did this because I have a wired connection to my network.
    Update software. Wait as it takes a while. Mine failed after a while. Did that both times I did this step. Ignore and continue
    Restart the Pi when it says to.
    Wait for Pi to fully boot.

    Now, lets setup SSH remote terminal support. Go to:
    Preferences / Configure Raspberry Pi system / Interfaces
    Enable SSH
    Now, can SSH in and do everything from CLI
    You can now unplug the keyboard, mouse and monitor if you'd like

    SSH into Pi. My desktop is running Windows so I use the free PuTTY telnet/ssh client. Put in the IP Address you noted for the Pi, make sure SSH is selected and Open.
    First time you do this you'll be asked to save the trusted key. Do it. Now you'll get a login in prompt in the PuTTY terminal.
    Login with "pi" and the password you setup for that account.
    Now, lets update all the software since it failed at the beginning steps. Type:
    sudo apt update
    sudo apt full-upgrade
    sudo shutdown -r now
    Log back in after Pi reboots. If using PuTTY you can right click on the title bar and restart session.
    sudo apt update
    sudo apt full-upgrade
    sudo apt -y dist-upgrade
    sudo apt-get clean
    sudo apt-get autoremove --purge
    sudo shutdown -r now
    That's it, the Pi should be up to date. It's recommended that you do this every once in a while if you want to keep your software up to date.

    Install Node.js. This is a critical piece of software.
    Type:
    uname -m
    This determines the ARM processor you have
    Mine is an ARM v7
    Go to here: https://nodejs.org/en/download/
    Copy the download link for your processor. You can do this by right clicking on the download like and selecting Copy Link Location or something similar based on your browser.
    Mine is this one: https://nodejs.org/dist/v12.14.0/nod...-armv7l.tar.xz

    I ended up installing everything in the Downloads directory of the pi account. There are better ways to do it with more legit places to store and install things but it works fine for me.
    cd ~/Downloads
    wget https://nodejs.org/dist/v12.14.0/nod...-armv7l.tar.xz
    This filename will be different based on the ARM processor you have and the version of node that is out at the time you do this.

    You'll notice that the file we just got ends in xz. By default tar which is an unzip program doesn't support this file type so we need to install an add-on to support it:
    sudo apt install xz-utils

    Now let's unzip the file:
    tar -xf node-v12.14.0-linux-armv7l.tar.xz
    This filename will be different based on the ARM processor you have and the version of node that is out at the time you do this.

    cd node-v12.14.0-linux-armv7l/
    Just like the note above, you folder name may be different. You can type ls to see what it is.

    Lets copy the files to the correct folder:
    sudo cp -R * /usr/local/

    Let's make sure the two important software items installed correctly and are running:
    node -v
    Tells version of Node

    npm -v
    Tells version of NPM

    If you get version numbers back on both of these then you're doing great.

    Now is time to install the MQTT Broker/Server. I used Mosquitto.
    sudo apt install mosquitto mosquitto-clients python-pip
    sudo pip install paho-mqtt
    sudo /etc/init.d/mosquitto stop

    Now, it and the required tools are installed. We need to configure some things:

    sudo nano /etc/mosquitto/mosquitto.conf
    Nano is a text editor. Modify the config file with this information:

    #log_dest file /var/log/mosquitto/mosquitto.log
    log_dest topic
    log_type error
    log_type warning
    log_type notice
    log_type information
    connection_messages true
    log_timestamp true

    Note that I added the # on that one line and added all these others
    Save and Exit using control x and then yes and enter

    Lets start mosquitto
    sudo /etc/init.d/mosquitto start

    Now, lets test MQTT Broker. Open two more SSH Sessions. in PuTTY you can right click on the title section and select duplicate session. Do that twice and log in on each.
    Session 1 type: mosquitto_sub -h localhost -t test
    Session 2 type: mosquitto_pub -h localhost -t test -m "hello world"
    Should see hello world in Session 1. If you did then you have a basic MQTT broker up and working. You subscribed to a topic called test and then you published "hello world" to it and it was received. Awesome!

    Now, we want to setup some security. I went with just username and password based security. You can also do certificates but since this is all firewalled inside my home I skipped that part.
    Let stop mosquitto again:
    sudo /etc/init.d/mosquitto stop

    Let's create a username and password for it:
    sudo mosquitto_passwd -c /etc/mosquitto/passwd pi
    Enter Password twice. You could make this the same as the pi account password for the system or make it different since it's specifically for the MQTT broker.

    Let's edit the config file to tell it to use the password:
    sudo nano /etc/mosquitto/conf.d/default.conf
    Add the following:
    allow_anonymous false
    password_file /etc/mosquitto/passwd
    Save and Exit

    Lets start mosquitto again
    sudo /etc/init.d/mosquitto start

    Test MQTT Broker now that it has security. Open two more SSH Sessions like you did above or in the current ones, do control C and type the below info:
    Session 1: mosquitto_sub -h localhost -t test -u pi - P <password>
    Session 2: mosquitto_pub -h localhost -t test -m "hello world" -u pi -P <Password>
    <Password> in this case is the password you setup for the MQTT account for pi. NOT the OS for Pi password....unless you made them the same!
    Should see hello world in Session 1. If you did then you now have security working. Even more awesome!

    We now need to setup websockets for the MQTT broker:
    sudo nano /etc/mosquitto/conf.d/default.conf
    Add to the top of the config file:
    listener 1883
    listener 8083
    protocol websockets
    Save & Exit

    Restart mosquitto so these changes take effect:
    sudo systemctl restart mosquitto

    Test MQTT Broker. Open two more SSH Sessions or do what we did above
    Session 1: mosquitto_sub -h localhost -t test -u pi - P <password>
    Session 2: mosquitto_pub -h localhost -t test -m "hello world" -u pi -P <Password>
    Should see hello world in Session 1. You rock!

    Now, lets reboot the Pi and make sure everything comes up fine with MQTT running on a reboot
    sudo shutdown -r now
    After the system reboots, log back in and make sure the service is running:
    sudo systemctl is-active mosquitto.service
    You could also open the two sessions up and test the pub/sub again if you like.
    If everything looks good at this point then you have an MQTT broker setup and running. Congratulations!

    Now, lets install and configure the Ring Alarm MQTT stuff.

    Install Ring Alarm MQTT:
    cd ~/Downloads
    git clone https://github.com/tsightler/ring-alarm-mqtt.git
    cd ring-alarm-mqtt/
    sudo nano config.json

    Edit as below with X.X.X.X being the IP Address of your Raspberry Pi:
    {
    "host": "X.X.X.X",
    "port": 1883,
    "ring_topic": "ring",
    "hass_topic": "hass/status",
    "mqtt_user": "pi",
    "mqtt_pass": "<password>",
    "ring_user": "<your@email.com>",
    "ring_pass": "<ring_password>"
    }
    Exit and Save
    So, you'll notice that you put your ring alarm credentials in this file. That freaks me out a bit but since this system is kept in my house and is secured I'm not overly worried about it. Also, if you have two-factor authentication on with your account you'll need to disable it or read up on the Ring API page where he talks about a setup that can be done to add support for 2FA. You also put in your MQTT credentials.

    Now, lets make the actual tool executable:
    sudo chmod +x ring-alarm-mqtt.js

    Lets install it with NPM which was part of Node that you installed earlier:
    sudo npm install

    Lets set this program to run at startup. Ignore any errors at this point:
    sudo systemctl enable ring-alarm-mqtt

    Let's go to the folder where the auto startup script is located
    cd /lib/systemd/system

    Lets edit some of the startup script settings
    sudo nano ring-alarm-mqtt.service
    Setup as follows:
    #!/bin/sh -
    [Unit]
    Description=ring-alarm-mqtt

    [Service]
    ExecStart=/usr/bin/node /home/pi/Downloads/ring-alarm-mqtt/ring-alarm-mqtt.js
    Restart=always
    User=pi
    Group=pi
    Environment=PATH=/usr/bin/
    Environment=NODE_ENV=production
    WorkingDirectory=/usr/bin/

    [Install]
    WantedBy=multi-user.target
    Alias=ring-alarm-mqtt.service

    Exit and Save
    You'll notice that the script runs via node and we pointed to the downloads directory as the programs location. We also setup pi as the user that runs the program. Again, this is not really best practice. I should have used a location like /opt/bin but it works...for me!...and hopefully you!

    Let's restart the Pi
    sudo shutdown -r now

    After reboot, Log in and make sure the service is running
    sudo systemctl is-active ring-alarm-mqtt.service
    If it's running then we are making great progress. The Ring-Alarm-MQTT program should have already logged into your ring account and has grabbed a bunch of information and loaded it in the MQTT broker and is monitoring for any updates like system arm state and the state of sensors.

    Lets now setup mcsMQTT on HomeSeer so we can tie this stuff all together.

    Go to the HomeSeer web interface
    Plug-ins tab
    Lighting and Primary Technology
    Select mcsMQTT and Install
    Select the mcsMQTT plug from the installed plug-ins list
    Go to the General tab for the plug-in
    Under MQTT Broker Operations set:
    MQTT Broker Name or IP Address: X.X.X.X which is the IP Address of Raspberry Pi
    MQTT Broker Port 1883 which we set as the listener for MQTT during the mosquitto setup
    MQTT Client ID: mcsMQTT on HomeTrollerZeeS2V7. This may be filled on your system and may be different. It can be whatever you want.
    mcsMQTT LWT Topic: HomeTrollerZeeS2V7/mcsMQTT/LWT. Again, yours may be different but don't change it from default.
    MQTT Broker Security: None
    MQTT Broker Username: pi
    MQTT Broker Password: <MQTT Broker Password>
    OK. Now HomeSeer is talking to the MQTT broker and is not only collecting info but saving info about HomeSeer into the broker. Cool. Now, lets make that info useful!

    Configure HomeSeer to use information from Ring alarm
    HomeSeer web interface
    Plug-ins tab
    mcsMQTT
    MQTT Setup
    Associations
    Association Table to Auto Association of MQTT Topic and HS Device
    Set your Ring alarm system to Arm Home, Disarm, Arm Away and Disarm. This teaches the system the various states the alarm can be in and makes things easier.
    Refresh the web page and you should see a device towards the top of the list set to something like:
    Sub: ring/de37ee7d-7cff-49a9-98eb-49915315975e/alarm/alarm_control_panel/67213b23-9e76-4f12-9318-dfd6e7299321/state
    This is the status of the alarm system.
    Check the box in column 'a'.
    Enter "Ring Alarm Base Station Status" into the pub: the following Topic on Device command field
    Click the number in column "\/" and a pop-up will open
    In the section: HS Device MISC Properties check STATUS_ONLY
    Make sure STATUS_ONLY stayed checked. If you do things too quickly it seems to uncheck it and you have to click again. Just do this part kinda slowly.
    Close the dialog window by hitting the X in the upper right

    Go to View / Device Management and do a search for a room named 'ring'. You will find a new device
    Click the device name
    Change the device name to: Ring Alarm Base Station Status
    Go to the Status Graphics tab
    Click on Add New Single Value create 3 items
    0 - images/HomeSeer/status/armed-stay.png
    1 - images/HomeSeer/status/idle.png
    2 - images/HomeSeer/contemporary/away.png
    You don't have to have graphics and you don't have to use the ones I picked but I like these.
    At this point you can see the status of your system. Try it by arming your system in home and away and disarm and it should update in HomeSeeer. You can also now use this virtual device to trigger events. As an example I setup an event that if I set armed_away and it is night time then turn off all my interior lights. If its daytime turn off all my lights.

    Now, we can add each sensor in your system. This part is kind of a pain in the butt!
    Plug-ins tab
    mcsMQTT
    MQTT Setup
    Associations
    Association Table to Auto Association of MQTT Topic and HS Device
    Scroll through the association pages with Prev and Next until you find the items that have topics starting with Sub:homeassistant
    As I stated previously the Ring-Alarm-MQTT program was written for HomeAssistant so that why you see this reference. But this is where you'll find the device ID's for each of your sensors and you'll find the name of the sensors as you programmed into your ring alarm system.
    Look in the payload field looking for the names of devices in your ring network.
    Note the name and note the last set of numbers before /config:name
    Create a list of these numbers and names for the next step in some editor. You can copy and paste from the HomeSeer page to your editor. This is critical for the next steps to have a list of device ID's and Names

    Now, select 0 as the page of associations to look at. It's located between Prev and Next.
    In the topic section search for each topic that contains "alarm/binary sensor" in the middle and "/state" at the end. It will also say ON or OFF in the payload field. This is the status of the sensor. Right before state will be the device ID. Now, look at your list of device IDs and names that you created for the next step.

    Check the box in column 'a' next to the sensor you located
    Enter the name of this device for your list into the pub: the following Topic on Device command field
    Click the number in column "\/"
    In the section: HS Device MISC Properties check STATUS_ONLY. Occasionally It will unclick. Wait a second and turn back on if needed
    Close the dialog window by clicking the X in the upper right hand corner

    Go to View / Device Management and do a search for a room named 'ring'. You will find a new device called state
    Click the device name
    Change the device name to: Match the name from your list
    Go to the Status Graphics tab
    You will see double entries for 0 and 1. Delete the ones that are set to both, leaving the two status entries for 0 and 1
    Now, select edit to replace the light bulbs with better graphics
    0 - images/HomeSeer/status/green.png
    1 - images/HomeSeer/status/red.png
    You can pick whatever graphics you want or leave them as bulbs but I like these.
    Select Done to save this virtual device
    Repeat adding sensors until complete. I checked off each sensor from my list to make sure I got them all

    Now you have all your sensors and alarm panel state's in HomeSeer. Go open a window and you'll see the state go from OFF to ON.

    Now, go do something cool with this information.

    Lastly, If you know of any shortcuts on any of this process…Let me know! If you are an awesome programmer and want to modify the Ring-Alarm-MQTT program to provide awesome support in HomeSeer or make a plug-in then thanks in advance!

    P.S. - A few things to note. I can't see a way to actually arm or disarm the system with this. Discovery of devices does not show my individual keypads nor my panic button. Not sure if that's a limitation of the program or the API.

    P.P.S. - The only states that are shown for the alarm system are disarmed, armed_home, and armed_away. There is no status for when the alarm system is actually alarming. The behavior I see is that when you do say an Arm Home you get a status update of armed_home while your exit delay counts down. Then it does another armed_home when it activates. Then, if the alarm goes off it sends another armed_home. At first I thought it would be easy to setup a counter and if the number of armed_home exceeded 3 then kick off an event. but, when you get home and open the door it sends another armed_home until you keypad the system to disarmed. But if you disarmed the system via the phone app then you don't get that additional armed_home. So from what I'm finding I'd have to monitor my sensors and if a sensor was ON and the system is armed then I could do something. But, some sensors are immediate and some are delayed so I'd have to take all that into account. I haven't figured out the proper logic that works in HomeSeer for this yet so instead I did something different to kick off an event if an alarm is active. Here is what I did:
    1 - Ring will send you an email from no-reply@rs.ring.com with the subject "Ring is Alarming". So, I have a little free email account setup for my HomeSeer. In my account if I receive one of these emails it's automatically forwarded to the HomeSeer email. I have an event setup that if it receives such an email that it kicks off an event. In my case I have it look to see if it's day or night. If night it turns on a bunch of my interior lights. I also have some old X10 Powerhorns so I set them off in a looping trigger to add some volume to the alarm in areas where I don't have a keypad or siren. But, I use the status of the alarm system via MQTT that when it goes disarmed an event runs that cancels the looping event for the Powerhorns. This seems to be working well in my testing.
    P.P.P.S. - Since i have the First Alert CO/Smoke Detectors I monitor their state and if any of them turn ON and it's night I turn all my lights on in and outside the house to make it easier to escape.

    I really hope this is useful information and more than that I hope it kicks off an idea for one of the super users to make it very specific to HomeSeer!

    Joe

    Leave a comment:


  • aa6vh
    replied
    I do not have a Ring alarm system, so cannot answer your question directly. But I do have a Ring doorbell/motion detector. I have an IFTTT trigger that fires when Ring detects motion, that runs a Homeseer event. Maybe IFTTT would supply what you need?

    Leave a comment:


  • Can Homeseer monitor Ring Alarm sensor status/alarm condition

    My new home is set up with a Ring Alarm. I have brought with me my HomeSeer
    HS3 ZEE S2 Edition 3.0.0.534. Can HomeSeer read Ring sensors? As an example, I'd like to monitor a window that has Ring contact sensors. It would be nice for me to know the status of the window in my HomeSeer events program. Also I'd like to monitor Ring to know when the Ring alarm is active so that lights would flash via HomeSeer program.
    Thanks for your advice.
Working...
X