I’m thinking about buying a Smartthings hub and was wondering if it would work well with my Ring security system?
I have the Ring security system, but unfortunately there’s no external siren to go off if there’s a break-in (bit of an oversight, if you ask me). However, Ring sell a Floodlight Cam (https://en-uk.ring.com/products/floodlight-cam) which has a built in siren. The only downside is the siren has to be activated manually.
My question is, can something be set-up in ST such that if the alarm is armed, and a sensor is tripped, can it trigger the Ring Floodlight Cam to sound the siren?
You can Activate the siren on a ring from SmartThings you just need to write a custom Device Handler.
Luckily I have done that.
go here for instructions
Whats Suspicious? The PHP page to get your Ring Device ID Oauth Refresh token? The code is all there you can inspect if you want or you could just use postman like i did originally. I can say the integration works pretty well. Based all my code off of this post https://philipnye.com/2017/12/29/control-your-ring-spotlight-with-alexa-with-smart-things/ but had to do a fair amount of work to get it to work with 2fa as it seems ring enables that by default now.
Considering the Ring “hacking” of recent past, I’m particularly suspicious of any third party web application wanting me to enter in my Ring username and password as well as the 2FA.
I mean no disrespect and your integration is appreciated now that you provided additional information. I did inspect your code and I’m not good at reading code so it was hard for me to tell whether the code was doing any relaying of my Ring info to a third party.
I would hope that you could appreciate my concerns considering the limited info you provided in your original post. Which you had also posted in another thread.
I understand. I considered hosting the PHP page myself to make it easy for people without a web server but figured no one in their right mind would put their username and password in a random website (nor should they). I was also concerned with burden of having to keep the website secure against outside actors. Running on your own web server in a local environment should keep you safe. The only CURL posts i make are to ring API servers and those are all over https (you can view the CURL sections of the php. I dont believe i store anything on the server but even if I did the 2fa code expires pretty quickly and its hosted on a server you own. The Postman collection in the link i sent gets you 80% of the way to getting it to work now but instead of an auth_token sent in the put or get parameters you have to use a bearer token (access_token) in the header. Also in order to get this access_token you must first log in with username and password then wait for email and add 2 fields to the header 2fa-support = true and 2fa-code = “code from email” then you get the access token and refresh_token the access token only lasts 60 min so you constantly have to use the refresh token to get a new access token and new refresh token. With this information you could get the Device ID and Refresh token you need for the device handler just by using postman without the need for the php script.
great work on adapting the code to get this capability going - I have given this a try and from SmartThings I can manually now trigger the floodlight siren - which is good.
Questions
How to I set it up so that when the Ring Alarm is triggered then the Floodlight Siren is automatically triggered too - as this is not working now. (does this script integrate the ring alarm and SmartThings?)
Using your instructions I have entered the “refresh token” - however doesn’t this change every few hours - and if so how does the device handler get the latest working token to connect to the floodlight cam?
I gave up on ring alarm and just use smart things door sensors and camera motion events to trigger all the lights and sirens on and push notification to my phone. You may be able to use the alexa app and routine in the alexa app to turn on a virtual light switch in smart things and use that as a trigger to sound alarms. This would all be dependent on if alexa can get the status of a ring alarm. I know that alexa can get motion alerts out of the cheap ring indoor cameras that do not have smart things integration and this is how i use them as motion sensors around my house. so you may be able to do something like that.
If i remember correctly the API token that I get from the refresh token expires after 1 hour however the refresh token can be used indefinitely as long as its only used once. I use the command state.refreshtok = resp.data.refresh_token to load a new refresh token into smartthings every time the alarm is triggered so you only use the Initial refresh token to get the ball rolling. (I only look at that code if (state.refreshtok == null) which would be on the first use). Hope that explains how that part works. Im sure there are more elegant ways to integrate but this was the best i could think of.
in order to get the API key using AWS i would recommend you follow this tutorial
the only thing you would change in the tutorial is to paste this code in where add launch script portion. (step 3 subsection b) #--------Paste in Launch Scipt---------#
cd /opt/bitnami/apache2/htdocs
rm -rf *
#-set write permissons on the settings file #-----------------------------------
chown bitnami:daemon ringauth.php
chmod 666 ringauth.php #--------- Stop Pasting here ----------#
after you browse to https://–instance IP–/ringauth.php and enter the information you need (device ID Refesh token) then you can delete the amazon instance to avoid getting billed.
On my todo list is to write a windows program to do this so you do not need a web server but php was the easiest language for me to write this in.
Thanks Adam, I think I am close to getting it to work but have received the following message: Notice : Undefined property: stdClass::$next_time_in_secs in /opt/bitnami/apache/htdocs/SmarthingsRingSiren/ringauth.php on line 46
looks like you are very close, I just tested and as far as i can tell I think that error pops up if your ring username and password is incorrect. It might also be some sort of other authentication error maybe based on geolocation of your amazon server or ring having another another API server for your account. Possibly check where your instance is located if you are sure the username and password is correct.
If you remove the “//” from “// echo $response;” in line 40 you will get more clues as to what the issue is.
Thanks Adam! You were right on, it was the incorrect password. After a few tweeks, I was able to get it to work. I have lots of respect for you and really appreciate all your help and your work!
It does mean a lot for an amatuer like me will little coding experience to get this to work. My next project maybe to try to get the flood lights for the Ring to flash as well… Will be following you and looking to make more improvements on my Ring security system.
Also I would like to somehow connect it to (maybe a power switch/plug) and make it turn on and play gun/machine gun sounds from speakers. I already have speakers, but don’t know what kind of device I can buy to have it automatically turn on and play (maybe a mp3 file?) on speakers.
After this Covid thing blows over, please let me know if you are ever around the San Francisco Area, would be grateful to grab a cup of coffee with you.