You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4cf62a7
Browse filesBrowse the repository at this point in the historyBrowse files
Add display: pill — zone icon + initials marker (#213)
Opt-in entity display mode. When a person/device_tracker is inside a HA zone,
render the marker as a stadium pill with the zone icon + the entity's initials;
fall back to the normal initials marker otherwise.
Fixes the overlap decision vs #196 by keeping pill as a dedicated display mode.
| `display` | `marker` | `icon`, `state`, `attribute`or `marker`. <br/>`marker` will display the picture if available. <br/>`icon` will display the icon if available, otherwise a label composed of first letters of the entity's name |
102
+
| `display` | `marker` | `icon`, `state`, `attribute`, `marker` or `pill`. <br/>`marker` will display the picture if available. <br/>`icon` will display the icon if available, otherwise a label composed of first letters of the entity's name. <br/>`pill` shows the entity's **current zone icon + its initials** together when it is inside a Home Assistant zone, and the normal initials marker otherwise. See [Place pill](#place-pill-display-pill). |
103
103
| `picture` | | Set a custom picture to use on the marker. |
104
104
| `icon` | | Set a custom icon to use if `display` is set to `icon`. e.g. `mdi:cake` |
105
105
| `label` | | Set a custom text label to display on the marker (overrides auto-generated initials). Works with picture overlays. |
@@ -124,9 +124,96 @@ Either the name of the `entity` or:
124
124
| `z_index_offset` | 1 | z-index value that determines what is displayed on top when markers overlap. (Setting a gap of at least 20 between the values assigned to each entity is recommended.) |
125
125
| `use_base_entity_only` | false | When set to `true`, the tracking will use only the base entity without including any associated device trackers. This is useful for scenarios where you want to track the base entity directly and ignore any associated trackers. |
126
126
| `position_update_threshold` | 10 | Distance threshold in meters. Marker position only updates if the entity has moved more than this distance. Prevents unnecessary map updates from GPS drift. Useful for clustered markers. |
127
+
| `pill_callout_min_zoom` | 15 | Only for `display: pill`. Map zoom at/above which the pill is drawn as an offset callout (up-left of the point, with a thin leader line to a dot on the exact location). Below this zoom the pill simply centres on the point with no leader, so it isn't obtrusive when the whole region is in view. |
127
128
| `circle` | | Display a circle around the marker. <br/>More details [Circle options](#circle-options) |
128
129
| `geojson` | | Display GeoJSON data from an entity attribute. <br/>More details [GeoJSON options](#geojson-options) |
129
130
131
+
### Place pill (`display: pill`)
132
+
133
+
A `pill` marker answers "who is where" in a single glance. When a tracked entity
134
+
is inside a Home Assistant zone, its marker is drawn as a small stadium ("pill")
135
+
holding two circles: the **zone's icon** on the left and the entity's **initials**
136
+
on the right — for example a church icon next to `ML`, or a home icon next to
137
+
`MG`. When the entity is not in any zone it falls back to the normal initials
138
+
marker. It is opt-in per entity and changes nothing for entities that don't set
139
+
`display: pill`.
140
+
141
+
#### Why
142
+
143
+
With the stock marker you can see *that* someone is on the map, but to learn
144
+
*which named place* they're at you have to recognise the spot or click through.
145
+
And when a person sits on top of their home/zone, you either get two overlapping
146
+
markers or a cluster bubble showing a count. The pill folds identity and place
147
+
into one marker — "Mom is at the church" is readable without interaction — using
148
+
data Home Assistant already has (zones + the entity's state).
149
+
150
+
#### How it resolves the person and the place
151
+
152
+
There is no extra configuration linking a person to a place; it is derived live:
153
+
154
+
1. **The entity is the person.** You list a `person.*` or `device_tracker.*` on
155
+
the map as usual. The card already places it at its GPS position and derives
156
+
its **initials** from the entity's `friendly_name` (first letter of each word,
157
+
e.g. `Mom Location` → `ML`). `label:` still overrides the initials if set.
158
+
2. **Zones are the named places.** Each HA `zone.*` has a `friendly_name`, an
159
+
`icon`, a latitude/longitude and a radius. These already exist whenever you
160
+
create a zone (Settings → Areas & Zones).
161
+
3. **Home Assistant links them via state.** When a `device_tracker`/`person` is
162
+
inside a zone, HA sets that entity's **state to the zone's name** (the Home
163
+
zone reports `home`). This is the join between person and place, maintained by
164
+
HA core — the card doesn't compute geometry.
165
+
4. **The card reads it back.** For a `pill` entity it takes the entity's raw
166
+
state, finds the `zone.*` whose `friendly_name` matches it (case-insensitive;
167
+
`home` → the Home zone), and uses that zone's `icon` for the left circle. If
168
+
the state is `not_home`/`away`/unknown — or matches no zone — there is no
169
+
place, so the normal initials marker is shown instead.
170
+
5. **Tooltip.** Hovering shows `<person> is at <place>`, e.g. *Mom is at
171
+
Extended Family*. The person name is the entity's `friendly_name` with a
172
+
trailing `Location`/`Tracker`/`Device`/`Phone`/`GPS` stripped, so
173
+
`Mom Location` reads as `Mom`. (This uses a Leaflet tooltip, which opens
174
+
immediately, rather than the browser's delayed native `title`.)
175
+
176
+
The marker is rebuilt automatically when the entity enters or leaves a zone, so
177
+
the pill appears, swaps icon, or collapses to initials as the person moves.
178
+
179
+
#### Zoom-aware callout
180
+
181
+
At/above `pill_callout_min_zoom` (default `15`) the pill is offset up-and-left of
182
+
the exact position and connected by a thin **leader line** to a small dot on the
183
+
real location, so the pill doesn't cover what's underneath. Below that zoom — when
184
+
the whole town or region is in view and a leader line would just be clutter — the
185
+
pill simply centres on the point with no leader. Set `pill_callout_min_zoom` lower
186
+
to engage the callout sooner, or very high to effectively disable it.
187
+
188
+
#### Appearance
189
+
190
+
The pill reuses the entity's existing `color` (the same per-entity colour the
191
+
normal marker uses, or whatever you set with `color:`) for the outline, icon,
192
+
initials and leader, and `size` for each circle. Dark mode is honoured.
193
+
194
+
#### Requirements
195
+
196
+
- The places must be real HA **zones** with an `icon` and a `friendly_name`
197
+
(icons like `mdi:home`, `mdi:church`, `mdi:account-group`).
198
+
- The entity must report its zone in its **state** — GPS `device_tracker`s and
199
+
`person`s do this automatically; the Home zone reports `home`.
200
+
201
+
#### Example
202
+
203
+
```yaml
204
+
type: custom:map-card
205
+
entities:
206
+
- entity: device_tracker.mom_location
207
+
display: pill
208
+
- entity: person.matt
209
+
display: pill
210
+
pill_callout_min_zoom: 14 # show the offset callout a bit sooner
211
+
```
212
+
213
+
With `device_tracker.mom_location` in the *Extended Family* zone this renders a
214
+
pill of `mdi:account-group` + `ML`, tooltip "Mom is at Extended Family"; when she
215
+
leaves it becomes a plain `ML` marker.
216
+
130
217
### History options
131
218
132
219
If `history_date_selection:true`, any entities that do not define their own `history_start` and `history_end` configuration will be automatically linked to this. Please ensure a card of `type: energy-date-selection` exists on the page before enabling this.
0 commit comments