I get an error on some of my JPEG files when trying to attach in an email using the SMTP component.
I have five cameras and get the files using a wget shell_command. One of the cameras works fine, the others does not.
HASS log:
17-03-01 19:43:15 WARNING (Thread-1) [homeassistant.components.notify.smtp] Attachment /tmp/camera_kaelder_stort_rum.jpg has an unkown MIME type. Falling back to file
Output using āfileā on a Linux os:
This one works:
JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, Exif Standard: [TIFF image data, big-endian, direntries=3, datetime=2017:03:01 20:50:33], baseline, precision 8, 1280x720, frames 3
This one does not:
JPEG image data, baseline, precision 8, 1920x1080, frames 3
MIME info from Thunderbird:
This one works:
Content-Type: image/jpeg
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-ID:
This one does not:
Content-Type: application/octet-stream; Name="/tmp/camera_kaelder_stort_rum.jpg"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="/tmp/camera_kaelder_stort_rum.jpg"
I made a script that downloads the images using āwgetā and run a āconvertā from .jpg to .jpg and that seem to solve the issue with the unknown mime type.
Iām running a Pi with Python 3.6 in Venv, couldnāt get this to work on either of my setups (with varying cameras), probably permission / folder issues. It was happening with smtp email and pushbullet.
I installed imagemagik;
sudo apt install imagemagick
There were some libraries I had to add on one install the other went without issue.
I had issues getting the shell file to run with permissions so just added this shell command, I found it easier for the time being to name images differently so I could check it was working by rewriting;
I have a separate shell.yaml so the above dropped straight in here and in the automation this shell command ran after I captured the image with camera.snapshot in my automation, as below, saved me adding urls for capturing to shell command;
action:
- service: camera.snapshot
data:
entity_id: camera.rearcam
filename: /home/homeassistant/.homeassistant/tmp/rearcampic0.jpg
- delay: 00:00:02
- service: shell_command.camera_wget_convert1
- delay: 00:00:04
- service: notify.email_notification
data:
message: Door Opened
title: Door Opened
data:
#html: <h4>Movement in Dining Room</h4>
images:
- /home/homeassistant/.homeassistant/tmp/rearcampic1.jpg
I am getting the same warning. It also says āfalling back to fileā. In my case, I have also have the same message as html. It does seem that I am receiving the message in the html body.