I use a custom button to make a clickable time display, but the time doesn’t update until I navigate away from the dashboard and return. It is a problem on my HA tablet. Here is the code:
type: custom:button-card
name: >
[[[var d = new Date(); return d.toLocaleTimeString([], {hour: '2-digit',
minute:'2-digit',hourCycle: 'h23',});]]]
show_state: false
show_icon: false
show_name: true
color: var(--primary-text-color)
color_type: card
styles:
name:
- font-family: Roboto
- font-size: 5em
- letter-spacing: 0.05em
- color: var(--primary-text-color)
- text-align: center;
- font-weight: bold;
- margin: none;
card:
- background-color: var(--ha-card-background)
- border: 0px solid white
- border-radius: 10px
- box-shadow: none;
- background: none;
- padding: 0px !important;
tap_action:
action: call-service
service: input_boolean.toggle
target:
entity_id: input_boolean.rlo
Other things on the dashboard update, e.g. the mail icon lights up when the mail sensor is triggered, button reflecting the state of the lights show the current state. But the time doesn’t update.