Where did I park my car?

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

I’ve been think about this one for a while. Now finally sat down and had a go. Turned it into my very first (published) blueprint.

This blueprint saves your current your location so that you may find your way back later. Hence you need to actually be by your car when you push the button, and provide necessary location accuracy for your need.

##Prerequisites

  1. You need to have a device tracker that updates your user’s location.
  2. You need a button helper that you press.
  3. You need a text input helper to save the coordinates.
  4. One template sensor that provides a link to eg. Google maps, based on the coordinates as such: Google Maps{{ states(‘input_text.parked_car_location’) }}

##How it works
When your button is pressed, that automation runs, grabs the user_id of the user that pressed the button, uses that to grab the username, which in turn grabs the coordinates of that user. Saves that to a text field.

yaml:
  blueprint:
  name: Where Did I Park My Car
  description: Saves your car's location when you press a designated input button.
  domain: automation 

  input:  # User-configurable inputs
    car_location_input_text:
      name: Location Storage
      description: Input Text helper to store car's coordinates
      selector:
        entity:
          domain: input_text 
    
    location_button:
      name: Parking Location Button
      description: The input button that triggers the automation
      selector:
        entity:
          domain: input_button

trigger:
  - platform: state
    entity_id:
      - location_button
action:
    - variables:
      userid: "{{ trigger.from_state.context.user_id }}"
      username: |
        {% for person in states.person if person.attributes.user_id == userid %}
          {{ person.attributes.friendly_name | lower }}
        {%- else -%} 
          unknown
        {% endfor %} 
  - service: input_text.set_value
    data_template:
      value: >
        {{ state_attr('person.' + username, 'latitude') }},{{
        state_attr('person.' + username, 'longitude') }}
    target:
      entity_id: car_location_input_text