📬 Smart mailbox

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

:mailbox_with_mail: Smart mailbox v1.0.1

This Blueprint detects mail deposits and collections in your mailbox using a motion sensor, confirmation entities, and optional counters or datetime entities.

:sparkles: Key features

  • Use a mail counter to track the number of mails in the mailbox.
  • Record the date and time of the last mail deposit and collection with datetime entities.
  • Trigger custom actions for deposits or collections.

:clapper: Scenarios

:mailbox_with_no_mail: Mail collection

The user checks their mailbox, triggering the motion sensor inside the mailbox. The configured timeout provides enough time for the automation to check if any mail collection confirmation sensors (e.g., a door sensor or a switch) were triggered within that period.

Scenario A

The user checks the mailbox first, then enters their home, triggering the door sensor or a switch.

Scenario B

The user exits their home (triggering the door sensor or a switch) first, then checks the mailbox.
In both cases, the timeout allows the automation to determine that this activity is most likely a collection rather than a deposit.

:mailbox_with_mail: Mail deposit

When mail is deposited, the motion sensor inside the mailbox is triggered. If no confirmation entities (e.g., door or window sensors, switches) are activated during the timeout period, the automation classifies this as a deposit.

8 Likes

Thanks for your blueprint ! Have you got a card associated?

1 Like

is there anyway to use a door sensor instead of a motion sensor on the mailbox?

2 Likes

Just copy and past the ID of the sensor (ie. sensor.mailbox-door) where it asks for the motion sensor.

It would be sweet if there was a binary sensor built into this so that we could show an icon with either “Empty” or “Delivery!”. It’s nice knowing how many deliveries have been made with the counter, however I think a simple yes or no would be more effective. If there were 10 deliveries, I would still only need to go to the mailbox once.

1 Like

I could update the template to be more permissive on the type of sensor allowed here.

In my case, I have a letterbox with a trapdoor for mail, or a front door for larger parcels. The advantage of the motion sensor is that I can detect both.

This is the type of mailbox I’m talking about:

Hey @Bradw-17

The advantage of a counter over a Boolean is that you can not only count the number of items deposited, but also determine whether the mailbox is empty or not.

All you need to do is test if the counter is greater than 0.

If there’s a case where you think this isn’t possible, I might consider adding the option of a binary_sensor :slight_smile:

Hey @Thomasc37

I’ve created the following card, which I use in my dashboard. It allows me to display the date of the last mail collection or deposit, and the number of deposits not yet collected (up to 9, after which it displays 9+ because I don’t need the details at this stage). The number of deposits is shown in red, so I can see at a glance whether there’s mail or not, and when it was deposited.

I’m not a template expert, so maybe there’s a better way to share a template? If you know how, I’d be happy to look into it.

- type: custom:mushroom-template-card
    primary: Mailbox
    entity: counter.mailbox_count
    icon: "{{iif(states(config.entity, 0), 'mdi:mailbox', 'mdi:mailbox-open')}}"
    icon_color: "{{iif(states(config.entity, 0), '', 'red')}}"
    layout: horizontal
    tap_action:
      action: none
    fill_container: true
    secondary: >
      {% if(states('input_datetime.mailbox_last_deposit') <
      states('input_datetime.mailbox_last_collect')) %}
        Last pickup, {{time_since(states('input_datetime.mailbox_last_collect') | as_datetime | as_local)+"\n"+as_timestamp(states('input_datetime.mailbox_last_collect')) | timestamp_custom('le %d/%m Ă  %H:%M')}}

        
      {% else %}
        Last deposit, {{time_since(states('input_datetime.mailbox_last_deposit') | as_datetime | as_local)+"\n"+as_timestamp(states('input_datetime.mailbox_last_deposit')) | timestamp_custom('le %d/%m Ă  %H:%M')}}
      {% endif %}
    multiline_secondary: true
    badge_icon: >-
      {%set i = states('counter.mailbox_count')|int%}

      {{iif(i>9, 'mdi:numeric-9-plus',iif(i>0 and
      i<10,'mdi:numeric-'+i|string,''))}}
    badge_color: red

I use a door sensor on mine. It works but they don’t always close the mailbox when mail is delivered. So when we get the mail and close the mailbox door it doesn’t count as a collection.

Could the blueprint be modified to do this?

You can take control and modify it any way you like…