Hallo,
ich habe in meinem Dashboard folgende Anzeige.
Die Restlaufzeit wird mir mit 14m angezeigt.
Ich hätte dort gerne aber “fertig in 14m31s” angezeigt.
Wegen fehlender YAML Code Kenntnisse, weiß ich nicht wo ich im nachstehenden Code ansetzen soll. Kann da jemand helfen?
Vielleicht auch bitte mit entsprechendem Kommentar im Code um das zu verstehen.
chip:
type: template
content: >-
{{ states('sensor.octoprint_estimated_finish_time') | as_timestamp |
timestamp_custom ('%H:%M:%S') }}
icon: mdi:timer-sand-complete
- type: conditional
conditions:
- condition: state
entity: sensor.octoprint_current_state
state: Printing
chip:
type: template
content: >-
{% set time =
((as_timestamp(states('sensor.octoprint_estimated_finish_time')) -
as_timestamp(now())) | int) | int %} {% set minutes = ((time % 3600)
/ 60) | int %} {% set hours = ((time % 86400) / 3600) | int %} {%
set days = (time / 86400) | int %}
{%- if time < 60 -%}
Less than a minute
{%- else -%}
{%- if days > 0 -%}
{{ days }}d
{%- endif -%}
{%- if hours > 0 -%}
{%- if days > 0 -%}
{{ ' ' }}
{%- endif -%}
{{ hours }}h
{%- endif -%}
{%- if minutes > 0 -%}
{%- if days > 0 or hours > 0 -%}
{{ ' ' }}
{%- endif -%}
{{ minutes }}m
{%- endif -%}
{%- endif -%}
icon: mdi:timer