Beginner automation question

Hi! I’m still learning my way with Home Assistant, and looking for help on a seeming straight forward automation question. I have my Tesla connected to HA, and a binary sensor to indicate when my garage door is opened or closed. Here is what I’d like to achieve:

When the Garage Door Opens, if my Tesla is located at Home, and the charger is Connected, the Unlock the car (this makes it easier to remove the charger when I get to the car). Here are the specific components in question:

device_tracker.tesla_model_3_5yj3e1ebxjf072258_location_tracker
binary_sensor.tesla_model_3_5yj3e1ebxjf072258_charger_sensor
lock.tesla_model_3_5yj3e1ebxjf072258_door_lock
binary_sensor.garage_door_sensor

Thanks in advance for any help!

automation:
  alias: Unlock the Tesla when leaving
  initial_state: on 
  trigger:
    platform: state
    entity_id: binary_sensor.garage_door_sensor
    to: 'open'
  condition:
    - condition: state 
      entity_id: device_tracker.tesla_model_3_5yj3e1ebxjf072258_location_tracker
      state: 'home'
    - condition: state 
      entity_id: binary_sensor.tesla_model_3_5yj3e1ebxjf072258_charger_sensor
      state: 'on'
  action:
    service: lock.unlock
    entity_id: lock.tesla_model_3_5yj3e1ebxjf072258_door_lock

I’ve guessed the wording for the states as ‘open’ for the garage door and ‘on’ for charging.

Awesome, I will try this. Thank you!