- sensor:
    - name: "Dagens aftensmad"
      unique_id: mealie_dagens_aftensmad
      icon: mdi:silverware-fork-knife
      state: >
        {% set today = now().strftime('%Y-%m-%d') %}
        {% set items = state_attr('sensor.mealie_madplan_ugen', 'items') %}
        {% if items %}
          {% set ns = namespace(meal='Ingen planlagt') %}
          {% for item in items %}
            {% if item.date == today and item.recipe %}
              {% set ns.meal = item.recipe.name %}
            {% endif %}
          {% endfor %}
          {{ ns.meal }}
        {% else %}
          Ingen planlagt
        {% endif %}

    - name: "Dagens aftensmad slug"
      unique_id: mealie_dagens_aftensmad_slug
      state: >
        {% set today = now().strftime('%Y-%m-%d') %}
        {% set items = state_attr('sensor.mealie_madplan_ugen', 'items') %}
        {% if items %}
          {% set ns = namespace(slug='') %}
          {% for item in items %}
            {% if item.date == today and item.recipe %}
              {% set ns.slug = item.recipe.slug %}
            {% endif %}
          {% endfor %}
          {{ ns.slug }}
        {% else %}
        {% endif %}
