I've seen some posts on the HA forums from @autumn frost mentioning that you can use a IMAP search in the event_data for IMAP template sensors, but I cannot get it to work at all. I'm hoping he might see this and come around and give me a helping hand, or someone else that knows what I'm doing wrong can point me in the right direction
I've seen this mentioned a few times on the HA forums, but it doesn't work for me:
- trigger:
- platform: event
event_type: "imap_content"
id: "trigger_id"
event_data:
search: UnSeen UnDeleted FROM "noreply@ups.com"
sensor:
- name: my_imap_template_sensor
state: "{{ trigger.event.data['subject'] }}"
The line that doesn't seem to work is:
search: UnSeen UnDeleted FROM "noreply@ups.com"
I get no response from my sensor at all when I do this, just "unknown". I know there are emails that I'm matching. Ultimately, what I'm trying to do I have a bunch of emails coming from one sender, but they have different ID codes in the body. I want the latest email with the ID code "11111" to show up in sensor 1, and then the latest email from that same sender with ID code "22222" in the body to goto sensor two etc. help!