I use Hyundai / Kia Connect to lock the doors if doors are unlocked, car is not at home, and trunk, hood, and all the doors are closed. The configuration below works.
alias: Maeve lock doors When Away
description: ""
triggers:
- device_id: 2df1612be1eae16ca53edd505e68ca3c
domain: lock
entity_id: 136f36371c2c63b285f5fcfa6e8dede0
type: unlocked
trigger: device
conditions:
- condition: device
device_id: 2df1612be1eae16ca53edd505e68ca3c
domain: device_tracker
entity_id: b70509be8d84165a57aaf380154b7789
type: is_not_home
- condition: device
device_id: 2df1612be1eae16ca53edd505e68ca3c
domain: lock
entity_id: 136f36371c2c63b285f5fcfa6e8dede0
type: is_unlocked
- condition: and
conditions:
- type: is_not_open
condition: device
device_id: 2df1612be1eae16ca53edd505e68ca3c
entity_id: d1578abf35a1256e123a1005924984cb
domain: binary_sensor
- type: is_not_open
condition: device
device_id: 2df1612be1eae16ca53edd505e68ca3c
entity_id: 9821219d216cdda8c3bd1408eaa34048
domain: binary_sensor
- type: is_not_open
condition: device
device_id: 2df1612be1eae16ca53edd505e68ca3c
entity_id: c71a6906e2fab345c48f62b9d029c4ff
domain: binary_sensor
- type: is_not_open
condition: device
device_id: 2df1612be1eae16ca53edd505e68ca3c
entity_id: 24a01a9c051dd7fc2ad2e8238fd9e7fc
domain: binary_sensor
- type: is_not_open
condition: device
device_id: 2df1612be1eae16ca53edd505e68ca3c
entity_id: fb40bfdc45f8062beb76d343bf2fb21a
domain: binary_sensor
- type: is_not_open
condition: device
device_id: 2df1612be1eae16ca53edd505e68ca3c
entity_id: acde6626ac686ed81f703fbab50f855d
domain: binary_sensor
- condition: state
entity_id: binary_sensor.maeve_engine
state: "off"
actions:
- device_id: 2df1612be1eae16ca53edd505e68ca3c
domain: lock
entity_id: 136f36371c2c63b285f5fcfa6e8dede0
type: lock
mode: single
The problem is that door unlock synchronization is sometimes slow. On the other hand I receive the email from Hyundai Bluelink in matter of minutes, sometimes seconds notifying me that doors are unlocked.
I found few examples of Gmail, Yahoo mail, or IMAP being used as trigger, and I have set up Google Mail and IMAP with Yahoo mail address.
When the email is received, I think I need to filter:
From: [email protected]
To: [email protected]
Body of the email: Your vehicle door is unlocked.
Additionally, it may be useful to filter for VIN number in the body of the email for when we get second car.
I tried:
trigger: state
entity_id:
- sensor.imap_myhyundai_yahoo_com_messages
from: [email protected]
to: [email protected]
and
type: value
device_id: 5c949c3907437d600ecd243c1328db45
entity_id: 7ebe6f845007372a45a04eae3abf4384
domain: sensor
trigger: device
above: 1
and
alias: New automation
description: ""
trigger:
- platform: event
event_type: imap_content
event_data:
sender: [email protected]
initial: true
And when I tried to add any additional lines, YAML editor would show error when trying to save.
Sender: “{{ trigger.event.data[‘sender’] }}”
Message: “{{ trigger.event.data[‘text’] }}”
I was tryin to use Trigger an automation when an email is recieved and IMAP.
Any help would be appreciated, at least the direction or sample.
Thanks