Great, thanks a lot.
Works as I wanted.
Hi all,
I would like to use the format-tag for weekkday (%A) but HA shows only the en_US names and not the de_DE names. The UI is configured in gernman and I do not understand, why the weekday names are in english.
I am using the VM from HA and the OS is:
cat /etc/*release
3.16.1
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.1
PRETTY_NAME="Alpine Linux v3.16"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"
I cannot find any command to check the locales on the OS. Can anyone tell me how to switch to de_DE?
Thanks,
Spartacus
Home Assistantâs templating language is English and doesnât support the operating systemâs locale. That means strftime
produce day and month names exclusively in English.
Youâll have to perform the translation yourself. For example:
['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'][now().weekday()] }}
Hi,
ok, thanks, its a little bit strange, that this is not included, but it
s ok.
I donât know if this is the right thread to ask this question, but I am having seemingly a timezone issue with timedelta calculation.
I am trying to calculate the remaining printing time by calculating the time delta between now and the
{% set done = as_timestamp(states("sensor.octoprint_estimated_finish_time")) %}
{% set current = now().timestamp() %}
{% set delta = done - current %}
Estimated finishing point is {{ done | timestamp_custom("%H:%M:%S")}} # 15:09:00
Current time is {{ now().timestamp() | timestamp_custom("%H:%M:%S") }} # 15:08:00
The delta between them is {{ delta | timestamp_custom("%H:%M:%S")}} # # 01:01:00
I can see, that the timezone of my current time and the sensor are correct (UTC+1).
But how do I get the formatter to use the UTC-timezone now, since it only describes the timedelta and no timezone?
Use datetimes instead of timestamps and you wonât have this confusion or issue.
{% set done = states("sensor.octoprint_estimated_finish_time") | as_datetime | as_local %}
{{ done - now() }}
It will most likely have microseconds. If you donât want thatâŚ
{% set done = states("sensor.octoprint_estimated_finish_time") | as_datetime | as_local %}
{{ done - now().replace(microsecond=0) }}
I have also : â-1 day, 23:47:00â and need your help to make this example just â13 minutesâ.
Thank You.