USPS Mail Notifications with inline attachments with Node-RED

USPS mail notifications working in front end and inline attachments (for IOS / iphone only) with Node-Red.

You will get a count of the mail and packages coming to you that today and an animated GIF of the actual mail. This can also be pushed to your iPhone / IOS device as an image.

This is based off the excellent work and code by skalavala.

Requirements:

  1. Sign up for USPS Informed Delivery

  2. ImageMagick installed

  3. Python MQTT Paho installed (sudo pip install paho-mqtt)

  4. MQTT Server (Mosquitto or built into HA)

  5. Home Assistant accessible from internet (to serve GIF image)

Setup:

Add the ha-config.yaml config sections to the appropriate sections of your configuration.yaml file. Edit the still_image_url to the internal IP of your Home Assistant server.

Add the usps-nodered.py to your scripts directory and edit the file to include your MQTT setup, and your e-mail setup. The script works by checking your email for the daily USPS digest. I use gmail, so I create a filter and label in gmail to automatically hide these and modified the ‘folder’ variable to look at that filter.

Add the flow from node-red-flow.js to your Node-RED setup. You can kick off the inject node manually to see if it is working. The flow only checks email in the morning as that is when the typical USPS digest arrives. Edit the function node to include your hostname and the notify node to include your phone.

If it all works, it will look something like this:

I am trying to setup Node-Red but I am missing correct nodes. Could you tell me please which node do you use for " api-call-service" and " server-state-changed"? thank you.

Those nodes are from https://github.com/AYapejian/node-red-contrib-home-assistant

thanks, I had this one installed " node-red-contrib-home-assistant-ws" that’s why it was not working

Can this be used in Hassio ?

Yes, this should all work with Hassio

When I run the shell cmd manually /usr/bin/python /config/script/usps-nodered.py, it says file not found in hassio. I placed usps-nodered.py in the config/script folder. Any suggestions how I can achieve this in Hassio.

Also, still_image_url: ‘http://192.168.xxx.xxx:8123/local/todays_mails.gif’ . Would that be still_image_url: ‘http://192.168.xxx.xxx:8123/config/www/todays_mails.gif’ in Hassio.

Thanks

I’m not sure as I don’t have hassio, but if it says file not found you may be specifying the wrong python interpreter.

Does this still work, I can’t find ImageMagick in node-red to install!