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

At long last I figured out my custom mail and package issue of not found. The card was re-named in one of the updates which I missed. The “-” was removed. Card working again on all devices.

Mail and package stop reading my email for mail delivery. I have email messages showing mail coming today and no mail in HA. Noticed this for a couple of days. Maybe started when I updated to the 2021. 8 beta? Now on the August release with same issue. I use to see the message was read in Gmail. It no longer shows read

Check your logs for errors.

The logs:
This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/mail_and_packages/camera.py:147
Integration: Mail and Packages (documentation, issues)
First occurred: 7:46:29 AM (1508 occurrences)
Last logged: 2:03:00 PM

Update for camera.mail_amazon_delivery_camera fails
Update for camera.mail_amazon_delivery_camera_2 fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 446, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 654, in async_device_update
raise exc
File “/config/custom_components/mail_and_packages/camera.py”, line 188, in async_update
self.update_file_path()
File “/config/custom_components/mail_and_packages/camera.py”, line 147, in update_file_path
image = self._coordinator.data[ATTR_AMAZON_IMAGE]
KeyError: ‘amazon_image’

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/mail_and_packages/camera.py:134
Integration: Mail and Packages (documentation, issues)
First occurred: 7:46:29 AM (1508 occurrences)
Last logged: 2:03:00 PM

Update for camera.mail_usps_camera fails
Update for camera.mail_usps_camera_2 fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 446, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 654, in async_device_update
raise exc
File “/config/custom_components/mail_and_packages/camera.py”, line 188, in async_update
self.update_file_path()
File “/config/custom_components/mail_and_packages/camera.py”, line 134, in update_file_path
image = self._coordinator.data[ATTR_IMAGE_NAME]
KeyError: ‘image_name’

Camera update failures won’t stop the sensors from updating, any other errors?
Debug logs?

I found the error. For some reason the password for Gmail was deleted. I didn’t do it. Maybe Google? Not sure, in case, I regenerated it and the component is working again.
Thanks.

1 Like

It was working fine, until this happened:

Logger: homeassistant.components.automation.update_usps_mail_camera_path_on_hass_restart
Source: components/automation/__init__.py:517
Integration: Automation (documentation, issues)
First occurred: August 4, 2021, 2:39:01 PM (219 occurrences)
Last logged: 10:06:07 AM

Error while executing automation automation.update_usps_mail_camera_path_on_hass_restart: Unable to find service local_file.update_file_path

This automation is no longer required, the integration provides it’s own camera entities now.

Guessing not since there hasn’t been a post here for 20 days but I noticed after the last update to this module that HA is alerting me like 4 times a day that I have new mail. Didn’t do that previously though have seen this a while back.

So on the above you will see several times on the current day at the time. There was one more later after this picture was taken.

What version? 0.3.2?
If so, try the latest beta and see if that helps.

No, 0.3.3-b13. Think that’s what caused this for me anyway.

Strange, I am unable to duplicate this, are you perhaps getting multiple USPS emails?

Nope. And extra stuff because it won’t let me just send nope.

What automation are you using to trigger the notification?

Here’s the one triggering:

- id: notify_usps_mail_coming_today
  alias: "[Mail] USPS Mail Coming Today"
  initial_state: 'on'
  trigger:
    platform: numeric_state
    entity_id: sensor.mail_usps_mail
    above: 0
  action:
    - service: notify.john
      data:
        message: >
          Receiving {{ states.sensor.mail_usps_mail.state }} piece(s) of mail today

Looking at the history it almost looks like it’s loosing the status and then getting it back again causing the trigger.

If it’s checking over and over in this case no idea.

Also see some stuff specifically and only about mail that show becoming Unavailable:

@firstof9 wasn’t there an issue with the timeout being too low causing unavailable sensors? @jriker1 Try increasing the seconds before timeout in the integration settings.

Yes, a time out will cause the sensors to go into the Unavailable state.

think i did that before. Set to 60 seconds for time in seconds before timeout.

Try 120 seconds

Didn’t help. Not sure if both checks are at the same time, but I was getting mail today and also a package was delivered from Amazon.

Currently on 6 notices that 2 items coming from USPS today and 6 that the package was delivered.

This is where I changed it in case I did it wrong:

image