Thank you for the nice library.
This is a really good idea.
I struggled quite a bit to install it using hacs as it was not showing. Until I went through the full thread here to find that I had to set HACS in experimental mode to see the Easy Time integration.
My browser is in ‘fr’, my OS (Win10) is in ‘fr’, my homeassistant instance is set to ‘fr’ and my user profile is set to ‘fr’.
Once installed, it took me a while to know that I had to edit the easy_time.jinja and hardcode my default_language in there to ‘fr’.
It probably mean that I’ll have to redo it at every update of your library ? Am I right ?
Let say that my son prefers ‘en’ and set this language in his ha profile.
Couldn’t we use the same template to display in ‘fr’ for me and in ‘en’ for him ?
That’s only possible if you provide the language argument to macros based on the user. It won’t work for the frontend, but it would work for notifications.
Hi @petro , thanks for this Macro. For some reason, 12/31/23 returns ‘last Tuesday’ even though it was a Sunday. This happens for any date 12/26-12/31 it seems.
{% from 'easy_time.jinja' import speak_the_days %}
{{ speak_the_days("2023-12-31 00:00:00") }}
Is there a way of only showing the date and not the time when using as_datetime? For example, on the next DST, it works great but how can I only show the date?
You have an example on how to obtain Easter or Thanksgiving date. We know that those holidays are always on the same day of the week, but is there a way of showing the day of the week for a specific date such as what day of the week will July 4th or December 25th be?
Thank you both - that works perfectly. On the second item, is there a way to show the day of the week for a future date such as 12/25/2024 (which day Christmas falls on)?
Hi, still loving this set of macro’s and have a small question.
Why would one not import all macro’groups’ at once, instead of only the ones needed, is this performance related?
it was probably me figuring I am overdoing things here.
Have this bigger template: with all sorts of attributes, and this month, day combo could be added there, and next use it in a template-entity-row card, where I currently do this:
card:
type: custom:template-entity-row
entity: '[[entity]]'
name: >
{% set dagen = states(config.entity)|int(default=-1) %}
{% if dagen == 0 %}
{{state_attr(config.entity,'id')}} is vandaag:
{% else %}
{{state_attr(config.entity,'id')}} wordt {{state_attr(config.entity,'leeftijd')
|int(default=-1) + 1}} over:
{% endif %}
state: >
{% set dagen = states(config.entity)|int(default=-1) %}
{% if dagen == 0 %} Jarig!
{% else %} {{states(config.entity)}} {{'dag' if over == 1 else 'dagen'}}
{% endif %}
secondary: >
{% set event = state_attr(config.entity,'datum')|default(0,true)|as_datetime|as_local %}
{{state_attr(config.entity,'type')}}: {{event.strftime('%d-%m-%Y')}}
and only reference the config.entity
so I can use eg:
secondary: >
{% set event = state_attr(config.entity,'datum')|default(0,true)|as_datetime|as_local %}
{{state_attr(config.entity,'type')}}: {{event.strftime('%d-%m-%Y')}}
{% from 'easy_time.jinja' import weekday, month_day %}
op {{weekday((month_day(event.month,event.day)|as_datetime).isoweekday())}}
These macros look for timestamps, timestrings, timedeltas, or entity_ids. So you have to provide one of those. A small integer (in seconds) is not supported, well it is, but it assumes it’s a timestamp. 120 is 120 seconds past january 1st 1970, not exactly what you’d be looking for.
They sure do, like practically everything else in HA related to date, time and mathematical operations. What else would one use than a date/time related format?
Even if you have minutes or seconds, you can convert that to a timestamp and use it, or am I off here?