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

This also may be resolved by using the custom preloader card. https://github.com/gadgetchnnel/lovelace-card-preloader

Thanks @firstof9, unfortunately I was not able to get that to work. I have instead created a work around within Gmail and sent all delivery emails, including Amazon to a new folder and I will just monitor that folder.

Do you think it would ever be possible to display a tracking number and itā€™s estimated delivery or just make a link to that carrierā€™s website with the tracking loaded?

In the beta Amazon order numbers are exposed as an attribute of the sensor, you should be able to manipulate that data into a link.

Currently all my amazon emails go to a different email then the one I am using for this component, would forwarding them to this email work or is that ganna cause issues if the subject line now includes ā€œFWDā€?

The integration looks for the email address amazon uses and the subject line. Forwarding would not work out of the box. You would have to modify the const.py file and be conscious of that when upgrading to future versions.

Thatā€™s what I assumed, I was hoping to avoid having to change my amazon email since I think it will change the login but if the amazon sensor makes its way into the main version I probably will as amazon accounts for alot of packages. As always thanks for helping

Setup IMAP on the emailbox your Amazon emails currently go to, then have your mail system where you check email now pull those emails.

I did something similar when I shifted from my old Yahoo mail email to my Gmail many many many years ago :stuck_out_tongue:

Hmm that sounds like it should work as they are currently going to yahoo mail. Iā€™ll give that a try thanks for the tip!

So Iā€™m stupid and didnā€™t think for myself and blindly read the setup instructions, but think the Hass.IO instructions should be pointing at config/www/mail_and_packages not an images folder. Wasnā€™t working for me for a bit and I went back and read and was able to fix it. Working great now!

image

This was changed due to https://github.com/moralmunky/Home-Assistant-Mail-And-Packages/issues/70. It should be fine so long as you update all the paths to match for any sensors/cameras.

1 Like

With the latest beta update, how would I send the gif using the new state attribute? Iā€™ve been using Node Red to send it to Telegram every morning but now I have no idea how to replicate it.

I understand this was done for privacy reasons and Iā€™m okay with that, I just need to find a way to make it work again using NR, if possible.

Not sure about how Node-Red pulls data but internally in Home Assistant youā€™d use:

state_attr('sensor.mail_usps_mail','image')

to get the image file name.

Plans to make it a toggle are in the works. (Enable/disable random filename)

1 Like

Use an inject node connected to a get current state node. Finally attach to a debug node with full message.

Inject and youā€™ll get everything from the sensor.mail_usps_mail entity. You should be able to dig through the attributes and find the correct topic for image.

I havenā€™t updated to the newest version yet - might tomorrowā€¦ if/when I do Iā€™ll try to update this thread with it.

1 Like

Thank you, that helped me get the camera image updated within Home Assistant but not sure I can use it in Node Red to send the GIF. Still trying to figure it out.

That would be great, if you do decide to update. Iā€™m very new to Node Red so not quite sure what to do with all the data I get from doing what you suggested. Iā€™ve tried using a switch node but I think I have the JSON wrong.

On the first side of the screen just look at the debugger.
You should be able to expand and eventually find the imageā€¦

I havenā€™t had time to update, but here is an example of what it looks like before updating.
I expect the attribute is where youā€™ll find itā€¦ but youā€™re looking for an image tag:

1 Like

Yup thatā€™s as far as I got. No clue where to go from here.

image

Awesome, thatā€™s itā€¦ you can see your image thereā€¦ so next to it there is a clipboard that will copy the path or the valueā€¦ copy the path and you can use it elsewhere.

So, where ever you want to put the image name, use {{data.attributes.image}}.
OR if you are using a function node, its msg.data.attributes.image.
I believe this is because other nodes use mustache template, but function node does not.

Hope that helps!
DeadEnd

This should work @Jeremy_S . It wonā€™t catch if thereā€™s no mail, I gotta work on that. (SEE EDIT) TBH Iā€™ll probably just disable the random image name as I donā€™t really need it since the path for me isnā€™t public anymore. Hope thatā€™s coming soon @firstof9

[{"id":"916e36b5.b8b428","type":"api-call-service","z":"1fe83a7f.e0f0b6","name":"Update Image","server":"63517380.eb951c","version":1,"debugenabled":false,"service_domain":"local_file","service":"update_file_path","entityId":"camera.usps_mail","data":"{ \"file_path\": \"/config/images/mail_and_packages/{{payload}}\" }","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":420,"y":1700,"wires":[[]]},{"id":"f1eae158.c7849","type":"api-render-template","z":"1fe83a7f.e0f0b6","name":"Test","server":"63517380.eb951c","template":"{% if state_attr('sensor.mail_usps_mail','image') == None  %}\nmail_none.gif\n{% else %}\n{{ state_attr('sensor.mail_usps_mail','image') }}\n{% endif %}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"","templateLocationType":"none","x":250,"y":1700,"wires":[["916e36b5.b8b428"]]},{"id":"c44bdd94.af8dd","type":"server-state-changed","z":"1fe83a7f.e0f0b6","name":"Camera Update","server":"63517380.eb951c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.mail_usps_mail","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":100,"y":1700,"wires":[["f1eae158.c7849"]]},{"id":"63517380.eb951c","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

EDIT: Ok I figured out how to do the mail_none.gif bit using a template node. Youā€™ll need to have the mail_none.gif in the same path as your mail_today.gif (or what WAS mail_today.gifā€¦). Code above is updated to reflect the change.

EDIT 2: Nope, not working @firstof9 Iā€™m using your suggestion here https://github.com/moralmunky/Home-Assistant-Mail-And-Packages/issues/70#issuecomment-610675419 but the problem is the image path seems to update more frequently than the sensor, so with there being no change to the sensor itself, the image path isnā€™t updated so the camera entity is broken. Gonna revert for now until the disable switch is available.

The image file name changes each mail check and the attribute is updated along with it.