I have created an automation using the IMAP integration, to alert me when emails arrive from specified senders with specified text in the Subject. It currently fails to trigger because the emails exceed the maximum size:
WARNING (MainThread) [homeassistant.components.imap.coordinator] Custom imap_content event skipped, size (36029) exceeds the maximal event size (32168), sender: [email protected], subject: Booking received for 15 Dec 2024
I understand that there is a way of working around this by using a custom template - there is an option in the IMAP integration config to specify a “Template to create custom event data”. I have no idea how to do this, however (and my understanding of templates is very sketchy).
Could anyone suggest how I should use this template to allow my automation to process the message?
The automation is defined as follows:
alias: Parking booking email arrives
triggers:
- event_type: imap_content
event_data:
sender: [email protected]
trigger: event
- event_type: imap_content
event_data:
sender: [email protected]
trigger: event
conditions:
- condition: template
value_template: "{{ 'ooking' in trigger.event.data.subject }}"
actions:
- action: media_player.play_media
target:
entity_id: media_player.bedroom
data:
media_content_id: /local/parking-booking.mp3
media_content_type: music