Ring doorbell

Hi,
is this binding working on OH3?

Hi @jwgilesjr ,

can you please share some examples on how you managed to integrate your ring devices?

Thanks

Hello @DarkoG

Its been awhile since I worked on this, but my setup is still working for everything except live video stream. I attempted to explain my setup in my post from Dec '19. The documentation at the link in that post contains example python scripts. That is where I would start.

I can try to answer your specific questions if you’ll post which part needs clarification.

Hi @jwgilesjr,

I was playing yesterday with the examples and I am able to connect and print for example the last events on the screen.
I would like to get the at least the button and motion triggers to OH3, so if you could post that part would be great.

Do you need to enter credentials when for example my rPi running the program is restarted?

FYI, I am getting “None” returned for the live stream url. I do have gen 1 doorbell without subscription, so maybe that is the reason, however I am currently switching from Smartthings and there I am able to see the live stream (by manually setting the smartthings device as ring pro).

Thanks

Hello @DarkoG,

First, let me say I have no programming experience and I’m a complete novice at it. The only reason I got this to work is that I was too stubborn to give up. I did a lot of googling…

On to your question…you are on the right track. From here, I would do the following:

  1. Create a file for your python script and paste your code into it.
    – You can experiment by running it from terminal until you get it working like you want.
  2. Create an exec command in OH that calls the script
    – Create a rule that runs the exec command on OH startup
  3. Create items in OH for the parameters from the python script you want displayed in your sitemap
  4. Insert lines in your python script that export the parameters you want to the OH items using “requests.put”. See OH REST API document. There is a learning curve.

Note: It worked better for me to download video with a separate python script, triggered by a different OH exec command. You can run it with a switch item in your sitemap or use a rule triggered by a change in motion event time.

Regarding credentials, the python script will prompt you the first time, but then saves a token it gets from the ring servers, so you won’t get prompted again until the token expires.

Hope this helps.

Some additional information:

My ring OH items:
String ringeventtime “Last Event [%s]”
String ringeventkind “[%s]”
Number batteryLevel “[%d %%]”
String ringconnected “Connected [%s]”
String lastvideoURL “URL [%s]”

My sitemap excerpt:
Text label=“Ring Doorbell” icon=“motion” {
Text item=ringconnected
Text item=batteryLevel label=“Battery Level” icon=“battery”
Text item=ringeventtime label=“Event”
Text item=ringeventkind label=“Kind” icon=“motion”
Text label=“Last Video URL” icon=“video” {
Text item=lastvideoURL
}
Text label=“Last Video” icon=“video” {
Video item=lastvideoURL url=“lastvideoURL”
}
}

Example python code line to export connection status to OH item “ringconnected” where IP address is that of your OH RPI:

requests.put(‘http://IPAddress:Port/rest/items/ringconnected/state’, auth=HTTPDigestAuth(‘openhab’, ‘’), data=doorbell.connection_status)

1 Like

OK @jwgilesjr, thanks for the help, I got the motion and the rings connected, however I notice 20-30 seconds delay, but I can live with that. My livestream doesn’t work also.

I used the python-openhab for writing back the values to OpenHAB and that was working very smoothly. The biggest issues I had was with the permissions of the token file, however putting the script in /var/lib/openhab solved the issue.

Hello @DarkoG, glad you were able to get it to work! I was never able to livestream using python_ring_doorbell, but I was able to get livestream functionality into openhab for the doorbell using the same technique and a different program.

I had a spare RPI zero laying around, so I loaded Ring-Client-API (GitHub - dgreif/ring: Unofficial API for Ring Doorbells, Cameras, Alarm System, and Smart Lighting) onto it and connected to openhab. It works but I ran into a couple of issues: First, there was a delay (45 seconds) between initiating the livestream using a switch in openhab and receiving the livestream feed. This severely limited the utility. Second, I was manually copying the token from the python_ring_doorbell to the Ring-Client-API to get it to connect, which was inconvenient.

In the end I was able to reduce the lag time to about 15 seconds to start the video, but I never completed automation of the token transfer, so I eventually quit using it.

If any of this is of interest and you want to set it up, I can try to answer any questions you have.

Could you get into more detail? I tried it but got stuck as I’m quite new to Javascript. Do I need to run a index.js on the pi containing this code?

I don’t want to access live feeds, only battery %, and timestamps when there was motion/a ding is enough…

I’m also a beginner with javascript and I struggled to get this running, but the trick is to find the examples folder on the web page and use browser-example.ts as your template. Use that code to create a javascript file to get the program started.

However, I only use Ring-Client-API for livestream since I could not get livestream working with Python Ring_Doorbell (see my post from Dec '19 in this thread). I use Python Ring_Doorbell to get battery %, timestamps, etc.

Hope this helps…

I had the python code working but after a few days it let me down. Since then, I struggle to get a new token since. Initially, I had to modify the python because the pathlib did not work with read() and write() on my rpi zero running buster. It worked for a day or two though.

Via de JS-route it would give me a token but somehow that does not work in the Python version. I’m not very good in JS hence I struggle to get things working, produce the correct files and get code implemented into the OH environment.

I also had an issue recently with a token error, but if you go to the issues tab on the Python Ring_Doorbell github page, you’ll find a discussion and fix on the missingtokenerror (MissingTokenError · Issue #251 · tchellomello/python-ring-doorbell · GitHub). This solution helped me get it working again.

Thanks for your replies. I now got the python-version working again too. I will give the JS-version a go to but at a later stage when I have a bit more time to dig onto all the JS stuff. For now, I am more concerned getting my smarthome more configured…

Maybe I do need the JS sooner then expected :expressionless:

Every time I run the code I need to re-enter my credentials :pensive:

Would somebody be so kind to publish a step-by-step for Python or JS version for less technically inclined folks here? :slight_smile:

Hi,

I struggled to integrate my ring cams as well. Until I came across this nice little piece of work. And that guy also provides a maintained docker container on dockerhub.

Using this, integration of my ring cams was a breeze. Only drawback ist, that I do not have live video. only events and snapshots. But for my purpose that is ok.

If you enable homeassisstant plugin, the channels will even be discovered automatically.

hope this helps,
Lars

1 Like

Lars, this is absolutely amazing, thank you for your find!
I was able to configure access to Ring, it just works!
I can see all security devices and cameras!
Now on to tinkering and figuring out what to do with all of it! :slight_smile:

Spoke too soon - auto-discovered Ring devices show up in the Inbox, but cannot be added.
@Lars_Deutsch did you have to configure homeassisstant plugin in any way?
I know that mqtt broker is working well - I am using it for zigbee without issues, plus devices are discovered…
Thank you!

yes, I had to add the homeassistant binding for auto configuration, but you can just spy on the messages sent via MQTT and configure it in a things file. That is what I did at first.

I would also be interested in using Ring with openhab.
Wouldn’t the web interface be an option using the http binding?