USPS, FedEx, UPS Custom UI Card & Lovelace (Updated 2-29-2020, Newer version available)

@moralmunky I got this setup and it’s working great. Thanks for sharing it. I had to turn off the notifications, because I was getting 2 notifications every five minutes. I get one notification that just says, Here is the mail with the gif, and the other gives the details of which packages and mail is coming, this repeats every five minutes. Is it possible to tone this down, so it will only go if there is a change?

Are you using the example automation from https://github.com/moralmunky/Home-Assistant-Mail-And-Packages/blob/bb07d8c8b5472b40aeb151e048a2c59d3d7a144d/README.md?

It should only be firing when there is a change in the number for the sensors in the trigger section. Can you share what you have for the notifications?

I think the attributes of the sensor getting updated triggers it somehow. Might be a bug in HA, might be by design I’m not sure yet.

Thanks for following up. I followed the instructions on your github, and used the example code.

Here is the config from configuration.yaml:

sensor:
  - platform: template
    sensors:
      mail_deliveries_message:
        friendly_name: "Deliveries Summary"
        entity_id: 
          - sensor.mail_usps_mail
          - sensor.mail_usps_delivering
          - sensor.mail_fedex_delivering
          - sensor.mail_ups_delivering
        value_template: > 
          {# Deliveries Sentence #}
            {% macro deliveries_sentence() -%}
                  {%- if states("sensor.mail_usps_mail")|int == 0 -%}
                    No
                  {%- else -%}
                    {{states("sensor.mail_usps_mail")|int}}
                  {%- endif -%}
                {{' '}} 
                  {%- if states("sensor.mail_usps_mail")|int <= 1 -%}
                    pieces of mail
                  {%- else -%}
                    pieces of mail
                  {%- endif -%}
                {{' '}}will be delivered.{{' '}} 
                  {%- if states("sensor.mail_usps_delivering")|int == 0 -%}
                    No
                  {%- else -%}
                    {{states("sensor.mail_usps_delivering")|int}}
                  {%- endif -%}
                {{' '}} 
                  {%- if states("sensor.mail_usps_delivering")|int == 1 -%}
                    USPS package is
                  {%- else -%}
                    USPS packages are
                  {%- endif -%}
                {{' '}}in transit.{{' '}}
                  {%- if states("sensor.mail_fedex_delivering")|int == 0 -%}
                    No
                  {%- else -%}
                    {{states("sensor.mail_fedex_delivering")|int}}
                  {%- endif -%}
                {{' '}} 
                  {%- if states("sensor.mail_fedex_delivering")|int == 1 -%}
                    FedEx package is
                  {%- else -%}
                    Fedex packages are
                  {%- endif -%}
                {{' '}}in transit.{{' '}}
                {%- if states("sensor.mail_ups_delivering")|int == 0 -%}
                    No
                  {%- else -%}
                    {{states("sensor.mail_ups_delivering")|int}}
                  {%- endif -%}
                {{' '}} 
                  {%- if states("sensor.mail_ups_delivering")|int == 1 -%}
                    UPS package is
                  {%- else -%}
                    UPS packages are
                  {%- endif -%}
                {{' '}}in transit.{{' '}}
                {%- if states("sensor.mail_amazon_packages")|int == 0 -%}
                    No
                  {%- else -%}
                    {{states("sensor.mail_amazon_packages")|int}}
                  {%- endif -%}
                {{' '}} 
                  {%- if states("sensor.mail_amazon_packages")|int == 1 -%}
                    Amazon package is
                  {%- else -%}
                    Amazon packages are
                  {%- endif -%}
                {{' '}}in transit.{{' '}}
            {%- endmacro %}
          {{deliveries_sentence()}}

And this is what I have in my automations.yaml (currently commented out):

#- alias: Mail Notif - Mail Delieveries
#  initial_state: 'on'
#  trigger:
#  - platform: state
#    entity_id: sensor.mail_usps_mail
#  - platform: state
#    entity_id: sensor.mail_usps_delivering
#  condition:
#  - condition: or
#    conditions:
#    - condition: template
#      value_template: '{{ states(''sensor.mail_usps_mail'') | int > 0 }}'
#    - condition: template
#      value_template: '{{ states(''sensor.mail_usps_delivering'') | int > 0 }}'
#  action:
#  - service: notify.notify
#    data_template:
#      title: '*Today''s Mail and Packages*'
#      message: '{{ states(''sensor.mail_deliveries_message'')}}'
#  - service: notify.notify
#    data:
#      message: Here is the mail
#      data:
#        document:
#          file: /config/images/mail_and_packages/mail_today.gif

Does this integration support Fedex Canada, Amazon.ca, etc?

It’s polling my email but it’s not finding any packages from these sources.

This thread is for the lovelace card, the integration is here.

1 Like

Hey guys I installed the card via HACS after the old card disappeared. I can add a manual card and put the text like the documentation but the visual editor doesn’t come up. My resources are loaded as is the card. I’ve restarted to see if that was the problem and still nothing. The card just vanishes.

Did you try F5 already?

Yes I have

Have you updated the card recently?
If you’ve updated HA, the card also needs updating due to changes in I think back in 0.115

I updated the card. It was actually working fine until I went from 0.117.6 to 0.118.3. Unsure why its not working.

Ok update. Its working just fine on desktop, but on mobile it doesn’t work. On mobile I get, "Failed to fetch dynamically imported module: and it has the .js for mail and packages listed.

Have you reloaded resources?
That has to be done on each device (usually it will refresh automagically, but sometimes it needs a manual push). The 3 vertical dots in the upper right hand corner.

1 Like

Can you please help me, i cant seem to figuire out why the image will not display in the card. Not sure how to setup that part, i am a complete beginner.

Can you please help me understand how to get the image working? Everything else works except that. I am a complete beginner. Thank you !

Less than one week in to learning Home Assistant. I am trying to get this card setup. I have the integration seemingly working. I installed the Lovelace card via HACS. I set up the resources for the card and the editor card per the instructions. I have never seen it work, only give this error:

NotSupportedError: Failed to execute ‘define’ on ‘CustomElementRegistry’: the name “mail-and-packages-card-editor” has already been used with this registry.

I tried deleting the resources I created and restarting. I still get this same error. I have no idea how this is already defined or what this error means.

No idea, when you install via HACS it does everything for you all you have to do is add the card to your dashboard.

That’s what I did and I get this error. I found that after copying the example YAML when I get the error by editing the error would disappear long enough to save the card. However, I can never get the visual editor to pop up, it gives the same error about already being used in the registry. I don’t know how to configure it manually in configuration.yaml, I would try that if I knew what to put in there. The GitHub repo docs don’t say.

You can’t. This sounds like you’ve loaded, or tried to load, the card twice.

I am using integration 0.3.3 b20 with custom card V 0.06 and the camera.mail_usps_camera sensor is showing broken image instead of gif rotating of mail. anybody has a fix or where to look for a fix?