Help creating a template sensor for IMAP

Ok, so I think I can see where I am going wrong. It transpires that marking Yale emails as unread is not adequate for testing purposes. I just triggered my alarm and everything worked as it should, but marking the emails as unread does not work.

However, the other night, my alarm was triggered, and it did not work. I am not sure why but my Garage PIR alert is displayed a little differently from other PIR’s; it does not state interior/perimeter. Can you see any reason why the Garage email below wouldn’t work the same as the others?

Garage:

Living Room PIR (Interior):

Dining Room (Interior):

Living Room PIR (Perimeter):

I just manually triggered Garage PIR and it does not work for some reason. The state is blank.

The only difference I can see is that “Garage” goes to a new line after “Burglar” and the others do so before. I don’t really see a reason the regex would fail due to a line break symbol there and not elsewhere, but you could try an even simpler expression like:

{{ trigger.event.data['text'] | regex_findall(find='(?<=Device Name:).*?Burglar', ignorecase=False) | list | first }}

1 Like

Thank you so much! That did the trick.

Thanks for your help @Didgeridrew, I would love to repay the favour in some way, be it buyacoffee/beer link or similar.

Edit: cut waffle.

There is a link on my profile.

1 Like