custom-cards / entity-attributes-card

Entity Attributes
Apache License 2.0
68 stars 12 forks source link

[Feature request] Add formatting option for keys of type date/time #22

Open bcutter opened 2 years ago

bcutter commented 2 years ago

Problem: Currently keys are "just" shown plain as they are in the database.

This leads to very uncomfortable reading as well as wrong values (because the timezone is not considered!) when it comes to dates/times.

Example:

type: conditional
conditions:
  - entity: sensor.dwd_wetterwarnung_current_warning_level
    state_not: '0'
card:
  type: custom:entity-attributes-card
  title: ❗ Wetterwarnung ❗
  heading_name: ' '
  heading_state: 'Aktuelle Warnung(en):'
  filter:
    include:
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_1_name
        name: ▶
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_1_headline
        name: ' '
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_1_description
        name: ' '
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_1_start
        name: 'Von:'
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_1_end
        name: 'Bis:'
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_2_name
        name: ▶
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_2_headline
        name: ' '
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_2_description
        name: ' '
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_2_start
        name: 'Von:'
      - key: sensor.dwd_wetterwarnung_current_warning_level.warning_2_end
        name: 'Bis:'

Very hard to read: grafik

Proposal: Add out of the box formatting option for keys to handle the way date/time keys are shown.

Implementation example: See https://github.com/benct/lovelace-multiple-entity-row#formatting which is able to create perfectly readable output grafik

bcutter commented 2 years ago

What do you think about this @iantrich ?