nathan-gs / ha-map-card

A Map Card for Home Assistant
https://community.home-assistant.io/t/map-card-a-slightly-improved-map-card/693088
MIT License
30 stars 9 forks source link

Bug: History not visible #54

Closed prigorus closed 3 months ago

prigorus commented 3 months ago

I had history working in version 0.12.0. This is the first time that history stared working for me. I weren't able to see it before with the same configuration. I updated my map card to v1.0.1 and now the history is also gone. I then reverted to the version I had before, uploaded the JS I has a backup form v0.12.0, uninstalled it completely, reinstalled it, reloaded HA a bunch of times and still nothing.

Could you please tell me how I can debug this to help find where is the problem is? I had also quite some time problems that the entity icon was not visible until I refreshed my browser. This now works fine with all version from 0.12.0 but the history track is somehow gone. I also tested on multiple browsers and devices.

And thank you for this card. It's exactly what I was missing from the stock map card. I really hope I can get it to show history.

nathan-gs commented 3 months ago

Add debug: true (top level), and look at your browser console. See if there are any errors.

Also HA aggressively caches all JS resources, so good to refresh your page a couple of times (and to add the version number to the url in resources, so that it's recognized as a new file).

Thx

nathan-gs commented 3 months ago

And maybe share your yaml + HA version.

prigorus commented 3 months ago

How can I add the version number in the dasboard URL? This is my current source: /hacsfiles/ha-map-card/map-card.js?hacstag=734825457101

I am on HA v2024.5.5

This is my current configuration:

debug: true
type: custom:map-card
zoom: 19
card_size: 8
tile_layer_url: >-
  https://api.maptiler.com/tiles/xxxxxxxxxxxx/{z}/{x}/{y}.png?key=xxxxxxxxxxxx
tile_layer_options:
  maxZoom: 24
entities:
  - entity: device_tracker.openmower_position
    display: icon
    size: 20
    history_start: 24 hours ago
    history_show_dots: false
    history_line_color: orange

This is the debug output:

map-card.js?hacstag=734825457101:14568 [HaMapCard] First Render with Map object, resetting size.
map-card.js?hacstag=734825457101:14568 [HaMapCard] [MarkerEntity] Creating marker for device_tracker.openmower_position with display mode icon
map-card.js?hacstag=734825457101:14568 [HaMapCard] History config for: device_tracker.openmower_position
- Start: fixed date Wed Jun 05 2024 13:58:14 GMT+0200 (Srednjeevropski poletni čas)
- End: fixed date now
nathan-gs commented 3 months ago

How can I add the version number in the dasboard URL? This is my current source: /hacsfiles/ha-map-card/map-card.js?hacstag=734825457101

HACS already adds it, so indeed you have the latest.

Do you see any error in your logs? I see the correct History is retrieved. History retrieval is asynchronous, we subscribe to it and then HA sends us back the positions. I've noticed if your HA is relatively slow or you have issues with websockets (eg. if you have a proxy in-between) it might go slow.

Do you see any other error in the console?

wjcloudy commented 3 months ago

Having this same issue in 1.0.1... (was working before in 0.12.0)

prigorus commented 3 months ago

Here is the the complete debug output without the map added on an empty dashboard:

no_map without_map

An here is the output with the map:

map with_map

Please let me know if this helps in any way or if I can check anything further to help. Loading the history, when it was working was quite fast even for 24 hours.

nathan-gs commented 3 months ago

In v1.0.2 I added an extra logging statement, can you look for: [HaMapCard] [HaHistoryService]: received new msg for entity id: (it's repeated a lot when receiving new messages)

dpl73 commented 3 months ago

Just a quick observation, history track works for me in Edge (Android) and Hass App (Android). Does NOT work on Chrome (Windows or Android). Initially also worked on Edge (Windows), but after inital view, no longer displays track.

thybag commented 3 months ago

Only just seen this, but think i may have inadvertently fixed this bug as part of https://github.com/nathan-gs/ha-map-card/pull/55. I believe the issue is down to having only a histroy_start set, as my logic didn't correctly account for history_end being null, which resulted in the history setup not firing correctly.

nathan-gs commented 3 months ago

Based on @thybag PR #55 will create a new release 1.1.0 (preview options) which hopefully contains the fix!

nathan-gs commented 3 months ago

Release v1.1.0 is out, I hope this fixes it. If not, definitely take a look at the console and see if you see [HaMapCard] [HaHistoryService]: received new msg for entity id:

wjcloudy commented 3 months ago

Working for me now, thankyou!

prigorus commented 3 months ago

Also works for me. Thank you for your effort!!