Project Doorbell is an idea that I got to know the managed AI AWS services and keep going to write some code in Rust. Smart doorbells include a camera, microphone and speaker to allow for a two-way conversation between the doorbell and its smartphone app. This project is concentrated on the backend side of communication. Therefore, I will not consider the hardware and the mobile app. You can find a series of articles here
- I ring my doorbell.
- The doorbell takes a picture of me.
- Will open a WebSocket connection
- Send an event to EventBridge to create the presignd url
- Send it back to the doorbell
- Doorbell upload the photo to S3
- S3 PUT will generate an event to EventBridge and execute the Step Function.
- Step Function is comparing the face
If we have a match:
- Generate a 6 digit code
- Send the code to the mobile app
- Insert the code in the doorbell keypad and go inside.
If we have do not have a match:
- Send error back to the doorbell
- Let the doorbell ring
- Send a photo to the mobile app
The project will deploy the following AWS services:
- AWS Lambda functions
- Amazon API Gateway
- AWS Step Functions
- Amazon DynamoDB
Part of the initial setup can be read it here
This project require RUST and for basic setup please refer to part 1 and part 2 of RUST series
Assuming that your computer is setup, you need to build
make build
Once it is all built
We can deploy all the applications. I use
--profile test
Inside my MakeFile, and you may remove it.
make deploy
If everything is all working, you should have in your AWS Account something like this:
Inside the rust-doorbell-websocket stack, you can find the WebSocket URL. It should look like
wss://xxxxx.execute-api.eu-central-1.amazonaws.com/prod
Postman Now Supports WebSocket APIs, and we will leverage this tool to simulate the flow.
This project is concentrated on the backend side of communication. Therefore, I will not consider the hardware and the mobile app. This means that we will send the 6 digit code back to the WebSocket channel. In reality, this will not happen because the code or the person's preview at the doorbell will be sent to the mobile app. I took the liberty to use the WebSocket to take some action.
- Upload inside the bucket a passport type photo of you, and call it source.jpeg. This is the source photo that we are using to compare the photo taken by the doorbell
- Open Postman
- Create a new WebSocket Request
- Past your address wss://xxxxx.execute-api.eu-central-1.amazonaws.com/prod
- Click Connect
You should see something like:
Copy the return of the presigned url, something like
And open a new tab in postman using the link you got (remember to upload a recent photo of you) and click Send.
Go back to the WebSocket tab, and you should see the code in return.
make delete