Mail and Packages: Custom component for UPS, FEDEX, and USPS

Try the following modifications:

- alias: "Mail Notif - Mail Delieveries"
  initial_state: 'on'
  trigger:
  #Trigger if mail or packages get updated
    - platform: state
      entity_id: sensor.mail_usps_mail
    - platform: state
      entity_id: sensor.mail_usps_delivering
  #send only if mail or packages are more than 0
  condition:
    - condition: or
      conditions:
        - condition: template
          value_template: "{{ (as_timestamp(now()) - as_timestamp(states.sensor.mail_usps_mail.last_changed)) < 15 }}"
        - condition: template
          value_template: "{{ (as_timestamp(now()) - as_timestamp(states.sensor.mail_usps_delivering.last_changed)) < 15 }}"
  action:
    - service: notify.YOUR_NOTIFY_METHOD
      data_template:
        title: "*Today's Mail and Packages*"
        message: "{{ states('sensor.mail_deliveries_message')}}"
    - service: notify.YOUR_NOTIFY_METHOD
      data:
        message: "Here is the mail"
        data:
          document:
            file: "/<config path>/images/mail_and_packages/mail_today.gif"

Note that I haven’t tested these modifications yet myself, so YMMV.

2 Likes

I’m not getting spammed anymore, so it’s probably working. Won’t really know until I receive an update I think. Thank you!

1 Like

I’ve updated the wiki to reflect the change, I’ve tested it myself, works great.

So I updated to the latest beta version and noticed that all my entities were unavailable. After trying to set it up again I keep getting at an error on step 2 that says “User input malformed.” I haven’t changed anything for a while now and I can’t get past this step. What am I doing wrong?

A new option was added, go through the “options” and complete them, will fix you right up.
image

That’s exactly how I did it since the old way wasn’t working at all for me. I even tried to reinstall it and still no go.

Can you paste the error from the log?

Would this be it?

Logger: homeassistant.components.sensor
Source: custom_components/mail_and_packages/sensor.py:130
Integration: Sensor (documentation, issues)
First occurred: 8:25:00 AM (1 occurrences)
Last logged: 8:25:00 AM

Error while setting up mail_and_packages platform for sensor

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 178, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File “/usr/local/lib/python3.7/asyncio/tasks.py”, line 442, in wait_for return fut.result() File “/config/custom_components/mail_and_packages/sensor.py”, line 130, in async_setup_entry CONF_GENERATE_MP4: entry.data[CONF_GENERATE_MP4], KeyError: ‘generate_mp4’

Yes, try enabling the “Generate MP4” option in step 2 of the configuration. Then go back and disable it. Unless you want it on that is.

This worked, I was able to get past the setup finally but entities still show unavailable after reboot. But the gif shows now.

Logger: homeassistant.components.sensor
Source: custom_components/mail_and_packages/sensor.py:731
Integration: Sensor (documentation, issues)
First occurred: 9:21:09 AM (2 occurrences)
Last logged: 9:50:07 AM

Error while setting up mail_and_packages platform for sensor

Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 178, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File “/usr/local/lib/python3.7/asyncio/tasks.py”, line 442, in wait_for return fut.result() File “/config/custom_components/mail_and_packages/sensor.py”, line 137, in async_setup_entry sensors.append(PackagesSensor(data, variable)) File “/config/custom_components/mail_and_packages/sensor.py”, line 268, in init self.update() File “/config/custom_components/mail_and_packages/sensor.py”, line 316, in update self.data.update() File “/usr/src/homeassistant/homeassistant/util/init.py”, line 239, in wrapper result = method(*args, **kwargs) File “/config/custom_components/mail_and_packages/sensor.py”, line 197, in update count[sensor] = get_items(account, “count”) File “/config/custom_components/mail_and_packages/sensor.py”, line 731, in get_items orderNum.append(found[0]) IndexError: list index out of range

Exactly the same issue for me. I’ve just downloaded the component for the first time. Setup completes OK, but I have no entities and the log has the same error.

Hotfix coming up

1 Like

@WhimsySpoon and @Jeremy_S give b10 a shot

1 Like

Amazing work! I installed b10 via HACS, restarted HA and sixteen entities were automatically created (I didn’t need to reinstall the integration).

Thank you for resolving this so quickly.

1 Like

That did the trick. Thank you!

1 Like

:tada: 0.2.1 is released :tada:

Breaking change

You will need to run through the options and complete them to update the configuration due to a new feature.

What’s New

  • Added more Amazon TLDs for searching, currently: .com, .co.uk, .ca #125
  • Added a limited CA Post search since I couldn’t find an “Out for delivery” email template so there’s only a ‘delivered’ sensor at this time. #124
  • Fix filter_text function to detect USPS “out for delivery” emails better #92
  • Applied fix to Amazon email parser (should no longer error out)
  • Import of quopri
  • Amazon sensor regression fix
  • sync info.md with master
  • International Amazon fix
  • Added support for Amazon India in const.py
  • Previous code was unintentionally parsing all Amazon emails, instead of shipping confirmation mails. Implemented proposal in this comment: https://github.com/moralmunky/Home-Assistant-Mail-And-Packages/issues/125#issuecomment-643792745
  • Adjust Amazon sensor to pull order number from subject with regex
  • Simplified code to remove addition subject line parsing
  • Clean up some commented lines
  • Translation file updates #145
  • Add python-resize-image requirement #32
  • New image resize function #32
  • Translation URLs fixed
  • Add ability to generate mp4 file (requires ffmpeg) for use as a camera source #138
1 Like

Is there a usable way to have the mp4 act as a stream that can be usable in homekit?

I tried changing my camera from local_file to ffmpeg but I get a demuxing DTS error. Curious if you’ve labbed out a working config for that?

I’ve tried a couple things and haven’t figured out a way to stream. It may be a limitation of home assistant stream. I think it only supports a certain steam type.

that’s a bummer. I wonder if there are flags that can be fed to ffmpeg to nudge it into working.

Getting this error. Had to re-do the integration after the recent changes, and since then have been getting this error in my logs. I have no use for this particular entity. Any help to remove or at least stop it from generating the error?

Unknown sensor type: capost_delivering
7:56:34 PM – Mail and Packages (ERROR)

Thanks