Map card: force the home as the center

Hi, I need help with the map card (yes I read the doc but it’s succinct)

The following code will display a card centered on my home when there are no lightning strikes and center on the lightning strikes when there are some. How can I force my home as the center?

type: map
entities:
  - entity: zone.home
geo_location_sources:
  - blitzortung
default_zoom: 9
theme_mode: auto

Somehow, I had missed fit_zones, which is a step forward.

It’s still not exactly what I wanted because it will always fit my home and all lightning strikes (i.e. ignore zoom-levels higher than 7 in my current example). What I’d really want is to see my home and a radius of 50 km, even if there are lightning strikes 80 km away.

There is a focus variable that does exactly what I want but it applies to entities, not geo_location_sources as far as I understand:

image

I think this is a good idea and I’ve written a PR to add a focus option for geo_location_sources. You can follow the pull for status updates on when it might be available.

https://github.com/home-assistant/frontend/pull/22535

2 Likes

@karwosts Great!

And to be clear, there is no other way to achieve this? It would be nice to be able to define the latitude and longitude (if you want to center the map on an area for which no zone is defined)

If you are not interested in the lightning more than 50km away, then you can filter the blitzortung geo zones to the ones you want. It has a default radius of 100km, but it can be set to 50 from the configuration.

No don’t think map card defines any such option for defining an explicit view rectangle.

I kinda explained why that doesn’t work in my second post: I’ve got two locations (with two Blitzortung services) and there might be thunder at both. In that case, the cards is zoomed out.

Plus you might want to show the LS nearby but still track them 100 km away (and pan the map).

If you ever feel like writing another PR…

I would say - the “focus” option is more needed for a ZONE entity.
For instance, a user may want to show a zone in a center.
And there is my issue on GitHub about this functionality - and it seems to be ignored.

The focus option works the other way around: it’s true by default (for entities and geo_location_sources).

If you want to focus on a zone, you need focus: false the geo_location_sources, which is not possible without @karwosts ’ PR

My request is absolutely not related to geo_location_sources.

Not for zones.

Merged for next release

1 Like