usps2mqtt is a simple way to integrate USPS Informaed Delivery with Home Assistant.
I did a video on this setup over on youtube
This is a repackaged version of USPS Mail Integration with Home Assistant that can be deployed on any host with python 3 and access to your Home Assistant MQTT server.
The script logs into your email, finds the email from USPS Informed Delivery, gets the count of mail and packages along with photos and then published the results to your MQTT Server.
This script was written in python3 and requires the installation of some python libraires, and imagemagik
- Clone this repo:
git clone https://github.com/thejeffreystone/usps2mqtt.git
- cd to dir
usps2mqtt
- install required python libraries:
pip install -r requirements.txt
- install imagemagick
sudo apt-get install imagemagick
- cp env-sample to .env:
cp env-sample .env
- Edit .env to match your environmnt:
# MQTT Hosts details
MQTT_SERVER = 127.0.0.1
MQTT_SERVER_PORT = 1883
# MQTT User name and Password
MQTT_USERNAME = mqtt
MQTT_PASSWORD = pass
# MQTT Topic
MQTT_USPS_MAIL_TOPIC = house/usps/mails
MQTT_USPS_PACKAGE_TOPIC = house/usps/packages
# Email Host Details
# For Email Hosts:
# GMail - imap.gmail.com / 993
# Yahoo - imap.mail.yahoo.com / 993
# Outlook - imap-mail.outlook.com / 993
# Update host and port based on your provider
HOST = imap.gmail.com
PORT = 993
# Your email login creds
USERNAME = [email protected]
PASSWORD = pass
# Image Output location
IMAGE_OUTPUT_PATH = /var/www/html/images/
# Update Interval - default 5 mins
SLEEP_TIME_IN_SECONDS = 300
Simple execute usps2matt.py
You will want to automate the execution via cron, pm2, supervisor, or the like.
Next you just have to setup some sensors.
For an example see my usps package.