home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.82k stars 2.61k forks source link

Entity card time value formatting inconsistent with other cards (Glance, Tile, Entities) #20533

Open SeanPM5 opened 3 months ago

SeanPM5 commented 3 months ago

Checklist

Describe the issue you are experiencing

Entity card displays sensors with time values (device_class: timestamp and device_class: duration) differently compared to other cards like Entities, Tile, and Glance (which are all consistent with each other). Below are these cards next to each other.

Screen Shot 2024-04-16 at 3 15 35 AM

Entity card displays that history stats sensor ( device_class: duration) in decimal time (1.41) which is less convenient / less user friendly than hh:mm:ss that the other three cards use.

Entity card doesn't use relative time, which makes it a poor experience when used inside a Grid or Horizontal Stack, as there's never enough room to display the time. Here's an example of why this is problematic, the Entity card display is useless compared to Tile:

Screen Shot 2024-04-16 at 3 37 23 AM

Describe the behavior you expected

Consistency with Entities, Tile, Glance cards

Steps to reproduce the issue

  1. Go to Developer Tools → States and paste (device_class: timestamp or device_class: duration) into the attributes filter to find entities with those.
  2. Copy one of those entity ID and add to Entity card
  3. Add same entity ID to an Entities or Tile card, and compare

What version of Home Assistant Core has the issue?

2024.4.3.

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Chrome

Which operating system are you using to run this browser?

MacOS Sonoma

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

ildar170975 commented 3 months ago

Timestamp:

  1. Entities card - you can define format option (relative, date, time, datetime, total); default is "relative".
  2. Entity card - no format option is available. Default format - "datetime".
  3. Tile card - no format option is available. Default format - "relative".

Duration:

  1. Entities card - format is hh:mm:ss.
  2. Entity card - format is XX.XX measured in hours.
  3. Tile card - format is XX.XX measured in hours.

I would say - both Entity & Tile cards need to be improved.

mbo18 commented 2 months ago

Ah! Same here, I've opened this discussion: https://github.com/home-assistant/frontend/discussions/20618

ChristophCaina commented 2 months ago

as for getting the tile card to show a timestamp instead of relative, I am using card-mod...

type: tile
entity: sensor.lxc_samba_server_100_betriebszeit
name: letzter Start
card_mod:
  style:
    ha-tile-info$: |
      .secondary {
         visibility: hidden;
       }
       .secondary:before {
         visibility: visible;
         content: "{{ as_timestamp(states(config.entity) | title) | timestamp_custom("%d.%m.%Y - %H:%M:%S") }}"
       }

grafik

I would also love, if the tile card would provide an option (like a feature) with which you could easily change the format between relative, timestamp, etc.