Map is reseting to default position when actively panned or zoomed
Checklist
- [X] I have updated to the latest available Home Assistant version.
- [X] I have cleared the cache of my browser.
- [X] I have tried a different browser to see if it is related to my browser.
Describe the issue you are experiencing
When using /map, it's almost impossible to zoom in some areas and follow persons because each time there is a location update, from any device on the map, it will be reset to default position and default zoom. By "default", I mean the calculated view to show all the devices (which is a bit too wide by the way, from my point of view).
This reset is very annoying if the different persons tracked are far appart. The map will always dezoom when the user does not expect it to show all the devices on the map while he/she was focused on some part of the map.
This behavior is even worse when one of the device tracked is in "High Accuracy" mode with short intervals between updates.
Describe the behavior you expected
When user interaction occurs with the map (panning / zooming), the map should not reset its zoom and position, until the next page load. Bonus point: Provide a "Reset view" button.
Steps to reproduce the issue
- Go to https:/xx/map
- Zoom on an area
- Wait or trigger a location update
- The original position of the map is restored to show all the tracked devices at the same time
What version of Home Assistant Core has the issue?
2023.5.4
What was the last working version of Home Assistant Core?
No response
In which browser are you experiencing the issue with?
No response
Which operating system are you using to run this browser?
No response
State of relevant entities
No response
Problem-relevant frontend configuration
No response
Javascript errors shown in your browser console/inspector
No response
Additional information
No response
This is due to the the autoFit option here:
https://github.com/home-assistant/frontend/blob/dev/src/panels/map/ha-panel-map.ts#L41
I'm not sure whether on or off for this is more appropriate default for map panel.
I will say you could consider on your end just creating a Panel/1-Card dashboard with a map card, and then you could disable this feature (and get your reset view button).
Perhaps autoFit should follow moving entities until user interacts with the map, and then stop updating, but that's a bigger feature request than just turning it on/off for the map panel.
I will say you could consider on your end just creating a Panel/1-Card dashboard with a map card, and then you could disable this feature (and get your reset view button).
Good to know that you can set autoFit on the map card, I see it's false by default. I already have a panel (sidebar) with a map card. What I miss on the map card is the fact that zones are not displayed. So my need is to track people on the map with zones without having it to unexpectedly update. Maybe I can also request for zone display on the map card. I'd be happy with that.
Perhaps autoFit should follow moving entities until user interacts with the map, and then stop updating
That's my request. Stop updating the view when the user is focusing on a specific zone. ~~Maybe it's also reseting while editing the zones, I did not try that but it would be a nightmare.~~ <- Not the case.
You can add and render zones in a map card, you just add their zone.xxx entities to the list of entities to be displayed.
I don't know how I missed that! 🤯 Thank you!
FYI I did take a look for a bit at turning off the autofit when user pans/zooms the map, but it was a bit difficult because leaflet does not really easily allow to distinguish between move initiated by user and move from the maps internal autofit routine.
I tried a couple approaches to figure out how to distinguish them but ultimately didn't find anything that worked well. So maybe someone will pick that up at some point but it was a bit tricky.
Thank you the time you put into this anyway, looking for the root cause and a possible solution, it's appreciated.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
I still think it's a usability issue.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
keep
Is there any way how can this be fixed? The same problem is with a map of any person (i.e. when I open a person card) and in the person card it wasn't happening before, it was not autozoomed and centered, last time I checked was maybe 6 months ago, but now autozoom and centering is also done there...
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Is it possible to simply grab the current pan/zoom before the refresh and apply it when re-rendering on the following refresh? I'm having this issue with the map page from the sidebar where as soon as I start to zoom it the map updates and zooms back out.
I've asked in the past. Many people have. It is never even considered. I gave up using the map.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
Issue persists in 2024.6.
Issue still there (and annoying) in 2024.8.3
ALSO, it is doing the position reset to me when I'm editing the map as well (which is what brought me here). Doing the editing by logging into Nabu Casa and engaging in a remote session with my Home Assistant. Need to edit some locations, and the view keeps jumping around. This is nuts.
Please add thumbs up to the original post so it could help it to gain visibility.
- vote for disable autoFit map option especialy we have separate button to fit objects onto map at any time
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
it's still not fixed
What use is the map if we can't zoom in far enough to see where entities are? I've got a Tesla integration that updates it every second or two and it's completely unusable.
The zoom reset on update makes this completely unusable if one of our vehicles is interstate and I want to look at precisely where one of them is...
Added my vote to have an option to stop the auto fit on refresh.
Still an issue on 2025.3.4. I'm unable to view and edit zones since the map keeps snapping back to my location.
Can confirm this still happens on 2025.5
I also second and confirm it! This reset focus with update is making it very hard / next to useless. Please fix!
This has made the map feature unusable for me for years. I would like to see this fixed as a map would be useful for tracking entities instead of pasting their coordinates into Google maps since I can't zoom in.
I don't understand why nobody seems to care about this specific issue...