Page 1 of 1

Ring 2

Posted: Friday 31 May 2019 12:00
by Kouwe
I own a Ring 2. However, I am not willing to pay for a subscription every month to see the call history. Now there is a plugin available for Domoticz to add the Ring 2. With a link to github to load the plugin on the Raspberry. I did that. I also changed the scripts and placed them in the scripts-library. Still I only get error messages.
Is there someone who got the Ring 2 up and running and is willing to explain step by step how to get it working?
I would like to know who rang the doorbell during the day and let me send an email. I am often just too late to open the Ring app on the phone to see who has been at the door during my absence. And also to automatically turn on a light when it's dark.
There is already a topic about Ring 2 that has stopped and I would like to breathe new life into it. I myself have been just a simple Cobol programmer in the past.
https://github.com/tchellomello/python-ring-doorbell and nigels0

Re: Ring 2

Posted: Friday 31 May 2019 13:04
by felix63
Hi Kouwe,

I have a Ring 2. I have some integration with my Domoticz setup but its not great. I only managed to trigger events based on someone ringing the doorbell. I don't use a plug-in but I followed these instructions: link.

Re: Ring 2

Posted: Friday 31 May 2019 21:38
by Kouwe
That’s the same one I used. But how did you make it work after downloading the plug-ins from github and changing the script for personal use (User and password).

Re: Ring 2

Posted: Saturday 01 June 2019 0:55
by nigels0
You just need to run the python script - such as

Code: Select all

python ~/domoticz/scrips/myscript.py &
I suggested running it as a service so it would automatically start on boot.

*don’t forget to change the idx value for the switch in the code for the one you set up in your domoticz. In my script, I had an odd value of 109 for example

Re: Ring 2

Posted: Sunday 02 June 2019 15:29
by Kouwe
This is what I've done:
I downloaded the plugin from https://github.com/tchellomello/python-ring-doorbell. No errors. Left it where it was installed.
As user pi and just to be on the safe side as root. The latter was not necessary because the plugin was already there.
Then I changed the script of nigels0.
That means that I added my own credentials and adjusted the index number for my own switch.
I had to change my password because it contained a character that was not recognized by the system. That explained one error-message.
I then tested the script with..: /usr/bin/python2.7 /home/pi/domoticz/scripts/Ring2_doorbell.py.
This resulted in the following messages:

Traceback (most recent call last):
File “/home/pi/domticz/scripts/Ring2_doorbell.py, line 8, in <module>
myring = Ring(ringUsername,ringPassword)
File “/home/pi/.local/lib/python2.7/site-package/ring_doorbell/_init_.py”,
line 54, in _init_
self._process_cached_session()
File “/home/pi/.local/lib/python2.7/site-package/ring_doorbell/_init_.py”,
line 87, in -Process_cached_session
self.-authenticate()
File “/home/pi/.local/lib/python2.7/site-package/ring_doorbell/_init_.py”,
line 155, in _authenticate
rep.raise_for_status()
File “/home/pi/.local/lib/python2.7/site-package/requests/models.py”,
line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unautorized for url: https://api.ring.com/clients_api/session


And now I'm stuck. What goes wrong here?

Re: Ring 2

Posted: Sunday 02 June 2019 16:28
by Doudy
I am also interested

Re: Ring 2

Posted: Sunday 02 June 2019 17:52
by Kouwe
I think I solved the last problem. I changed my password due to a character that was not recognized but I forgot to push the 'Done'-button. Now the script seems to be running endlessly but when I push the button on the Ring 2 nothing seems to happen. But no more errors!

Re: Ring 2

Posted: Sunday 02 June 2019 17:57
by nigels0
Check your log in domoticz - see if the script is attempting to change a switch

Re: Ring 2

Posted: Sunday 02 June 2019 18:17
by Kouwe
It works! I get an email with an image of the person who is pushing the Ring doorbell. The only thing that is left to do is making the script run as a service or as a part of PM2. Which I haven't been able to install yet.
When I managed to do so I will describe how or sent the link. The link in the message of Nigels0 ens up in an 401-Error.
But thanks Nigel0 for the script. It works just fine. And no need to do complicated things. Just take care of a good password without strange characters.

Re: Ring 2

Posted: Sunday 02 June 2019 18:22
by nigels0

Re: Ring 2

Posted: Wednesday 05 June 2019 9:21
by Doudy
to Kouwe
Hello,

Could you explain me how do working "Python Ring DoorBell"?
I can not do it!
My installation seems correct.
But after ?

In https://github.com/tchellomello/python-ring-doorbell I see
Initializing your Ring object
Listing devices linked to your account
Playing with the attributes and functions

But how does it work / start?

Thank you for your help

Re: Ring 2

Posted: Friday 12 July 2019 19:43
by Kouwe
The Ring 2 service works in principle but I never know in advance for how long. Sometimes it's only half a day, sometimes it's 3 days, but in the end, despite a built-in restart, the service stops at an abort. This way I can't rely on the actions that have to be carried out when pressing the Ring buzzer.

I get the following error message:

Active: failed (Result: exit code) since Thu 2019-07-11 20:32:45 CEST; 10s ago
Process: 7904 ExecStart=/usr/bin/python /home/pi/domoticz/scripts/Ring2_doorbell.py (code=exited, status=1/FAILURE)
Main PID: 7904 (code=exited, status=1/FAILURE)

This is the service I use and is placed in /lib/systemd/system.


Description=Ring 2 E-mail
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/python /home/pi/domoticz/scripts/Ring2_doorbell.py
Restart=on-abortion

[Install]
WantedBy=multi-user.target

Re: Ring 2

Posted: Friday 12 July 2019 20:01
by nigels0
Restart=on-abortion ???

Could that be your problem?

Should be

restart=on-abort

Anyhow, here is mine;

Code: Select all

[Unit] 
Description=Doorbell Service 
After=multi-user.target 

[Service] 
Type=idle 
User=pi 
ExecStart=/usr/bin/python /home/pi/domoticz/progs/ring2.py 
Restart=always 
RestartSec=0 

[Install]
WantedBy=multi-user.target
Having said that, I don’t get failures in the code. Maybe an idea to check the logs to see why it is terminating.

Re: Ring 2

Posted: Tuesday 16 July 2019 14:44
by Kouwe
Abortion! That was the problem. It runs for days now. It's my mainframe mind that made me use abortion I think.