Oooooh that’s a low blow !
Basically you need to gain access to HA’s python sandbox (an area where code can run in a low risk area, where evaluations can only do limited things like printing). To do this we submit them as templates. The template is rendered in Jinja2 a print formatting language, there are 4 things that can be put in Jinja2
- raw text - bad, the results can be unpredicatble
- comments
- evaluations
- print statements (bear with me, we put print statements in and this is what we get out)
{# this is a comment, I can put anything in here #}
{{ 'This is a print statement and I can use it to include standing text' }}
{# the following is an evaluation setting a variable to a name #}
{% set brian = 'A Very Naughty Boy !' %}
{# ... and printing that out (for example) : - #}
{{ 'Brian is ' ~ brian }}
{# prints "Brian is A Very Naughty Boy !" #}
{# the tilde charachter (~) concatenates (joins) strings #}
{# square brackets [] can be used to define an array, a list of items from which you can pick #}
{# so your weekdays are : - #}
{% set weekdays = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"] %}
{# and similarly your months are : - #}
{% set months = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"] %}
{# weekdays[3] takes the 4th element of 'weekdays', 0 is the first #}
{{ "Es ist " + weekdays[now().weekday()] + ", der " + now().strftime("%-d") + ". " + months[now().month - 1] + " " + now().strftime("%Y")}}
{# This last is merely a print statement assembling all the little bits together #}
now().weekday() returns the day of the week for now(), 0 to 6, 0 = Monday, 1 = Tuesday etc
now().month returns 1 to 12 hence the -1 to align the array
And the rest is just your personal bent on arranging the wording.
Apparently there are 22 different ways of telling the time across Germany with one option being “It is 2 minutes past, 10 minutes to 3” So I won’t comment on your format.
Hope that helps
Yep ! could be called ‘yellow’ or ‘monkey_nuts’
This is your template (enter it into the template editor under developers tools)
If you create (say) a sensor it would look like : -
sensor:
- platform: template
sensors:
today_is:
entity_id: sensor.date
friendly_name: Today Is : -
value_template: >
{% set yellow = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"] %}
{% set monkey_nuts = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"] %}
{{ "Es ist " + yellow[now().weekday()] + ", der " + now().strftime("%-d") + ". " + monkey_nuts[now().month - 1] + " " + now().strftime("%Y")}}
the “>” indicates this is a multi-line template and thus a) starts on the line below b) doesn’t need quotes (otherwise put double quotes on the outside and singles on the inside)
[Note: I copied Burnings template, and he’s a bit sloppy with discipline ( it appears ! ) ]
This will appear as an entity when you restart.