Ring doorbell

How are you trying to embed it? It comes up fine for me if I use the built in frame widget and use the event url item as the source, or an iframe in a custom widget works too

This is how I got it working, when the time of last video changes it downloads the video to my tmp folder with the name as the datestamp.mp4. Thanks so much for getting me on my way with it: Things still to do:

  • Now to find a way to only keep the last 5 and then display them under the one that the ring thing shows in the UI.
rule "ringo"
when
Item Ring_Time changed
then
executeCommandLine("wget "+ Ring_URL.state.toString +" -O /tmp/" + Ring_Time.toString + ".mp4",5000)
end

If anyone is interested, I also managed to stop the video escaping its div, although this may just be a problem to me. I also stopped the video auto playing. I loaded a html page to the sitemap from the html folder as an iFrame with:

        Webview url="/static/css.html" height=1 icon=none

css.html contained the following to inject the css to the video div on the main BasicUI

<!DOCTYPE html>
<html>
<head>
    <script src="jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
        $( document ).ready(function()
        {
                $(parent.document).find('video').css('width', 'inherit');
                $(parent.document).find('video').removeAttr('autoplay');
        });
    </script>
</head>
<body>

</body>
</html>

Cool, thanks for sharing! The autoplay was driving me nuts. With my rule, i’ve noticed if I don’t put in a delay there’s maybe a 50/50 chance that the download would error out because the file itself wasn’t yet ready on ring’s server. Are you seeing the same?

Edit:
For your top 5 issue, I know you can get the top 5 files by newest using the command ls -1t | tail -5 . You should be able to get them into a list you can use in a rule like this I would think, although you might want to consider downloading your videos to a subfolder of /tmp so you don’t grab other files then

top5files = executeCommandLine("ls -1t /tmp/ | tail -5",5000)
// ???
// profit!

I am pretty sure that you are right. I don’t get many visitors and I couldn’t be bothered to walk to the front gate so I just used another trigger in place of the updated ring timestamp trigger to download the last MP4. I imagine a 30 - 60 second delay would be required?

Other issues that have come about - can’t use the timestamp as the MP4 file name. Too many illegal characters I believe.

Couldn’t display 2 html divs on the UI at the same time. Second one never gets the video. Works with Webview at height 16. Actually between 16 and 17 but doesn’t allow .5 of a line. I’ll have to apply the autostart block to that as well.

All I need now is a way to reference them plus save the datestamp - a small database may be the option. Just the last 5 would do me but I need to set it to overwrite the oldest one.

EDIT: just notice MySQL in the add ons. Now there’s something I am familiar with so there could be a solution for me

Guys can you reupload jar file? thanks

Sorry, it looks like there was a few different ones posted over time but only the last one I posted is valid. I went through and changed all my links to point to the latest one. Here it is just to make it easy: https://github.com/zolakk/openhab2-addons-ring/raw/master/target/org.openhab.binding.ring-2.5.0-SNAPSHOT.jar?raw=true

Thanks :slight_smile:

I am setting up the ring binding. I have a doorbell and 3 floodlight cameras. I am able to replay the most recent recording in habpanel. The following is showing up in my log:

2019-03-03 22:51:29.315 [DEBUG] [hab.binding.ring.internal.RestClient] - RestApi response: [{"id":xxxxxxxxxxxxx,"created_at":"2019-03-04T05:24:58.000Z","answered":false,"events":[],"kind":"motion","favorite":false,"snapshot_url":"","recording":{"status":"ready"},"duration":0,"doorbot":{"id":xxxxxxxx,"description":"Backyard"}},{"id":xxxxxxxxxxxxx,"created_at":"2019-03-04T04:44:16.000Z","answered":false,"events":[],"kind":"motion","favorite":false,"snapshot_url":"","recording":{"status":"ready"},"duration":0,"doorbot":{"id":xxxxxxx,"description":"Front Door"}},{"id":xxxxxxxxxxxxx,"created_at":"2019-03-04T03:39:38.000Z","answered":false,"events":[],"kind":"motion","favorite":false,"snapshot_url":"","recording":{"status":"ready"},"duration":0,"doorbot":{"id":xxxxxxx,"description":"Front Door"}},{"id":xxxxxxxxxxxxxxxx,"created_at":"2019-03-04T03:30:04.000Z","answered":false,"events":[],"kind":"motion","favorite":false,"snapshot_url":"","recording":{"status":"ready"},"duration":0,"doorbot":{"id":xxxxxxxx,"description":"Front Door"}},{"id":xxxxxxxxxxxxxxxx,"created_at":"2019-03-04T03:19:43.000Z","answered":true,"events":[],"kind":"on_demand","favorite":false,"snapshot_url":"","recording":{"status":"ready"},"duration":0,"doorbot":{"id":xxxxxxxx,"description":"Backyard"}}].
2019-03-03 22:51:32.010 [DEBUG] [ing.ring.handler.AbstractRingHandler] - Exception occurred during execution of startAutomaticRefresh(): null
java.lang.NullPointerException: null
	at org.openhab.binding.ring.internal.data.AbstractRingDevice.getBattery(AbstractRingDevice.java:124) ~[227:org.openhab.binding.ring:2.5.0.201901302227]
	at org.openhab.binding.ring.handler.StickupcamHandler.minuteTick(StickupcamHandler.java:100) ~[227:org.openhab.binding.ring:2.5.0.201901302227]
	at org.openhab.binding.ring.handler.AbstractRingHandler$1.run(AbstractRingHandler.java:79) [227:org.openhab.binding.ring:2.5.0.201901302227]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
	at java.lang.Thread.run(Thread.java:748) [?:?]

I changed the id’s in my logs, because there might be a security risk putting those out in public.

Also, this binding appears to be derived from https://github.com/davglass/doorbot

So there should be a way to make a channel that turns the floodlights on and off and to set the chime to do not disturb.

Also, only one of my cameras is battery powered. The others are hardwired. I am unable to retrieve the battery charge on the one that is battery powered.

Edit: For my Ring 2 doorbell, the battery is reading: 4006. For my 3 stickup cams the battery is reading NULL.

Also, I was wondering about the channels Enabled and Status. These are defined as Switches. Shouldn’t they be Strings if they are reading the state? “Enabled” is reading “ON” on habpanel for the ring account thing and Status is reading OFF. But Status and Enabled are NULL for my doorbell and 3 cameras. Looking at my logs, on the Rest api, I notice the following which makes me think for status, we need it to be a string or else have a transformation that changes “ready” to “on”.

"recording":{"status":"ready"}

Sorry for the late response, i’ve been really busy with work lately so I haven’t had a lot of time to look at things.

Changing the IDs is fine, what is really needed is the rest response. It looks like the rest client isn’t getting the battery status from the ring website for some reason. Are both of those devices cameras?

I believe you’re right, it’s probably just a matter of figuring out how to expose the new channels. Unfortunately i’m not too familiar with how to do that, I just took the existing work and have been figuring how to rig it to work and how bindings in general are constructed in my free time. I will add that to the list of things to look at when I get time.

Honestly, the whole project probably needs to be re-written from the ground up - especially if we want to move the URL channels to the individual device things instead of lumping them all on the account thing and quite possibly to fix the item registry bug where you can’t re-add devices after deleting without restarting the binding. I also only have a single hardwired doorbell, so troubleshooting the other devices and battery channels is very challenging for me.

I’ll have to dig more into this, I can’t imagine how 4006 as a battery value could be getting sent by ring.com.

Honestly, I was never 100% sure what the intent of those channels were in the original author’s design. My understanding was that the “enabled” channel was equivalent to enabling or disabling that device in the app in that it just silences events from that device to that specific app instance. As far as I know, there’s no way to totally enable or disable a device across all app instances from one place. For the “status” channel, I think you’re right there in that should probably be a read-only string because I believe that is the status of the device itself.

1 Like

Is there anyway to obtain the live video feed (rtsp, ONVIF etc)? I’d like to perform facial recognition to either announce the person on the indoor intercom or have a personalized recorded message if we are unable to respond. There appear to be some on the market, not finding Ring in that group yet.

UPDATE: The answer is NO rtsp or ONVIF for Ring, which removes it from serious consideration for me, at least at this time. It seems Doorbird is one clear option, not clear if there are other potential ones outside of the list in this link.

Hello, why this binding not included within the add-on section?

Because it’s pretty much an alpha version and still has a lot of work to be done before I believe it’s ready for a full release into the main repository. As the code is now, i’m not sure it would get accepted as a pull request either

1 Like

Unfortunately to hearing that :slightly_frowning_face:

Thanks. In time it will get there i’m sure, in the meantime anyone is more than welcome to download the latest jar file and manually install or take a look at the code and contribute any fixes towards getting it up to the state where it can be merged in

1 Like

My devices are:
Ring Doorbell Pro
Chime
Floodlight Camera-two, hardwired to mains.
Spotlight Camera-Battery powered

Hi,
First of all, thank you for your work!
One question: is it also supposed to work if the Openhab and the Ring doorbell are not on the same network?
Cheers

It talks to ring.com instead of the actual doorbell so it should work with all devices linked to your account no matter what network they are on.

Thank you!

The download doesn’t for for me:

rule:

rule "ringo"
when
	Item RingDoorbellEventDateTime changed
then
	logInfo("RING", "ding, url=" + RingDoorbellUrl.state.toString)
	var fileName =  RingDoorbellEventDateTime.state.toString + ".mp4"
	logInfo("RING", "Saving video to " + fileName)
	executeCommandLine("wget " + RingDoorbellUrl.state.toString +" -O /tmp/"+ fileName,5000)
end

when running wget from command line

wget https://api.ring.com/clients_api/dings/xxxxxxxxxx/recording?api_version=11&auth_token=YEr7QGEynQkoQsVGzUYA -O /tmp/123.mp4

I get the following output:

 --2019-04-26 19:32:38--  https://api.ring.com/clients_api/dings/xxxxxxxxxx/recording?api_version=11
Resolving api.ring.com (api.ring.com)... 2606:4700::6811:8001, 2606:4700::6811:7f01, 104.17.127.1, ...
Connecting to api.ring.com (api.ring.com)|2606:4700::6811:8001|:443... connected.
HTTP request sent, awaiting response... 401 Unauthorized

Username/Password Authentication Failed.

The App shows the video. Why do I get a 401?

Also removing and re-adding the things doesn’t help.

@zolakk Any idea?

Sorry for the late response, I had issues with it too and I was able to solve it by adding a 30 second delay to the rule because it takes a bit for the video to actually be saved on the ring.com server