I am loving learning templates, but have hit a wall on something probably simple. I have an IMAP Content sensor scraping gmail for email notifications of a new voicemail. It triggers a simple automation that announces through Alexa that there is a new voicemail. It works once - but it only detects the first email, after that, the sensor stays true. Restarting HA fixes the issue, but obviously that is inelegant, to say the least.
Is there any chance someone might be willing to help me learn to do this correctly? I have been struggling with it over the past few days, and it is driving me mad.
- platform: imap_email_content
server: imap.gmail.com
name: voicemail_alert
port: 993
scan_interval: 60
folder: inbox
username: !secret xxx_google_user
password: !secret xxx_google_pass
senders:
- [email protected]
value_template: >-
{% if 'New voicemail from' in subject %}
New Voicemail
{% else %}
No Voicemail
{% endif %}
alias: Phone - Voicemail Notification
description: ''
trigger:
- platform: state
entity_id: sensor.voicemail_alert
to: New Voicemail
condition: []
action:
- service: notify.alexa_media_all
data:
message: New Voicemail, New Voicemail
data:
type: tts
mode: single