Map-card: a slightly improved map-card

It is possible to use this map-card to create something like a Geochron world map that shows the path of light/dark on the planet at a given time?

I would love to set some pins on the map that also shows the local time at that location as well, like this World Clock example

Here’s another example - Day and Night World Map

Probably using the wrong config, but I would like to keep the map center on home coordinates and only adjust zoom level when enities are on the move.

focus_follow refocus & contains both move the card view, not only the zoom.

type: custom:map-card
tile_layer_url: https://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png
card_size: 24
zoom: 14
x: 51.5
"y": 4.9
entities:
  - entity: person.johan
    size: 60
    color: "#73C6B6"
  - entity: person.2
    size: 60
    color: "#FCD34D"
  - entity: person.3
    size: 60
    color: "#6FA3EF"
  - entity: person.4
    size: 60
    color: "#F9A8D4"
grid_options:
  columns: full

@Johan_L not possible at this time, can you create a ticket (and even better a pull request) on Github?

1 Like

I’ve added this for my automower… Somehow, with Google or another one I tried (arcgisonline) the satellite images are completely washed out.
here’s my code :

type: custom:map-card
entities:
  - entity: device_tracker.mower
    display: icon
    icon: mdi:robot-mower-outline
    color: grey
    size: 26
    history_start: 24 hours ago
    history_line_color: rgb(153,0,0)
tile_layer_url: https://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}
tile_layer_options:
  attribution: Google Satellite
  maxZoom: 19
  minZoom: 0

And this is what I get :

If I chose roads, terrain or anything without satellite images, it looks normal. Is there a parameter I’m missing?
Thanks!
H.

1 Like

Update for my issue…
I downgraded through HACS, starting with version 1.0.0 and… it worked, the map’s colours are no longer inverted (turns out they were not just washed out, but negative).
So I upgraded from there and it worked only until version 1.2.0. After that, I had a negative map. I still tried all subsequent versions, but no luck.
Here’s with version 1.2.0 :

Unfortunately, some options are not available 1.2.0.
Any Idea what changed then, and if it could be brought back?
Thanks.
H.

-Edit to add that I am now using Swisstopo satellite imagery, but it gives the same result with google satellite.

The next version after 1.2 introduces dark mode which is described as:

theme_mode: auto/dark/light can be configured.
Both map and icons swap to darkmode when mode is dark or auto & HA reports its theme is dark.

The theme_mode option is auto by default. Perhaps you should try:
theme_mode: light

When I try:
theme_mode: dark

my map looks like a negative similarly to the image in your previous post…

2 Likes

I’m using Card Mod to fix this issue:

card_mod:
  style: |
    ha-card #map.dark {
    --map-filter: invert(0);
    }

This is… strange?
But it works, thank you kind stranger!

@Rembock : I haven’t tried your solution as the other one seems to work with just one parameter. But thank you for your help.

1 Like

I could not find a solution to my scenario, so please let me know if I have missed something.
I am trying to use this map card - amazing one, by the way - but I have an specific scenario where I have to use the config-template-card to handle my entities name dynamically.
When using the card and the energy-date-selection it works properly, but when adding then in a config-template-card the history line stops working.

Is there anyway - except getting rid of config-template-card - to make it work?

type: custom:config-template-card
entities:
  - device_tracker.my_device
card:
  type: grid
  square: false
  cards:
    - type: custom:map-card
      history_date_selection: true
      entities:
        - entity: device_tracker.my_device
      card_mod:
        style: |
          ha-card {
            margin-top: -10px;
          }
          ha-card #map {
            height:calc(100vh - 56px);
            border-radius:0;
          }
    - type: energy-date-selection
      card_mod:
        style: |
          ha-card {
                z-index: 1;
                position: absolute;
                height: 80px !important;
                width: 80%;
                top: 75px;
                right: 10px;
                max-width: 450px;
          }
  columns: 1

Left side: using config-template-card
Right side: not using config-template-card

CTC has no idea about a period defined in energy-date-selection.
Suggest to close the issue you opened in github.
Could be a FR for CTC…

The situation might not be related to the config-template-card itself.
Even when not using a energy-date-selection card but just “history_start” option, it doesn’t work as well.
So there is a compatibility issue between them related to the history line display.

type: custom:config-template-card
entities:
  - device_tracker.my_device
card:
    type: custom:map-card
    entities:
      - entity: device_tracker.my_device
        history_start: 30 hours ago
1 Like

Very useful discovery. Please update the ticket in github for CTC. Will check it.

I am using custom:card-templater with the map-card with success. Have you tried it instead?

card-templater

1 Like

Visible tiles are loaded (with a bit of a wider margin around), the heavy lifting is done by leaflet.

Is it possible to change the white background of the map marker icon to transparent?
And to remove the border of the icon?

I am using bits / pieces for my gtfs integration…
Vehicle positions vingerha/gtfs2 Wiki

1 Like

Does this only work for seperate svg files or also when i use mdi: icons?

Thanks my friend: this work around worked for me too !

This is my configuration :

type: custom:map-card
card_size: 12
zoom: 12
maxZoom: 20
focus_entity: device_tracker.gps_tracker_auto
follow_focus: refocus
history_date_selection: true
entities:
  - entity: device_tracker.gps_tracker_auto
    size: 40
    color: purple
    history_show_dots: false
    gradual_opacity: 1.4
    display: icon
    history_line_color: purple
    history_start: input_datetime.tijdstip_gps_tracker_start
    history_end: input_datetime.tijdstip_gps_tracker_einde

Let say I did a selection of 2 days :

No problem, I get the history of these 2 days.

Now I change the start date to 5/18/2025 (so I only want the history of today). When I refresh my browser (F5), all the history disappears. I need to go to another dashboard (or edit the dashboard) to get my history back.

Is this normal and can I avoid that ? It would be nice if the map was updated automatically each time I change the period…

Are you sure you can use input_date helpers here? Is it described in docs?