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
19 stars 4 forks source link

[FR] History/displaying a path #8

Closed ildar170975 closed 1 month ago

ildar170975 commented 3 months ago

A stock map card allows to show a path if hours_to_show option is defined:

e413903372ef34b32411791f0f73d074708e3ea6

Also, it possible to see a time of a particular point in a tooltip:

изображение

Would be great to have these features in this custom card. Otherwise this card may only be used to see a current position only.

aaamoeder commented 2 months ago

Came here looking for this! that would be amazing ! thank you 😄

alexreddy78 commented 2 months ago

Dear Nathan,

Any updates on this? Map is fantastic, very good detailed alternative to default one.

nathan-gs commented 2 months ago

Definitely doable, only need to find the time.

dpl73 commented 2 months ago

The asthetic of the map displayed in your card is like night and day as compared to the stock HA map display. But I would also love to see the hours_to_show functionality. Just wish I had the skill set to contribute.

prigorus commented 2 months ago

I would also kindly ask for adding the path/hours to show option. And a donate button. :)

totalitarian commented 2 months ago

Love this map. Hope to see this feature soon.

nathan-gs commented 2 months ago

I've been looking at it this evening, and also trying to understand how HA does it. It's not a 100% straightforward to get the history. Unfortunately I cannot directly extend the frontend (that would be great).

The main code in HA is in this file: https://github.com/home-assistant/frontend/blob/master/src/panels/lovelace/cards/hui-map-card.ts

nathan-gs commented 2 months ago

Looks like the only way to get the history, is using the callWs function, similar to: https://github.com/home-assistant/frontend/blob/master/src/data/history.ts#L102

nathan-gs commented 2 months ago

From a config point of view I'm thinking of using a more flexible approach then hours_to_show. I was thinking per entity to have an option like: startTime and endTime which would accept a full datetime, but also a relative statement like 2 hours ago & now.

WDYT?

aaamoeder commented 2 months ago

That sounds awesome 👍 thanks for taking the time to implement this 😉

nathan-gs commented 1 month ago

I started development and figured out to retrieve the history from HA, next up plotting this on a map. Getting closer!

nathan-gs commented 1 month ago

In v0.7.0 a basic version of the history is implemented, see the readme on how to use. It does have some missing functionality (eg. line opacity) compared to the stock HA Map.

alexreddy78 commented 1 month ago

In v0.7.0 a basic version of the history is implemented, see the readme on how to use. It does have some missing functionality (eg. line opacity) compared to the stock HA Map.

That's Fantastic! Did try! Thanks a lot!

PS If there is a chance to get auto switch to dark mode theme, as in standard Map?

ildar170975 commented 1 month ago

@nathan-gs Thanks a lot for the feature. Noticed that sometimes a track is not shown; may be shown after F5.

Also, in Docs it it specified: изображение and imho these __2022-03-01T12:00:00Z__ & __now__ are not clear. I used these - and this seems to work:

    history_start: 7 hours ago
    history_end: now

May be this point should be better explained in Docs - at least w/o these "underscores".

Also it is possible to define

    history_end: 2 hours ago

and I would suggest to reflect this in Docs too.

Also, noticed that history_line_color can defined as red, rgb(255,0,0), rgba(255,0,0,0.1), #ff0000, var(--green-color) - this is SUPER cool and should be mentioned on Docs.

Hiekkaharju commented 1 month ago

Thank you very much for this ! Now I can get rid of a duplicate stock maps that existed only because of the history feature. Any chance to get an option to turn off the history point "dots" and keep only the line in between? When moving in a small area, the dots fill the area rather rapidly.

ildar170975 commented 1 month ago

@alexreddy78

If there is a chance to get auto switch to dark mode theme, as in standard Map?

Suggest not to mix different features & register a separate FR.

ildar170975 commented 1 month ago

@Hiekkaharju

Any chance to get an option to turn off the history point "dots" and keep only the line in between?

Suggest to register a separate FR.