Skip to content

zjacobsdev/rpi-pico-mail-server

Repository files navigation

MailWatch alt_text

______backend______


Table of Contents

About

Mail Watch was built with the purpose to notify you in real-time when your mail arrive. Depending where you live your mail box may be located on different part of the house or in other cases even outside. Other times the mail might come at.

In my personal case, my mailbox is located on the first floor, while the main living quarters are on the second and third floor. To stop the guessing game of when will the mail man arrives and to avoid investing in other platforms like Ring ^TM^ I created this device.

Some other use cases for this project is notify the user when crucial time/tempurature sensitive packages arrives or in general help people with disabilities and their caretakers

This backend project is only meant to be use in the local area network using a Raspberry Pi 3/4 as the web server.

Key features

  • Real-time notifications (powered by Pushover)
  • A simple web-based dashboard
  • View mail arrival statistics
  • Only works within the local area network of you home

Built With

Tech Stack
  • FastAPI - FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
  • Unicorn - FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
  • PostgresSQL (SQLAlchemy)
  • Pushover - push notifications
  • TailwindCSS - used TailwindCSS CDN
  • DaisyUI - TailwindCSS Componet Library
  • Jinja2 - HTML templating Hardware Tech Stack

Getting Started

Prerequisites

  • Make sure to have Postgres installed and running in your local setup alternative
    • Use test.db as a mock database

  • Set up an account with Pushover to get retrieve your API keys

Usage

Installation

Please follow these steps for a development setup:

  1. Fork/Clone repository In the terminal:

  2. virtualenv -p python3 env

  3. source env/bin/activate

  4. pip3 install -r requirements.txt

  5. unicorn server:app --reload

Hardware Installation

References

Preview of file structure:

├── app                
│   ├── server.py      
│   ├── requirements.py
|   ├── models.py
|   ├── .env.sample   
|   ├── tests
|   ├── routes
|   ├── services       
│   ├── configs  # configurations
│   │   ├── __init__.py
│   │   ├── settings.py    
│   │   └── database.py     
│   └── templates         # Jinja2 HTML templates
│       ├── index.html  #  API Dashboard page
│       └── admin.py  

Enviorment Variables

Use .env.sample file

Variable Name Value Type Description
DATABASE_URL string (url) URL of local postgres database
PUSHOVER_API_TOKEN string api token for Pushover
PUSHOVER_USER_KEY string user key for Pushover

Development Roadmap

In the Works Down the Road

✔️ Save device data in csv file

  • Saving device data in db
  • Testing
    • test end points with pytest
  • Add seperate frontend client
  • Deployment
    • AWS or create local server
    • implement tests
  • Better mangange git Commits
    • precommit vs husky
  • Watchdog
  • Device Settings
    • Ability to add, delete, update device info
  • IoT Security and Authentation
    • need more research
  • Analysis
    • what the est. time of day does the mail come
    • did the mail com
  • Features
    • Add USPS/UPS/FEDEX packages

Photos

Dashboard Concept

dashboard

Dashboard Concept: Mobile

dashboard-mobile

Photo of the device (Barebones)

photo

Wiring Diagram

diagram

Acknowledgements

Thanks in advance to anyone who contributes in growing this project in anyway

About

Raspberry Pi Pico W Project

Resources

Stars

Watchers

Forks