I have a sensor setup to read my Gmail and go to a specified state if a subject contains specified text. While it seem to detect such emails, it seems to repeatedly read the most recent email of the day which contained the specified text in the subject.
So for example, the sensor is being set to “parking_booking” several times a day, a when I look at the attributes of the sensor I see the text of the first email of the day which contained the text in question.
I guess that I’m misunderstanding how this integration works, or misusing it in the way I have defined the sensor below.
Could anyone advise on how I can get the integration to check each email only ONCE for the value template, rather than repeatedly which is happening at the moment?
- platform: imap_email_content
server: imap.gmail.com
name: parking_emails
port: 993
username: [email protected]
password: mypassword
senders:
- [email protected]
- [email protected]
value_template: >-
{% if 'You have a new booking' in subject %}
parking_booking
{% elif 'you have a new JustPark booking' in subject %}
parking_booking
{% endif %}