Ah I encounter this when it’s only 1 mail as well, I’m not sure what’s happening there @moralmunky did up that bit of code.
It happens with more than 1. Like I said I haven’t gotten images in about 2 weeks. Doesn’t matter the amount of mail.
EDIT: oops, I may not have been running the latest version of the code somehow. Repulled and restarted, will see if it works now.
I’ll have to look into this. I’m inclined to say it is in your environment, I am still receiving new images with the current published code.
I’m running HASS via Docker.
Running through some tests and found a few bugs and made some improvements.
**
As always, be sure you have a back up of your system to revert to before running test scripts!
**
https://github.com/moralmunky/Home-Assistant-Mail-And-Packages
Download the test.py from the repository and place it in your /www/mail_and_packages/ folder.
Plug in details below in the test.py
- Lines 18 - 21 and line 23 matches the ‘mail_and_packages’ file path you are currently using.
- Line 90 enter the mailing date that should have mail images, the email still needs to be in your inbox.
- Add the new image-no-mailpieces700.jpg to the /www/mail_and_packages/ folder.
Run this file manually from the command line in your home assistant environment under your home assistant user. Note the terminal output and check the mail_today.gif.
Run this check on multiple days to be sure it is working correctly.
Thanks for this! Figured it out, it was because in Docker imagemagick isn’t installed. So I had to first get into bash in the container (docker exec -it CONTAINER_NAME /bin/bash
) and then execute this: apk add --update imagemagick
Ran a test and it generated the gif. Will see if I get a working ping tomorrow. Yay docker lol
It’s sorta working. I think I’m running into the bug @firstof9 mentioned with 1 piece of mail not generating an image. But i’ve gotten at least some kind of image the past 2 days.
Please run the script that I provided earlier and specify the day you were getting a single piece of mail to verify the script is reporting and providing images correctly. You will check the in screen output of the script in the command line and the mail gif it created.
Here you go:
bash-5.0# python3 /config/www/mail_and_packages/test.py
Logged into your email server successfully!
Update Time 'Sep-25-2019 12:23 PM'
Logged into your email server successfully!
Attempting to find Informed Delivery mail for 25-Sep-2019
Found emails: 1
Image found: /config/www/mail_and_packages1060203813-011.jpg.
No mail without images image found.
Total mages found in email: 1.
Removing duplicate images.
Found 1 unique images total to generate gif.
/config/www/mail_and_packages1060203813-011.jpg
Removing USPS announcement images.
Found 1 mail images total to generate gif.
/config/www/mail_and_packages1060203813-011.jpg
GIF of mail images generated.
Deleting temporary images.
Error occured while either processing email.
list.remove(x): x not in list
It looks like it is finding and processing a single mail item. I’ll work to implement this into the main repository.
Probably the same issue but I noticed today i have 2 pieces of mail but only 1 image is being generated for the gif. Probably the same issue but thought i’d pass it along. Here’s my test.py output:
bash-5.0# python3 /config/www/mail_and_packages/test.py
Logged into your email server successfully!
Update Time 'Sep-26-2019 09:14 AM'
Logged into your email server successfully!
Attempting to find Informed Delivery mail for 26-Sep-2019
Found emails: 1
Image found: /config/www/mail_and_packages1060498379-011.jpg.
Image found: /config/www/mail_and_packages1060498630-011.jpg.
No mail without images image found.
Total mages found in email: 2.
Removing duplicate images.
Found 2 unique images total to generate gif.
/config/www/mail_and_packages1060498379-011.jpg
/config/www/mail_and_packages1060498630-011.jpg
Removing USPS announcement images.
Found 2 mail images total to generate gif.
/config/www/mail_and_packages1060498379-011.jpg
/config/www/mail_and_packages1060498630-011.jpg
GIF of mail images generated.
Deleting temporary images.
Error occured while either processing email.
list.remove(x): x not in list
Great! It looks like the updated way is finding the right number of images
Yeah it’s picking up the ad that you noticed (which is sporadic) but I can live with that.
Also, is there a way to add imagemagick as a requirement/dependency so it’s installed with the component? It’s annoying to have to install it every time in docker when i update HASS.
Which of these is the best way to do it? They both look similar to each other.
Custom component (https://github.com/moralmunky/Home-Assistant-Mail-And-Packages)
The other one relies partly on the UPS/Fedex components which are now removed/deprecated, versus the custom component uses your email.
Ah thanks that is the one I was following but ran into a wall with the install of imagemagick. I am not sure how to install it on HA that is a VM of Proxmox. I can get to command line but it will not let me enter the apt-get command.
Not sure if the UPS email is correct. The shipping information comes in on [email protected] email from UPS. Hope that helps/
I don’t use Proxmox but if it’s like Docker, I posted the bash command a few lines up to install imagemagick.
Have the changes for getting the images gone into the main script? When I run it via test.py I am getting the images from USPS email. I do not get any images when it run through HA. It does find the item and report it, but no image.