frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Map card does not show up in main view of the sidebar view type

Open Mincka opened this issue 2 years ago • 25 comments

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

I use a panel (not the default_view) with the "Side bar" view type. If I add a map card in the main (left) area, it will not appear on browser refresh. I need to go on another dashboard first, then go back to the panel with the map card and then it appears. I thought it was fixed in #11834 but it's not. As leave this reference in case that could be somehow related.

If a map card is present in the default_view panel of the dashboard, it will work for it and other panels, configured as side bar view or not. Thanks oalbaf for this clarification.

Workaround

See this temporary workaround.

Describe the behavior you expected

The map card shows up on browser reload like other cards.

Steps to reproduce the issue

  1. Create a new panel
  2. Set it to Side bar View Type
  3. Add a map card in the main area
  4. Click done
  5. CTRL+R
  6. The map card does not appear
  7. Switch to another Dashboard
  8. Go back to the panel with the map card
  9. The map card appears as expected
  - theme: Backend-selected
    title: Test Panel
    path: p
    type: sidebar
    badges: []
    cards:
      - type: map
        entities:
          - device_tracker.telephone_julien
          - device_tracker.telephone_morgane

What version of Home Assistant Core has the issue?

2022.3

What was the last working version of Home Assistant Core?

2022.2

In which browser are you experiencing the issue with?

Edge Version 99.0.1150.36 (Official build) (64-bit)

Which operating system are you using to run this browser?

Windows 10 19043.1586

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

None

Additional information

No response

Mincka avatar Mar 12 '22 11:03 Mincka

I tried your workaround of the map card in another panel of the same dashboard but it did not work in my case. 😔

Mincka avatar Mar 18 '22 18:03 Mincka

I have the same problem as @Mincka in a chrome browser and in the ha companion app as well. I am currently running 2022.3.3

degrashopper avatar Mar 22 '22 09:03 degrashopper

Same problem at 2023.3.6 version.

If you add a map card in default_view panel, the panel with map card in side view style will works well. But, if you have only a map card in other view side bar style panel the map card don't work.

Edit: you can create a hidden card map in default view with 100000:0.1 scale.

type: map
entities:
  - entity: device_tracker.some_device
aspect_ratio: '100000:0.1'
dark_mode: true

oalbaf avatar Mar 22 '22 11:03 oalbaf

Thanks for the aspect_ratio hack @oalbaf. It's a good enough workaround for now. 👍

Mincka avatar Mar 25 '22 09:03 Mincka

Same issue here after updating to newest version today, very frustrating

My dashboard is grid style, in a panel

The workaround does not work. If you create a new view with path default_view, make it a panel with a map, it does not make the original view work after a refresh. That is how I'm reading the workaround to be used.

uj avatar Mar 27 '22 19:03 uj

Experiencing the same issue as reported here... my config is here: https://github.com/pedrolamas/home-assistant-config/blob/master/config/lovelace/map.yaml

One thing I did notice is that if I click "..." and then select "Refresh" (available only when using YAML for lovelace), the map loads just fine, but nothing shows if I don't do this.

pedrolamas avatar Apr 04 '22 14:04 pedrolamas

Map is not displayed even in case of using a view w/o a sidebar - but with using a custom:layout-card. Select any different layout - vertical, horizontal etc - no map then. See details here: https://github.com/thomasloven/lovelace-layout-card/issues/193

ildar170975 avatar Apr 20 '22 22:04 ildar170975

For the record, I can still reproduce this issue in the latest HA 2022.5.5

pedrolamas avatar May 20 '22 14:05 pedrolamas

I'm experiencing this issue as well - the workaround suggested by @oalbaf ~does~ doesn't seem to work for me.

Edit: I'm on the following config:

Home Assistant Core 2022.6.4
Home Assistant Supervisor 2022.05.3
Home Assistant OS 8.1

Update: Turns out the workaround does not work (reliably) for me either.

QNimbus avatar Jun 08 '22 13:06 QNimbus

The workaround didn't work for me either...

@QNimbus can you (and everyone else here experiencing this problem) upvote the first post on this issue?

Not sure if the frontend devs watch that, but I guess it won't hurt anyway...

pedrolamas avatar Jun 08 '22 13:06 pedrolamas

upvote the first post on this issue?

Every new post in the thread moving the issue to the top, I think - but this change will only be noticed if a person sorts a list by "last updated".

ildar170975 avatar Jun 11 '22 21:06 ildar170975

I have the same issue. Map cards appear to be intermittent at best. core-2022.6.7 supervisor-2022.05.3 Home Assistant OS 8.2

alixjg avatar Jun 25 '22 10:06 alixjg

same issue but only in sidebar view

direx1 avatar Jun 29 '22 22:06 direx1

I have the same issue too. My dashboard is grid style in a panel.

nsuresh81 avatar Jul 05 '22 03:07 nsuresh81

@oalbaf, @uj , @ildar170975 and @nsuresh81 please add a thumbs up on the first post, this issue will gain attention more quickly. Thank you.

Mincka avatar Jul 05 '22 05:07 Mincka

Is there a solution for this? A perfectly working Map gets broken for no reason, it's frustrating and I'm not able to display the map with my entities being tracked on my kiosk.

nsuresh81 avatar Jul 23 '22 11:07 nsuresh81

Please read the first post with the workaround while waiting for a fix.

Mincka avatar Jul 23 '22 13:07 Mincka

@Mincka Yes the workaround works. It's not an elegant solution, more of a hack, but it works. For those still struggling, I used the "aspect_ratio" hack by @oalbaf to insert a hidden/dummy map in some horizontal / vertical stacks. Sample code below and you may change it as per your needs

square: true columns: 1 type: grid cards:

  • type: horizontal-stack cards:
    • type: vertical-stack cards:
      • type: map entities:
        • device_tracker.google_maps_xxxxxxxxxxxxxxxxxxxxx
        • device_tracker.google_maps_yyyyyyyyyyyyyyyyyyyyy title: Person Tracker
  • type: map entities:
    • device_tracker.google_maps_xxxxxxxxxxxxxxxxxxxxx
    • device_tracker.google_maps_yyyyyyyyyyyyyyyyyyyyy aspect_ratio: '100000:0.1'

nsuresh81 avatar Jul 23 '22 13:07 nsuresh81

@Mincka Yes the workaround works. It's not an elegant solution, more of a hack, but it works. For those still struggling, I used the "aspect_ratio" hack by @oalbaf to insert a hidden/dummy map in some horizontal / vertical stacks.

This fix is not working for me in the android companion app. Maybe the new nabu casa frontend developer could have a look at this issue 😏

degrashopper avatar Sep 12 '22 14:09 degrashopper

This bug is still there in 2022.11.0b0. And now the workaround card is visible because of the new theme. image

Mincka avatar Oct 27 '22 06:10 Mincka

Workaround also doesn't work for me. I can repro this anytime in Firefox, for example. But it also happens in other browsers, Android App, Fully Kiosk Browser, etc. Each time I edit the card, it shows up. But after a refresh, it goes away immediately.

EDIT: I am also using custom-card and latest 2022.11 version.

anthonws avatar Nov 04 '22 11:11 anthonws

Not using any workarounds - but getting this:

изображение

instead of this: изображение

ildar170975 avatar Nov 05 '22 19:11 ildar170975

I have exactly the same problem. Workaround is not working for me. I'm using bunch of custom cards. image

jonostanck avatar Nov 13 '22 16:11 jonostanck

I am having the same problem.

bakerkj avatar Dec 01 '22 02:12 bakerkj

Same here. Sometimes the map shows, other times not...

wormuths avatar Dec 18 '22 16:12 wormuths

Exact same issue here

Workaround also doesn't work for me. I can repro this anytime in Firefox, for example. But it also happens in other browsers, Android App, Fully Kiosk Browser, etc. Each time I edit the card, it shows up. But after a refresh, it goes away immediately.

EDIT: I am also using custom-card and latest 2022.11 version.

ivancristina avatar Dec 22 '22 02:12 ivancristina

Please add thumbs up on the first post and hope someone will be assigned.

Mincka avatar Dec 22 '22 08:12 Mincka

Poked around and looked at this a bit. I compared the styles between two cases where map was displayed, and map was not displayed.

The only real difference in rendered html between the two was the root div under hui-map-card had "padding-bottom: 100%" in the case where it was working, and that style was not there in the case where it was not working.

I do not yet know where that comes from, exactly what it does, or why it is there sporadically. I attempted to add this manually to the style here in hui-map-card:

https://github.com/home-assistant/frontend/blob/dev/src/panels/lovelace/cards/hui-map-card.ts#L400

  #root {
    position: relative;
    height: 100%;
    padding-bottom: 100%;
  }

I refreshed the page about 10 times after that and it seems to work every time for me, before this it was not working.

Anyone else (who has a frontend dev environment) want to test if that fixes the issue for them?

karwosts avatar Dec 22 '22 19:12 karwosts

A few more clues to add to the above. The padding-bottom seems to be derived from the aspect ratio.

If a 4:1 aspect ratio is chosen, then the padding-bottom added by the system is 25%, not 100%. It seems in some cases this is missing. If it is missing, and I add 100% to the root like in the above example, then the aspect ratio will render incorrectly (at 1:1) in the "buggy" load cases. That may be preferable to not showing at all, but it's still not a complete solution.

Need to look more at how aspect ratio is updating the padding-bottom, and why it is sometimes missing.

karwosts avatar Dec 22 '22 20:12 karwosts