Monitor Your Mailbox with Home Assistant Automations

Imagine never having to wonder if there’s mail in your mailbox again. With a simple yet effective home automation setup, you can receive instant notifications on your dashboard whenever mail is delivered. Even better, the system automatically resets the alert when you empty the mailbox, ensuring you always stay updated without any manual intervention. Let’s dive into how you can achieve this seamless automation using Home Assistant and a couple of door sensors.

Implementation

To create this automation, you’ll need two door sensors: one on the inlet of the mailbox and the other on the door you open to retrieve the mail. Here’s a step-by-step breakdown of the YAML code that makes this magic happen:

Define the Automation

The automation is triggered by changes in the state of the two door sensors in the mailbox.

alias: Mailbox received mail
description: ""
triggers:
  - trigger: state
    entity_id:
      - binary_sensor.door_mailbox_in_500_contact_in
    from: "off"
    to: "on"
    id: new
  - trigger: state
    entity_id:
      - binary_sensor.door_mailbox_in_501_contact_out
    from: "off"
    to: "on"
    id: emptied
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - new
        sequence:
          - action: input_boolean.turn_on
            metadata: {}
            data: {}
            target:
              entity_id: input_boolean.mail
      - conditions:
          - condition: trigger
            id:
              - emptied
        sequence:
          - action: input_boolean.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: input_boolean.mail
mode: single

State Management

The state of the mailbox is managed using an input_boolean entity.

sensor:
  mail:
    name: Mailbox sensor
    initial: false
    icon: mdi:mailbox

The final step is to utilize the sensor.mail to trigger an alert or display a notification on your dashboard. This ensures you’ll always be informed whenever there’s mail in your mailbox.

Conclusion

With this setup, you’ll always know when there’s mail waiting for you, and the alert will automatically reset once you retrieve it. No more manual resets or missed mail! This automation not only adds convenience to your daily routine but also showcases the power of Home Assistant in creating a smart home environment.

Happy coding (and automating)! 😊📬

Unknown's avatar

Author: Peter Groenewegen

Hi, I’m Peter Groenewegen—a technologist, developer advocate, and AI enthusiast passionate about building tools that truly fit people’s workflows. My journey in tech has been one of innovation, collaboration, and a relentless curiosity to make the complex simple.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.