
Last updated on March 21, 2026
In the world of smart homes, location data is just as critical as the state of a light switch or the temperature in your living room. Adding GPS coordinates to your sensors in Home Assistant isn’t just a cool visual trick; it’s the gateway to a smarter, more context-aware system. In this definitive 2026 guide, I’ll show you exactly how to map your sensors in Home Assistant, why it’s more powerful than ever, and how to leverage it for truly proactive automations.
Why Map Your Home Assistant Sensors in 2026?
Far from being a niche feature, the ability to map Home Assistant sensors has become a cornerstone of advanced automation. Forget thinking only about door or window sensors. The real power lies in giving geographical context to entities that don’t have it by default.
Imagine these game-changing scenarios:
- Dynamic Points of Interest: Integrations for gas prices or EV charging stations feed you valuable data. By geolocating them, you can glance at a map and instantly see the cheapest or closest option relative to your current location.
- Asset & People Tracking: Mapping the device trackers of family members (always with their consent) or your car’s GPS opens up a world of possibilities. Think pre-heating the house when you’re a mile away or getting an alert if your child leaves the school’s geofence during the day.
- Context-Aware Public Data: You can map public data sensors for local air quality, bus stops, or bike-sharing stations to make smarter decisions before you even step out the door.
Bottom line: adding GPS coordinates to Home Assistant entities transforms abstract data points into actionable, intuitive visual information.
Step-by-Step Guide to Mapping Your Sensors
The process is surprisingly straightforward and breaks down into three key phases: getting the coordinates, creating a new sensor that includes them, and finally, visualizing it all on a map.
Step 1: Identify the Sensor to Map
First, decide which entity you want to put on the map. For this example, we’ll use a sensor that reports the price of gas at a specific station, pulled in via an integration. The original entity (e.g., sensor.downtown_shell_price) only contains the price, but we’re about to give it a physical address.
Step 2: Get the GPS Coordinates (Latitude & Longitude)
To place anything on a map, you need its exact coordinates. You’ve got several free and easy options:
- Google Maps: The most common method. Search for the location, right-click the exact spot on the map, and the coordinates (latitude and longitude) will appear for you to copy.
- OpenStreetMap: A fantastic open-source alternative, perfectly aligned with the Home Assistant philosophy. The process is similar: find the location, right-click, select “Show Address,” and you’ll get the coordinates.
Jot down both the latitude and longitude values; you’ll need them for the next step.
Step 3: Create the Geolocated Sensor in Home Assistant
This is where the magic happens. We’re going to create a brand new template sensor that piggybacks off the original, but adds the coordinates as attributes. Heads up: since the updates in late 2025, the modern way to define template sensors has changed. If you’re coming from an older setup, it’s critical to update your code to avoid errors.
The new syntax is cleaner and is defined under the `template:` key in your `configuration.yaml` file (or a separate file if you use `!include`). This modern method completely replaces the old, now-deprecated `platform: template` configuration.
The Updated 2026 Code
Here’s the YAML you’ll need. Remember to edit this in your preferred file editor, like the Visual Studio Code add-on or the built-in Home Assistant editor.
The Sensor Code (Modern Syntax)
Add the following block to your `configuration.yaml` file. This code creates new sensors that copy the state of your original sensors (the price) and bolts on the latitude and longitude attributes.
template:
- sensor:
- name: "Downtown Shell Regular"
state: "{{ states('sensor.downtown_shell_price') }}"
unique_id: downtown_shell_regular_geolocated # A unique ID for your sensor
attributes:
latitude: 34.052235
longitude: -118.243683
- name: "Crossroads Chevron Unleaded"
state: "{{ states('sensor.crossroads_chevron_price') }}"
unique_id: crossroads_chevron_unleaded_geolocated
attributes:
latitude: 34.060001
longitude: -118.259995The Map Card Code
Once you’ve saved your changes and restarted Home Assistant, your new geolocated sensors will be available. Now you can display them using the native Map Card.
In your dashboard, add a new card and paste the following into the YAML editor:
type: map
title: Local Gas Prices
default_zoom: 12
entities:
- entity: sensor.downtown_shell_regular
label_mode: state
- entity: sensor.crossroads_chevron_unleaded
label_mode: statePro-Tip: The `label_mode: state` option is a killer feature. It displays the sensor’s current state (in this case, the gas price) directly on top of its map icon.
Taking Geolocation to the Next Level: Advanced Automations
Seeing sensors on a map is great, but the real power of location-based automation is unleashed when you build intelligent rules. Here are a few ideas to get you started:
- Smart Commute Fuel-Up: Create an automation that, when you leave for work in the morning, checks the prices of the gas stations on your route and sends a notification telling you which one is cheapest.
- Smarter Welcome Home: Use your car’s or phone’s location. When you enter your “home” zone, Home Assistant can turn on the porch lights, adjust the thermostat, and open the garage door.
- Proximity Alerts: Set up an automation to notify you when a family member is arriving home, perfect for getting dinner started or just knowing when to expect them.
Feature Summary Table
| Feature | Description |
|---|---|
| Sensor Types | Any Home Assistant entity that can benefit from location context: prices, air quality, vehicles, people, public transit, etc. |
| Coordinate Sourcing | Latitude and longitude obtained from free tools like Google Maps or OpenStreetMap. |
| Home Assistant Integration | Done by creating a new `template` sensor using the modern 2026 syntax. |
| Visualization | Handled by the native Home Assistant Map Card, which is customizable with zoom levels, entities, and labels. |
| Automation Potential | Extremely high. Enables rules based on proximity, zone entry/exit, and comparison of data between geographic points. |
Conclusion
Geolocating sensors has graduated from a novelty to a fundamental tool in Home Assistant. It provides a layer of contextual intelligence that massively enriches your data visualization and, more importantly, empowers you to build a smart home that reacts not just to what’s happening within its walls, but to the world outside. I highly encourage you to start experimenting—it’s time to put your data on the map!
