As a buyer of a new Amazon doorbell, I like the cool features it provides. However, I think I can make some improvements. What I need is a doorbell customized for the people who live in my house. It would be nice if the doorbell could recognize who was knocking at the door. Seeing how popular doorbells are, I decided to help most families. The best way is for them to customize their doorbells effortlessly. I have developed an app that can tell you who is at your door by entering the username and password of your doorbell account. It is very convenient to know who is at your door without waiting for the doorbell to display the video on your smartphone. It greatly improves safety, brings great convenience, and can even be installed on an automatic door opening system. In the era of deep learning, every family needs to install these systems. The figure below illustrates how my system works.
The complete code can be found in the Git repository here. https://github. The requirements of com/dude123studios/SmarterRingV2 are as follows: tensorflow == 2.4.1
opencv-python == 4. 5. 1. 48mtcnn == 0.1. 0 ring_doorbell == 0.7. 0 oauthlib ~ = 3. 1. 0 numpy ~ = 1.19. 5 scipy ~ = 1.6.1 scikit-learn = =0.24.1gtts==2.2.2playsound~=1.2.2
Let's analyze what happened. By entering the username and password as environment variables, the Ring API can connect to your account. This API allows users to access python features. Here (https://github.com/tchellomello/python-ring-doorbell) there is an API repository and short documentation. This is Ring. A fragment of py, which instantiates a connection with your doorbell: import osimport jsonfrom pathlib import Pathfrom ring_doorbell import Ring, Authfrom oauthlib. oauth2 import MissingTokenErrorcache_file = Path("test_token.cache") def token_updated(token): cache_file. write_text(json.dumps(token)) def otp_callback(): auth_code = input("[INPUT] 2FA code: ") return auth_codedef main(download_only=False): if cache_file. is_file(): auth = Auth("MyProject/1.0", json.loads(cache_file.read_text()), token_updated) else: username = os. environ. get ('USERNAME') password = os. environ. get('PASSWORD') auth = Auth("MyProject/1.0", None, token_updated) try: auth. fetch_token(username, password) except MissingTokenError: auth. fetch_token(username, password, otp_callback()) ring = Ring(auth) ring. update_data() wait_for_update(ring, download_only=download_only)
The wait_for_update method continues to run and instantiates a handler that is waiting for the client. It will continue to refresh until it finds that Ring's storage history is updated. Once this happens, it checks whether the doorbell has been pressed. If so, it will download the entire video to your device. To speed up this process, please use the ring app on your smartphone to reduce the size of the video recording. Your doorbell rings, and the last video will be uploaded to your computer. From there, we intercepted multiple frames of that video to ensure that no one's face was obscured. I am in utils. This method is defined in py. It will be shown later. The following is ring. Another snippet of py. Used to process the main thread: import time