Als praktisches Beispiel, hier mal eine Markdown Kate mit den Abfuhrterminen.
Die Wochen Tage werden hier übersetzt. -> ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"]
Sowie die Monate -> ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"]
Code: Alles auswählen
type: markdown
content: |
{% set wochentag = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"] %}
{% set wochentag_waste = wochentag[states.sensor.waste_collection_waste.attributes | first | as_timestamp |timestamp_custom("%w", false) | int ] %}
{% set wochentag_paper = wochentag[states.sensor.waste_collection_paper.attributes | first | as_timestamp |timestamp_custom("%w", false) | int ] %}
{% set wochentag_bio = wochentag[states.sensor.waste_collection_bio.attributes | first | as_timestamp |timestamp_custom("%w", false) | int ] %}
{% set monat = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"] %}
{% set monat_waste = monat[states.sensor.waste_collection_waste.attributes | first | as_timestamp |timestamp_custom("%m") | int - 1] %}
{% set monat_paper = monat[states.sensor.waste_collection_paper.attributes | first | as_timestamp |timestamp_custom("%m") | int - 1] %}
{% set monat_bio = monat[states.sensor.waste_collection_bio.attributes | first | as_timestamp |timestamp_custom("%m") | int - 1] %}
| Müll | Datum |
|------------|------------|
|<ha-icon icon="mdi:recycle"></ha-icon> Restmüll| {{ wochentag_waste}}, den {{ states.sensor.waste_collection_waste.attributes | first | as_timestamp | timestamp_custom("%d") }} {{monat_waste}} |
|<ha-icon icon="mdi:file"></ha-icon> Papiermüll| {{wochentag_paper}}, den {{ states.sensor.waste_collection_paper.attributes | first | as_timestamp | timestamp_custom("%d") }} {{monat_paper}} |
|<ha-icon icon="mdi:leaf"></ha-icon> Biomüll|{{wochentag_bio}}, den {{ states.sensor.waste_collection_bio.attributes | first | as_timestamp | timestamp_custom("%d") }} {{monat_bio}}|
- Abfuhrtermine.png (28.9 KiB) 4699 mal betrachtet
Ohne der Übersetzung würde es so aussehen.
Code: Alles auswählen
type: markdown
content: |
| Müll | Datum |
|------------|------------|
|<ha-icon icon="mdi:recycle"></ha-icon> Restmüll| {{ states.sensor.waste_collection_waste.attributes | first | as_timestamp | timestamp_custom("%a, %m.%Y") }}|
|<ha-icon icon="mdi:file"></ha-icon> Papiermüll| {{ states.sensor.waste_collection_paper.attributes | first | as_timestamp | timestamp_custom("%a, %m.%Y") }} |
|<ha-icon icon="mdi:leaf"></ha-icon> Biomüll|{{ states.sensor.waste_collection_bio.attributes | first | as_timestamp | timestamp_custom("%a, %m.%Y") }} |
- Abfuhrtermine_orginal.png (24.04 KiB) 4699 mal betrachtet
Gruß
Osorkon