Saturday, January 21, 2023

Mailbox Notification Automation


Mailbox theft is a growing concern for many homeowners. Not only can it result in the loss of important mail and packages, but it can also compromise personal information and identity. We have had our mailbox pried open, and have had some packages taken.  The first thing that we did was to replace the mailbox with a stronger locking mailbox.  This makes it harder for people to pry open the box, and it prevents people from reaching their hands in to grab the letters or packages.

But a locking mailbox doesn't completely solve the problem, it just adds barriers to slow potential mail and package thieves.  I also wanted to implement something that would minimize the time that mail remains in the mailbox.  

There are several goals that I wanted to accomplish with these notifications
  1. Generate notifications, on my phone and in the speakers in the house, when new mail is received.
  2. Generate reminder notifications, if new mail has been sitting in the mailbox for too long
  3. Generate notifications, if the mail retrieval door has been left open too long
  4. Turn on the lights in the front of the house (primarily landscape lights) if the mailbox door is opened after midnight.

For these notifications, I needed to determine when the doors, for new mail and the one where the mail is retrieved are opened.  I was able to use two Aeotec SmartThings Multipurpose Sensors to do this.  For the new mail door, I placed the sensor on the right side of the mailbox, where the magnet is mounted to the bottom part of the moving door.



For the mail retreival door, I mounted the sensor on the left side of the mailbox. Since the door has a thick lip, I needed to use some shims to make sure that the sensor aligned with the magnet.




Since these sensors are Zigbee sensors, that rely on RF signals, the metal sides of the mailbox significantly reduced the range for these signals.  The Zigbee controller in the house wasn't able to get data from these sensors.  The mailbox is about 20' from our house, and luckily there is an outlet on the corner near the mailbox.  I added an Enbrighten Zigbee Outdoor Plug-In Switch to my Zigbee network, and plugged it into the outdoor outlet that is closest to the mailbox.  This switch was able to bridge the signals from the sensors in the mailbox to the rest of the network.

With the sensors reporting data, here are the automations that I created

New mail notifications

This automation is triggered when the new mail sensor is opened.  But, since I didn't want to wake up our kids if someone opens it at night, I added a condition that this should only get triggered between 9am and 10pm.  The automation looks something like this, in Home Assistant:

  • When the new mail sensor is opened and the current time is between 9am and 10pm, run the following steps
    1. Send a notification to phone (via Home Assistant Android Android app)
    2. Set the "mail arrived" helper boolean to true
    3. Set the "mailbox last triggered" datetime helper to the current timestamp
    4. Send a "You've got mail" TTS message to be spoken on the speakers around the house


 

Reminder notifications

This automation is triggered, for me, at 5 and 8pm.  When the trigger fires, it checks to see if the "mail arrived" helper boolean is true.  If it is, then it sends the reminder notifications.  This looks something like the following:
  • At 5pm and 8pm, check whether the "mail arrived" boolean is true.  If it is, then:
    1. Send a notification to the phone
    2. Send a "Remember to get the mail" TTS message to be spoken on the speakers around the house


Reset Mail Delivered

This automation is triggered when the mail retrieval door is opened.  It looks something like the following:
  • When the Mail Retrieval sensor is opened, do the following:
    1. Set the "mail arrived" boolean to false


Notification if the Mail Retrieval door is opened too long

This is an pretty easy automation, where a notification is generated if the mail retrieval door is opened for more than a minute.  It looks something like this:
  • If the Mail Retrieval sensor is opened for longer than a minute, then:
    1. Generate a notification on my phone, with some text like "Mail retrieval door left open"


Turn on lights when mailbox is opened at night

For this automation, I want to trigger some lights to be turned on, if the mailbox door is opened late at night.  The automation looks something like:
  • When the new mail sensor is opened, and it is after midnight and before 6am, then run the following steps:
    1. Turn on the front landscape and garage lights
    2. Wait 10 minutes
    3. Turn off the front landscape and garage lights


Future changes

Here are some changes that I will probably make in the future
  1. Merge these automations into a single automation, using multiple triggers and conditions;
    • This would allow this collection of automations to be enabled/disabled as a single unit
  2. Change from the tts.cloud_say to the notify.google_assistant_sdk service
    • If the speakers are playing audio when a notification happens, the tts.cloud_say will cause the audio to stop.  The new notification service from the google assistant sdk is supposed to not have this problem.
  3. Remove the "mailbox last triggered" helper, as it isn't used.

Conclusion

In conclusion, having notifications set up for when new postal mail is received can be a valuable tool for staying on top of important deliveries and correspondence. The methods outlined in this blog post provide a simple and easy way to receive notifications on your phone and speakers in the house, allowing you to stay informed about your mail even when you're not at home. With this setup, you'll never have to worry about missing an important delivery again. Overall, implementing this system can bring peace of mind and convenience to your daily life.

No comments:

Post a Comment

DIY Cloud Storage: A Step-by-Step Guide to Setting Up Nextcloud on Your Raspberry Pi

In this post, I'm going to walk you through the process of setting up Nextcloud on a Raspberry Pi using NextcloudPi . If you're loo...