Closed rubenv closed 2 days ago
Just leaving this here for those who might want to do the same: if you want the OTP handling to be fully automated, you might consider using the IMAP integration and an automation such as this:
alias: Volvo OTP description: "" trigger: - platform: event event_type: imap_content event_data: initial: true sender: no-reply@volvocars.com subject: Your Volvo ID Verification code condition: [] action: - service: mqtt.publish metadata: {} data: topic: volvoAAOS2mqtt/otp_code payload_template: >- {{ trigger.event.data['text'] | regex_findall_index(find='Your Volvo ID verification code is:\s+(\d+)', index=0) }} - service: imap.delete data: entry: "{{ trigger.event.data['entry_id'] }}" uid: "{{ trigger.event.data['uid'] }}" mode: single
This will post the OTP code to the right location and then delete the message from your inbox (if you're using Google Mail, that means archiving it).
Enjoy!
Wow, nice! Thanks.
Yeah I was amazed at how easy this was.
HA is a gem.
Are you able to post this for the ha community?
As in: put it on my blog or so? Might do that yes.
Just leaving this here for those who might want to do the same: if you want the OTP handling to be fully automated, you might consider using the IMAP integration and an automation such as this:
This will post the OTP code to the right location and then delete the message from your inbox (if you're using Google Mail, that means archiving it).
Enjoy!