-
Notifications
You must be signed in to change notification settings - Fork 86
USPS Informed Delivery Image
Jump to: Getting the image | Displaying the image
Use the sensor.mail_image_url
in situations where an internet accessible url is needed to view your image file.
Requirements:
-
Allow external image use
must be checked -
Internal_URL
orExternal_URL
must be configured in Home Assistants general configuration
Where to use it
Please note that files stored in the www Home Assistant folder are publicly accessible unless you have taken security measures outside of Home Assistant to secure it. For increased security and simplicity the USPS Informed Delivery image name is random by default and no longer has the option to turn it on/off.
A camera entity can be used in various Lovelace cards that display images or cameras. Using a camera entity requires Local file camera entity and an automation to update the camera with the current file name of the GIF are manually created .
Add to the camera:
portion of configuration.yaml.
- platform: local_file
file_path: /<config path>/custom_components/mail_and_packages/mail_none.gif
name: mail_usps
The image file is generated with a random file name and supplies this with the sensor.mail_image_system_path
. To keep the camera updated with the correct file name, add the following automations to the automation:
portion of configuration.yaml or recreate it in the GUI.
- alias: "Update USPS Mail Camera Path on Hass Restart"
trigger:
- platform: state
entity_id: sensor.mail_updated
- platform: homeassistant
event: start
action:
- service: local_file.update_file_path
data_template:
entity_id: camera.mail_usps
file_path: "{{ states('sensor.mail_image_system_path') }}"
Please note, that the browser cache can be a blocker to get the image to display in certain configurations.
Mail and Packages Custom Card can be installed manually or through HACS. Use the sensor.mail_image_url
for the GIF Sensor or the camera entity you created earlier to display the USPS Informed Delivery image.
You can create your own card using the entities generated by the integration and the front end Lovelace editor provided by Home Assistant. A few options provided by the community are provided below.
Note: The local file camera reloads the file after 10 seconds. If the gif is langer than 10 seconds not all mail with be shown. Please use a picture entity card with the camera view set to live.
Example 1: Vertical Stack Card
type: vertical-stack
cards:
- type: picture-entity
entity: camera.mail_usps
aspect_ratio: 50%
name: Mail
camera_view: live
show_name: false
show_state: false
- type: entity-filter
state_filter:
- operator: '>'
value: '0'
entities:
- entity: sensor.mail_usps_mail
name: USPS Mail
- entity: sensor.mail_usps_packages
name: USPS Packages
- entity: sensor.fedex_packages
name: FedEx Packages
- sensor.mail_ups_packages
- sensor.mail_packages_in_transit
- sensor.mail_packages_delivered
- entity: sensor.mail_updated
Example 2: Vertical Stack Custom Card
- type: custom:vertical-stack-in-card
title: Mail & Package Tracking
cards:
- aspect_ratio: 50%
camera_view: live
entity: camera.mail_usps
name: Mail
type: picture-entity
- type: entity-filter
state_filter:
- operator: ">"
value: '0'
entities:
- entity: sensor.mail_usps_mail
name: "Today's Mail"
- entity: sensor.mail_packages_in_transit
name: "Today's Package Delivery"
- entity: sensor.mail_usps_delivering
icon: 'mdi:package-variant-closed'
name: USPS
- entity: sensor.mail_fedex_delivering
icon: 'mdi:package-variant-closed'
name: FedEx
- entity: sensor.mail_ups_delivering
icon: 'mdi:package-variant-closed'
name: UPS
- entity: sensor.mail_updated
state_filter:
- operator: "regex"
value: 20
Example 3: Vertical Stack Custom Card
cards:
- cards: null
entities:
- entity: sensor.mail_usps_mail
name: Todays USPS Mail
- entity: sensor.mail_packages_in_transit
name: Todays Package Delivery
type: entities
- cards: null
entities:
- entity: sensor.mail_usps_delivering
icon: 'mdi:package-variant-closed'
name: USPS
- entity: sensor.mail_fedex_delivering
icon: 'mdi:package-variant-closed'
name: FedEx
- entity: sensor.mail_ups_delivering
icon: 'mdi:package-variant-closed'
name: UPS
show_header_toggle: false
type: glance
- aspect_ratio: 50%
camera_view: live
entity: camera.mail_usps
name: Mail
type: picture-entity
- cards: null
entities:
- entity: sensor.mail_updated
type: entities
title: Mail & Package Tracking
type: 'custom:vertical-stack-in-card'
Example 4: Picture Elements Card (with image overlays)
You may want to overlay the camera with some images to make the image a little more fancy here's an example of how to do so with the included overlays in a picture element card.
type: picture-elements
elements:
- type: image
entity: null
camera_image: camera.mail_usps
camera_view: live
style:
top: 50%
left: 50%
width: 100%
- type: image
entity: null
image: local/mail_and_packages/overlay.png
style:
top: 50%
left: 50%
width: 100%
- type: image
entity: camera.mail_usps
image: local/mail_and_packages/vignette.png
style:
top: 50%
left: 50%
width: 100%
image: local/mail_and_packages/white.png
entity: camera.mail_usps
tap_action:
action: more_info
hold_action:
action: none