Macros cannot be used across your system. They are only available in your single template.
You can approach this differently to remove the macro as well, with a template sensor, and yaml anchor.
template:
- trigger:
- platform: time
at: "00:00"
variables: &date_variables
entities:
- sensor.cal_karfreitag
- sensor.cal_valentine_s_day
dates: >
{% set ns = namespace(items=[]) %}
{% for entity in entities %}
{% set dt = state_attr(entity, 'date') | as_datetime %}
{% set day = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'][dt.weekday()] %}
{% set day = day ~ ', ' ~ dt .strftime('%d.%m.%Y') %}
{% set ns.items = ns.items + [ (entity, day) ] %}
{% endfor %}
{{ dict.from_keys(ns.items) }}
- platform: homeassistant
event: start
variables: *date_variables
sensor:
- name: Holidays
unique_id: holidays
state: "{{ dates | count }}"
attributes:
dates: "{{ dates }}"
Your template in the card would be (it wouldn’t change for any of them).
- entity: sensor.cal_valentine_s_day
type: custom:secondaryinfo-entity-row
secondary_info: "{{ state_attr('sensor.holidays', 'dates')[entity] }}"
EDIT: I’m just going to delete option 1.