I have a problem with the following automation. If i remove (disable) the condition, the automation works as expected, but if I enable it then it doesn’t work anymore.
(And I’m definitely putting the “LightOn” word in the email subject…)
Any ideas?
alias: Test IMAP
description: Test IMAP
trigger:
- platform: event
event_type: imap_content
event_data:
sender: [email protected]
condition:
- condition: template
value_template: "{{ 'LightOn' in trigger.event.data.subject }}"
enabled: true
action:
- service: light.toggle
target:
entity_id: light.tolomeo
data: {}
mode: single
I have push enabled on all my GMail-based IMAP sensors and have never noticed it to be unreliable. IIRC, GMail rate limits push to 1/sec. If you have a particularly active inbox it is possible to miss individual messages.
I do get many emails (which was the reasons why I was trying to automate / set up alerts for some of those), so that must be part of the reason.
Although having tested this for few days, even with the push option disabled not all emails are correctly caught by the automation (some are simply missed).
If push was working, you should turn it back on. Disabling it will only make the situation worse since the polling rate is slower than the push limit.
If the issue is the quantity of emails you are receiving, you should consider using some form of pre-sorting. There are a number of ways to accomplish this depending on your needs.
GMail has built in functions to filter incoming messages and add tags or move them into folders. Then:
Use a more specific search in your IMAP sensor configuration. This can be done in conjunction with GMail filtering or on its own to reduce the quantity of messages that reach HA.