https://github.com/tchellomello/python-ring-doorbell
I have a dummy doorbell switch set up called doorbell (in this case idx 1096) and I use a python app running continually (as a service) to poll for a push on the doorbell
Code: Select all
from ring_doorbell import Ring
from time import sleep
import urllib2
ringUsername='MyUsername’
ringPassword='MyPassword'
myring = Ring(ringUsername,ringPassword)
# Now loop infinitely
while(1):
data = myring.doorbells[0].check_alerts()
if data==True:
urllib2.urlopen('http://192.168.0.52:8080/json.htm?type=command¶m=switchlight&idx=1096&switchcmd=On’)
sleep(1)
urllib2.urlopen('http://192.168.0.52:8080/json.htm?type=command¶m=switchlight&idx=1096&switchcmd=Off’)
# Loop around
sleep(1)
For info how to start this python script as a service have a butchers at:
https://www.raspberrypi-spy.co.uk/2015/ ... g-systemd/
It's possible to grab the video with
Code: Select all
from ring_doorbell import Ring
from time import sleep
import urllib2
from datetime import datetime
ringUsername='myUsername'
ringPassword='myPassword'
myring = Ring(ringUsername,ringPassword)
doorbell = myring.doorbells[0]
# Now loop infinitely
while(1):
data = doorbell.check_alerts()
if data==True:
urllib2.urlopen('http://192.168.0.52:8080/json.htm?type=command¶m=switchlight&idx=1096&sw$
sleep(1)
urllib2.urlopen('http://192.168.0.52:8080/json.htm?type=command¶m=switchlight&idx=1096&sw$
timestamp = datetime.now().strftime("%d:%m_%H.%M.%S")
doorbell.recording_download(doorbell.history(limit=100, kind='ding')[0]['id'],
filename='/mnt/synology/Doorbell/'+timestamp+'.mp4',override=True)
sleep(1)