IMAP Email Content state change on HA Restart

Hi

Every time I restart home assistant the imap sensor will read every unread email and report them as state change. This is troublesome as I was hoping to use the email notification from a Reolink camera in a automation. But the automation will trigger multiple times after a restart. Any way around this?

My config and automation

##IMAP GMAIL
  - platform: imap_email_content
    server: imap.gmail.com
    name: reolink_mail
    port: 993
    username: [email protected]
    password: xxxxxxx
    scan_interval: 30
    senders:
      - [email protected]
alias: Reolink notification
description: ''
trigger:
  - platform: state
    entity_id: sensor.reolink_mail
    attribute: subject
condition: []
action:
  - service: notify.mobile_app_thomas_mobil
    data:
      message: >-
        {{ state_attr('sensor.reolink_mail','subject').split(' ')[0] }} {{
        state_attr('sensor.reolink_mail','subject').split(' ')[1] }} {{
        state_attr('sensor.reolink_mail','subject').split(' ')[5] }} {{
        state_attr('sensor.reolink_mail','subject').split(' ')[7] }}
mode: single

For now I created a filter in gmail for email recieved from reolink account and older_than:1h which marks them as read.

I’m having this problem too. Thanks for the workaround. It would be nice if this was fixed natively, though.

Seems like there’s some movement here:

scan_interval isn’t a feature for this integration is it?

I’m having issues with this integration, along side what has been mentioned here.

It is possible to set a scan_interval. I use 30 myself as a compromise between reducing traffic and in the same time get updates fast enough, as I use it with a camera.

The problem arise when you restart HA and it reads every unread email again as state.

Edit: i see now it is not mentioned in the docs. So not sure where I got it from. Put the project on ice for now anyways