Ring doorbell

When I use the thing ID from the Ring Account Binding Thing to manually add the Video Doorbell Binding Thing, I get the same error.

When I tried to use the Ring Video Doorbell thing ID, it threw a Error 409 - Conflict

I think I’ve been confused. I haven’t been able to add the Video Doorbell Binding Thing but I have successfully added the Ring Account Binding and the Ring Video Doorbell Thing. The Ring Account Binding Thing has a URL to the most recent video so I think I’m good.

The Video Doorbell Binding Thing doesn’t work but I’m not sure I need it.

Now, which widget does everyone recommend to add it to HABPanel?

The 409 error is a bug in the binding where if you delete a Thing, it doesn’t properly get purged from the Thing registry so if you try to re-create (or re-auto discover) you get an error until you restart the binding. Unfortunately, I’ve been trying hard to nail it down and have yet to figure out where the problem is.

On the bright side, unless you care about the battery level the only Thing that really matters at the moment is the account Thing. All the other (video, chime, stickup) Things pretty much just report their battery level at this point. I would like to move the events to the individual Things at some point but definitely not before I can nail down that 409 error issue. So for now, as long as your account Thing is working fine you have 99% of the functionality.

I haven’t had a look at a HABPanel widget for it yet, but would definitely be interested to see what anyone else may have.

Hey, thanks for that. How do you restart a binding?

Assuming you’re running openhabian or linux, from a console type:

ssh -p8101 openhab@localhost

default password is habopen. Then type the following at the karaf console:

bundle:restart org.openhab.binding.ring

Edit: i’ve put the 409 error and this method of restarting the binding as an open issue in the github repo as well for future reference.

Did that and tried to manually readd the Video Doorbell Binding Thing with the device ID from the Account Binding. Still getting the config “Device with id ‘XXXXXXXX’ not found” error. I’m just not going to worry about it.

It would be nice to be able to display the doorbell video on the HABPanel. I’ll see if I can figure out how to do that.

Sorry for all the issues, i’ve never worked on a binding before so i’m very much learning as I go but hopefully we can get there some day :slight_smile:

No problem! You’ve done a good job, more than I can/have! :slight_smile:

Hi, I am very new to openhab having made the change from homeassistant. I have installed the ring binding and was wondering if/how it is possible to display current battery percentage. Be gentle with me - noob, thanks

There’s a problem with the Video Doorbell thing that isn’t fixed yet. So sadly you can’t read out the battery state at the moment.
But the account thing is working and so you get at least informed about motion, ring, …

Thanks for your reply.

The problem is actually just with the discovery/thing registry portion, the doorbell should eventually pop into the inbox with no intervention (at least it did for me) and if it does then the battery status does work. I hope to get that worked out soon, but I can’t give any definite timelines because that part of the code has been a lot to wrap my head around and i’ve had some personal stuff pop up that has taken a bit of my focus. I should have some solid time to bang on it this weekend though so hopefully i’ll make a breakthrough

Thanks. The doorbell is indeed in my inbox and I have managed to grab the last video. I tried using status#battery to get the battery percentage but it stubbornly stays at 0

did you add the doorbell in your inbox to your things? mine says 100 all the time but it’s hard wired so that’s expected.

Yes, I have it in things and it shows as onlne. Under Channels Controls>Status I have the linked item Battery and Events>URL to recorded video I have the linked item Event
In my Items I have:

Number Battery "Battery Level [%d %%]" <battery> {channel="ring:account:########:status#battery"}
String Event "Event [%s]" <event> {channel="ring:account:########:event#url"}

and in sitemap I have:

Frame label="Ring Doorbell" {
	Text item=Battery
    Video item=Event url="Event"
			}

I have the last video, albeit so large it breaks the UI and a battery with 0%

Ah, I see the problem now then. The battery channel is part of the Ring Video Doorbell thing, not the Account thing. Here’s my config to show you what i’m talking about:

String   RingEvent   "Event [%s]"            {channel="ring:account:ringAccount:event#url"}
Number   RingBattery "Battery Level [%d %%]" {channel="ring:doorbell:########:status#battery"}

RingThings

Thanks for that. I have now checked and fiddled and mine resembles yours but my battery still stubbornly remains at 0% (it is not)

Number Battery               "Battery Level [%d %%]"                 <battery>         {channel="ring:doorbell:########:status#battery"}

UPDATE: I rebooted my pi and all seems well in the world. Just need to mess with the css (I assume) to stop the video growing beyond it’s div. Video doesn’t show in the ios app; is this to be expected?

Could someone confirm that you are not able to access any video (even the last image) if you don’t entered the cloud subscription? I’m 100% that this worked at the beginning (using the video url), but now I just receive an empty screen.

I don’t need a video archive, but the last one or even a picture could be expected.

Nevertheless you should be able to get it into HaBpanel by using a frame widget with URL from a openHAB string item. The coount thing will provide the video url, link an OH item to that channel and use it as source for the HABpanel widget.

I don’t have a subscription and the URL works if I paste it into a new browser tab. It seems to work fine for me as a frame widget but it auto plays every time you visit the page. I’ve tried to put it in an iframe on a custom widget but was unable to get it to work.

Edit: It also just occurred to me that since the URL points to an MP4 file, there’s nothing stopping someone from writing a rule to wget the file when it changes and keeping a local archive to bypass the subscription service

did you tried to load it with curl? I had a similar problem with the Rachio Sprinkler cloud (I wrote a binding) and the cloud service responded without the media type. I implemented some kind of proxy requesting the file, but also adding the correct media type and then it works.

I didn’t try curl, but wget works fine to pull down the mp4 file :slight_smile: . I wrote a simple rule to pull down the video with the Jython/JSR223 engine here. It shouldn’t be difficult to translate into the traditional rules engine, I just moved all my rules to Jython and in general they all seem much more responsive.

from org.slf4j import LoggerFactory, Logger
from core.rules import rule
from core.triggers import when
from datetime import datetime
from org.eclipse.smarthome.model.script.actions.Exec import executeCommandLine
from threading import Timer

'''
Possible timer states:
NEW - instantiated
RUNNABLE - defined
TIMED_WAITING - timer is running (slight delay after timer is stopped)
TERMINATED - timer completed or stopped
'''
ringEventTimer = None

@rule("Download Ring videos")
@when("Item RingEventURL changed")
def ringEventURLChangedEvent(event):
    global ringEventTimer
    if items["RingEventURL"] != UnDefType.NULL:
        videoDate = datetime.today().strftime('%Y-%m-%d_%I-%M-%S-%p') + "_Ring.mp4"
        log.info("wget -O /etc/openhab2/html/ring/" + videoDate + " \"" + items["RingEventURL"].toString() + "\"")
        if ringEventTimer is None or str(ringEventTimer.getState()) == "TERMINATED":
            #30 second timer to allow the ring server to actually post the video file
            ringEventTimer = Timer(30, lambda: executeCommandLine("wget -O /etc/openhab2/html/ring/" + videoDate + " \"" + items["RingEventURL"].toString() + "\"",10000))
            ringEventTimer.start()
            log.info("Ring Event Timer: Started ring event download timer.")
    
    elif ringEventTimer is not None and str(ringEventTimer.getState()) == "TIMED_WAITING":
        ringEventTimer.stop()
        log.info("Ring Event Timer: Cancelled ring event download timer.")