Skip to content

Commit

Permalink
Fix photo embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed May 2, 2022
1 parent 3962a23 commit 2b26133
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/o365/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"O365==2.0.18.1",
"BeautifulSoup4>=4.10.0"
],
"version": "v3.0.0",
"version": "v3.0.1",
"iot_class": "cloud_polling"
}
6 changes: 4 additions & 2 deletions custom_components/o365/notify.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,18 @@ def _build_photo_content(self, photos, new_message_attachments):
photos = [photos]

photos_content = ""
i = 0
for photo in photos:
i += 1
if photo.startswith("http"):
photos_content += f'<br><img src="{photo}">'
else:
photo = get_ha_filepath(self._hass, photo)
new_message_attachments.add(photo)
att = new_message_attachments[-1]
att.is_inline = True
att.content_id = "1"
photos_content += f'<br><img src="cid:{photo}">'
att.content_id = str(i)
photos_content += f'<br><img src="cid:{att.content_id}">'

return photos_content

Expand Down

0 comments on commit 2b26133

Please sign in to comment.