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] Add a possibility to show states #17

Closed ildar170975 closed 1 month ago

ildar170975 commented 2 months ago

The stock map card allows to see a state instead of some icon/avatar: image

This allows to see values like: image

Would be great to have a similar option in this card as well.

ildar170975 commented 2 months ago

An additional request: please provide ways to avoid this misaligned look: image

nathan-gs commented 1 month ago

Fixed in v0.8.0

Unfortunately the misaligned look cannot directly be fixed, because the ha-entity-marker is used to display (and this one has a fixed width & height + font size).

ildar170975 commented 1 month ago

For a stock map card I managed to fix alignment by

.marker:not(:has(.entity-picture)) {
      text-align: center;}

in an external js-file.

nathan-gs commented 1 month ago

Added the CSS in the latest release, however I don't think it's working due to how the Web Containers work.

ildar170975 commented 1 month ago

Thanks a lot for the feature!

Unfortunately, do not see a state. 0.8.2 Here is a stock map card:

type: map
entities:
  - entity: sensor.narodmon_eee_radiation
    label_mode: state

изображение

Here is a ha-map-card:

type: custom:map-card
entities:
  - entity: sensor.narodmon_eee_radiation

изображение

But this does not show a marker at all:

type: custom:map-card
entities:
  - entity: sensor.narodmon_eee_radiation
     display: state

Zoomed out for security reasons: изображение

F5, waiting - do not help. Interesting that while I was editing in HA Editor - a state was shown! It happened once, could not reproduce.

ildar170975 commented 1 month ago

Also please consider these cases:

nathan-gs commented 1 month ago

Also please consider these cases:

* entity is unknown - may be then we should not see the marker

* entity is unavailable - some "wrong" label should be shown instead of long "unavailable"; this "label" should be clear for any languages; may be just "long dash" (w/o UoM)?

We can only display entities with a latitude/longitude attributes. Unknown entities likely do not have these. Might be inspiration for a new feature though!

P.s. I added more debug logging and also spotted a minor debug where the market kept getting recreated.

ildar170975 commented 1 month ago

We can only display entities with a latitude/longitude attributes. Unknown entities likely do not have these. Might be inspiration for a new feature though!

Oh. Of course ))) My bad. Probably an unavailable entity will not have coords too.

nathan-gs commented 1 month ago

Thanks a lot for the feature!

Unfortunately, do not see a state. 0.8.2 Here is a stock map card:

type: map
entities:
  - entity: sensor.narodmon_eee_radiation
    label_mode: state

изображение

Here is a ha-map-card:

type: custom:map-card
entities:
  - entity: sensor.narodmon_eee_radiation

изображение

But this does not show a marker at all:

type: custom:map-card
entities:
  - entity: sensor.narodmon_eee_radiation
     display: state

Zoomed out for security reasons: изображение

F5, waiting - do not help. Interesting that while I was editing in HA Editor - a state was shown! It happened once, could not reproduce.

32