Using all kinds of different posts around this great community, I managed to assemble the following;
A Piper voice in Flemish dutch: Greetings according to the time of day, followed by the date, day and month and the current temperature outside and current weather conditions.
Then according to the current sun position it mentions in how much time the next sunset or sunrise will occur.
Again , I did not write or come up with this myself, I assembled various posts around this nice community and combined them. But… some of my results are just a little bit off and need some more tinkering:
- in the weekdays, %set dag, the first day “zondag” (sunday) is never shown, it stays blanc.
- when there is less than an hour to the next event (sunrise or sunset) how do I remove the “uur” (hour) text?
- can I shorten the whole lot? my Raspberry Pi is working, and working (too?) hard to spit this out.
- service: tts.speak
target:
entity_id: tts.piper
data:
cache: false
media_player_entity_id: media_player.toilet
message: >-
{% set dag = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag",
"vrijdag", "zaterdag"] %} {% set maand = ["januari", "februari",
"maart", "april", "mei", "juni", "juli", "augustus", "september",
"oktober", "november", "december"] %} {% set weekdag =
dag[now().isoweekday()] %} {% set maanden = maand[now().month - 1] %} {%
set nl_weer = { 'clear-night': "een heldere nacht",
'cloudy': "bewolkt",
'exceptional': "extreem weer",
'fog': "mistig",
'hail': "het hagelt",
'lightning': "het onweert",
'lightning-rainy': "er is onweer en regen",
'partlycloudy': "half bewolkt",
'pouring': "het regent hard",
'rainy': "het is regenachtig",
'snowy': "het sneeuwt",
'snowy-rainy': "er is regen of sneeuw",
'sunny': "zonnig",
'windy': "met wind",
'windy-variant': "met windvlagen"
} %}
Goeden{% if now().hour < 5 %}nacht
{% elif now().hour < 12 %}morgen
{% elif now().hour < 17 %}middag
{% else %}avond{% endif %}. Het is {{ weekdag }} {{ now().day }} {{ maanden }}. Buiten is het {{ state_attr('weather.home', 'temperature') | round(0)}} graden en {{nl_weer [states('weather.home')]}}.
.
{% set t = now() %}
{% set next = [ state_attr('sun.sun', 'next_rising'), state_attr('sun.sun', 'next_setting') ] | map('as_datetime') | reject('none') | sort %}
{% set next = next | reject('<', t) | list | first | default(t) %}
{% if is_state('sun.sun', 'above_horizon') %}De zon gaat onder over {{ (next - t).seconds | timestamp_custom('%-I uur en %-M minuten.', False) }}
{% else %}De zon komt op over {{ (next - t).seconds | timestamp_custom('%-I uur en %-M minuten.', False) }} {% endif %}
mode: single
Thanks already for any help or even the slightest input. I can translate more of the Dutch words in the above code when needed, please let me know.