Time Elapsed Card by @kirbo
Time Elapsed card
Hey dude! Help me out for a couple of 🍻 or a ☕!
Name | Type | Requirement | Description | Default |
---|---|---|---|---|
type | string | Required | custom:elapsed-time-card |
|
time_today | string | Required | Home Assistant entity ID. | none |
max_today | string | Optional | Home Assistant entity ID. | none |
format | string | Required | Format for the card | Time Left |
time_format | string | Required | Card name | 1h 5m |
name | string | Optional | Name to show on card | none |
icon | string | Optional | Icon to show on card | none |
Show time in <time elapsed> / <time maximum>
format, e.g.: 01:54 / 02:00
or 1h 54m / 2h
, depending on time_format
setting.
Show time in <time remaining>
format, e.g.: 00:06
or 6m
, depending on time_format
setting.
type: 'custom:elapsed-time-card'
format: Time Elapsed
time_format: 1h 5m
time_today: sensor.ps4_playing_game
max_today: input_datetime.ps4_game_time
name: Cartoons watched
icon: netflix
type: 'custom:elapsed-time-card'
format: Time Left
time_format: 1h 5m
time_today: sensor.ps4_playing_game
max_today: input_datetime.ps4_game_time
name: Game time left
icon: sony-playstation
type: horizontal-stack
cards:
- type: vertical-stack
title: Today elapsed
cards:
- format: Time Elapsed
time_format: 1h 5m
type: 'custom:elapsed-time-card'
name: Played total
icon: gamepad-variant
time_today: sensor.ps4_playing_game
- format: Time Elapsed
time_format: 1h 5m
type: 'custom:elapsed-time-card'
name: Watched total
icon: youtube
time_today: sensor.ps4_playing_app
- format: Time Elapsed
time_format: 1h 5m
type: 'custom:elapsed-time-card'
name: Screentime total
icon: monitor-eye
time_today: sensor.ps4_playing
- type: vertical-stack
title: Today left
cards:
- format: Time Left
time_format: 1h 5m
type: 'custom:elapsed-time-card'
name: Game time left
icon: gamepad-variant
time_today: sensor.ps4_playing_game
max_today: input_datetime.ps4_game_time
- format: Time Left
time_format: 1h 5m
type: 'custom:elapsed-time-card'
name: Videos left
icon: youtube
time_today: sensor.ps4_playing_app
max_today: input_datetime.ps4_vod_time
- format: Time Left
time_format: 1h 5m
type: 'custom:elapsed-time-card'
name: Screentime left
icon: monitor-eye
time_today: sensor.ps4_playing
max_today: sensor.ps4_playing
- type: vertical-stack
title: Today total
cards:
- format: Time Elapsed
time_format: '01:05'
type: 'custom:elapsed-time-card'
name: Played total
icon: gamepad-variant
max_today: input_datetime.ps4_game_time
time_today: sensor.ps4_playing_game
- format: Time Elapsed
time_format: '01:05'
type: 'custom:elapsed-time-card'
name: Watched total
icon: youtube
time_today: sensor.ps4_playing_app
max_today: input_datetime.ps4_vod_time
- format: Time Elapsed
time_format: '01:05'
type: 'custom:elapsed-time-card'
name: Screentime total
icon: monitor-eye
time_today: sensor.ps4_playing
- type: vertical-stack
title: This week elapsed
cards:
- format: Time Elapsed
time_format: 1h 5m
type: 'custom:elapsed-time-card'
name: Played total
icon: gamepad-variant
time_today: sensor.ps4_weekly_game
- format: Time Elapsed
time_format: 1h 5m
type: 'custom:elapsed-time-card'
name: Watched total
icon: youtube
time_today: sensor.ps4_weekly_app
- format: Time Elapsed
time_format: 1h 5m
type: 'custom:elapsed-time-card'
name: Screentime total
icon: monitor-eye
time_today: sensor.ps4_weekly_playing
- type: vertical-stack
title: This week elapsed
cards:
- format: Time Elapsed
time_format: '01:05'
type: 'custom:elapsed-time-card'
name: Played total
icon: gamepad-variant
time_today: sensor.ps4_weekly_game
- format: Time Elapsed
time_format: '01:05'
type: 'custom:elapsed-time-card'
name: Watched total
icon: youtube
time_today: sensor.ps4_weekly_app
- format: Time Elapsed
time_format: '01:05'
type: 'custom:elapsed-time-card'
name: Screentime total
icon: monitor-eye
time_today: sensor.ps4_weekly_playing
sensors
- platform: template
sensors:
ps4_media_content_type:
friendly_name: "PS4 - Media content type"
value_template: "{{ state_attr('media_player.ps4', 'media_content_type') }}"
- platform: history_stats
name: PS4 Playing (game)
entity_id: sensor.ps4_media_content_type
state: "game"
type: time
start: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
end: "{{ now() }}"
- platform: history_stats
name: PS4 Playing (app)
entity_id: sensor.ps4_media_content_type
state: "app"
type: time
start: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
end: "{{ now() }}"
input_datetime
ps4_game_time:
name: PS4 - Game time
icon: mdi:sony-playstation
has_date: false
has_time: true
ps4_app_time:
name: PS4 - APP time
icon: mdi:netflix
has_date: false
has_time: true
With the entities above, you can use this configuration:
format: Time Elapsed
time_format: '01:05'
type: 'custom:elapsed-time-card'
name: Played total
icon: gamepad-variant
max_today: input_datetime.ps4_game_time
time_today: sensor.ps4_playing_game
The card will show only entities that:
- have
unit_of_measurement
one of the following (i.e.input_number
, etc.):s
= secondsm
= minutesh
= hoursd
= days
- have one of the following attributes (i.e.
input_datetime
):has_time
has_date