SmartThings now permanently offline

Not a bad idea. HE doesn’t support device firmware updates.

My ST v2 Hub has been unplugged for about 5 days now. I needed to reorganize some wiring and needed the Cat5 cable it was using for another device. I haven’t missed it at all.

I’ll keep it around as I still support ST_Anything for ST users.

4 Likes

I wasn't using ST with much in the way of custom code, other than a specific device handler for motion dimmers. As soon as I migrated all my z-wave and zigbee devices over I yanked the cord on ST hub and haven't looked back.

Already I am doing things with HE that I never even though to do with ST. Also, wanting functionality is making me learn Groovy which reminds me how satisfying it is to get code to function correctly.

4 Likes

I have new doors with dead bolts being installed in the next week or so, I may go to (i know!) nest's yale lock instead, I use all the cameras and thermostats and nest protects so it would all be in one place.

I believe the NEST Yale is a WiFi lock, so you’d be going all cloud, as all NEST products are, except for communication between themselves over nest thread protocol.

2 Likes

Not sure if you managed to get your Ring Floodlights going, but I just got mine working today. I'm brand new to Hubitat and after trying to figure out Home Assistant, I stumbled across this amazing community.

I just setup my Hubitat and one item on my list was the Ring Floodlight. I came across this post: Ring Floodlight Groovy Code

Using the groovy code from the article I was able to install it as a custom driver in hubitat. I setup a virtual device using the IP for my floodlight and to my surprise the groovy code ported without edit. I added my ring username, password, and device ID and am able to turn the floods on / off from Hubitat.

Warning - getting the Device ID from ring was a little tricky and the directions were not clear (at least for me as a noob). To do it, download an application called "Postman" which will let you call the RIng API. Make sure to setup a new environment in postman to define the global variables the postman script in the article needs. This will give you the device ID for your floods and whatever other ring devices you have on your account.

2 Likes

Interesting. So perhaps arming/disarming the Ring security system from HE might not be too challenging. Thanks for sharing this, and Welcome to the Hubitat Community.

1 Like

I set this up as instructed.
The first 2 POST command execute and generate the necessary token...but when I run the Get Devices, I get a Status:401 Unauthorized.
Username and password are accurate and they generate the token without balking so it's strange that the Get Devices errors out.

1 Like

That happened to me the first few times. I had to click through each tab quite quickly. If you can try to put the three sections (get oauth, get token, get devices) in the tabs above the main section in postman. This way you can select a tab and hit send. I think it's just a timing thing as long as you got the oauth and token successfully.

1 Like

Will give it a shot.

1 Like

Wow...had to try 10 times in a row as quickly as possible...but I got it. Thanks for the help.

3 Likes

Anyone have a Ring alarm system that you could see if a slight modification would be able to arm/disarm it?

I don't but I believe @mike.maxwell will be getting his hands on one soon :wink:

As an FYI, the pic below is of the main sections returned by a device query using the Ring API. My guess is that the Ring alarm will be listed under "base_stations". My Doorbell pro was under "doorbots" and my floodlight was under "stickup_cams".

image

4 Likes

Great! Thanks. I’m getting an uneasy feeling lately that iSmart Alarm’s plan to not have a recurring revenue stream, has ultimately not panned out, and like it or not I may have a white box that might soon only offer the protection of throwing it at intruders.

4 Likes

I noticed at the bottom of the same article describing how to get the flood going another guy posted code to turn the floodlight can alarm on and off. Kinda cool for another automation scheme.

Do you have any advice for getting the video feed into the HE dashboard? That was my next challenge.

Glad to hear it worked for you as well!

That is way beyond my capability. Accessing the video feed would be the first part of the scenario. Converting the feed to be compatible with the dashboard would be the next...if it's even possible.

@Someguy, I made a few adjustments to the groovy code you linked to above. The driver was generating unnecessary logs (that included the tokens in plain text). It also generated http exceptions for every on/off PUT request. I adjusted the httpPut requests to look for the correct contentType and the errors are now gone. I also added a Debug Log toggle so the excessive logging could be enabled/disabled through the driver preferences.
See my updated code below.

/**
 *
 *  Ring Spotlight Cam Light Control
 * 
 *  Needs the username/password and the device ID of the device. 
 *  This needs to be sourced by an API call to
 *  https://api.ring.com/clients_api/ring_devices?api_version=9&auth_token={{auth_token}}
 *  
 *  I used https://github.com/davglass/doorbot as a guide to build the requests.
 *  Author: Philip
 *
 *
 *	edited for hubitat by Stephan Hackett
 * 	3/16/19
 *		- added debug logging toggle
 *		- changed PUT requests for on() and off() to use 'application/html' instead of Json - prevents the exception errors that were occurring
 *
 */
metadata {
	definition (name: "Ring Spotlight", namespace: "stephack", author: "Philip") {
		capability "Actuator"
		capability "Switch"
		capability "Sensor"
	}
	
	preferences {
        input "username", "email", title: "Ring Username", description: "Email used to login to Ring.com", displayDuringSetup: true, required: true
        input "password", "password", title: "Ring Password", description: "Password you login to Ring.com", displayDuringSetup: true, required: true
        //Not sure there is a better way to do this than ask? 
        input "deviceid", "text", title: "Device ID", description: "The numeric value that identifies the device", displayDuringSetup: true, required: true
		input "logEnable", "bool", title: "Enable Debug Logging?"
    }
}

def parse(String description) {
}

def authenticate() 
{
	def s = "${username}:${password}"
	String encodedUandP = s.bytes.encodeBase64()
    
    def token = "EMPTY"
    def params = [
    	uri: "https://oauth.ring.com",
    	path: "/oauth/token",
        headers: [
            "User-Agent": "iOS"
    	],
        requestContentType: "application/json",
        body: "{\"client_id\": \"ring_official_ios\",\"grant_type\": \"password\",\"password\": \"${password}\",\"scope\": \"client\",\"username\": \"${username}\"}"
	]
    try {
        httpPost(params) { resp ->
            if(logEnable) log.debug "POST response code: ${resp.status}"
            
            if(logEnable) log.debug "response data: ${resp.data}"
            token = resp.data.access_token
        }
    } catch (e) {
        log.error "HTTP Exception Received on POST: $e"
        log.error "response data: ${resp.data}"
        return
        
    }
    
    params = [
    	uri: "https://api.ring.com",
    	path: "/clients_api/session",
        headers: [
        	Authorization: "Bearer ${token}",
            "User-Agent": "iOS"
    	],
        requestContentType: "application/x-www-form-urlencoded",
        body: "device%5Bos%5D=ios&device%5Bhardware_id%5D=a565187537a28e5cc26819e594e28213&api_version=9"
	]

    try {
        httpPost(params) { resp ->
            if(logEnable) log.debug "POST response code: ${resp.status}"
            
            if(logEnable) log.debug "response data: ${resp.data}"
            token = resp.data.profile.authentication_token
        }
    } catch (e) {
        log.error "HTTP Exception Received on POST: $e"
        log.error "response data: ${resp.data}"
        return
        
    }
    
    if(logEnable) log.debug "Authenticated, Token Found."
    return token
}

def on() {
	
    if(logEnable) log.debug "Attempting to Switch On."
    def token = authenticate()
    //Send Command to Turn On
    def paramsforPut = [
    	uri: "https://api.ring.com",
    	path: "/clients_api/doorbots/${deviceid}/floodlight_light_on",
        query: [
        	api_version: "9",
            "auth_token": token
    	],
		contentType:'application/html'
	]
    try {
        httpPut(paramsforPut) { resp ->
			if(logEnable) log.debug "PUT(on) response code: ${resp.status}"
        }
    } catch (e) {
        //ALWAYS seems to throw an exception?
        //Platform bug maybe? 
        log.error "HTTP Exception Received on PUT: $e"
    }
	sendEvent(name: "switch", value: "on")
	log.info "${device.label} was turned on"
}

def off() {

    if(logEnable) log.debug "Attempting to Switch Off"
    def token = authenticate()
    
    //Send Command to Turn Off
    def paramsforPut = [
    	uri: "https://api.ring.com",
    	path: "/clients_api/doorbots/${deviceid}/floodlight_light_off",
        query: [
        	api_version: "9",
            "auth_token": token
    	],
		contentType:'application/html'
	]
    try {
        httpPut(paramsforPut) { resp ->
            if(logEnable) log.debug "PUT(off) response code: ${resp.status}"
        }
    } catch (e) {
        //ALWAYS seems to throw an exception?
        //Platform bug maybe? 
        log.error "HTTP Exception Received on PUT: $e"
    }
    sendEvent(name: "switch", value: "off")
	log.info "${device.label} was turned off"
}
2 Likes

This is great - how do you get the Device ID?

Instructions are in the link shown in this post.

It's a bit of a pain, but there is some guidance above.

1 Like

Oops didnt see that sorry. :grimacing: