Files
Home-Assistant/dashboards/views/lunch-menus-dashboard.yaml
T
2026-08-09 14:47:55 -04:00

178 lines
7.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Lunch Menus — school cafeteria calendars (MonFri each)
#
# Panel layout so the title spans the full width and the three school cards
# sit in one row. Menus come from packages/lunch_menus.yaml (stock calendar
# cards cannot limit to a school-week window).
title: Lunch Menus
theme: cubecraft
views:
- title: Lunch Menus
path: lunch-menus
icon: mdi:food-apple
theme: cubecraft
type: panel
cards:
- type: vertical-stack
cards:
- type: markdown
content: |
{% set wd = now().weekday() %}
{% if wd >= 5 %}
{% set monday = today_at() + timedelta(days=(7 - wd)) %}
{% else %}
{% set monday = today_at() - timedelta(days=wd) %}
{% endif %}
{% set friday = monday + timedelta(days=4) %}
# School Lunch Menus
## {{ monday.strftime("%b %-d") }} {{ friday.strftime("%b %-d, %Y") }}
card_mod:
style: |
ha-card {
background: var(--cc-gradient);
color: #fff;
border: none;
border-radius: var(--cc-radius-brand);
box-shadow: var(--cc-shadow-brand);
padding: 6px 12px;
text-align: center;
}
ha-card h1 {
margin: 0;
font-size: 1rem;
font-weight: 600;
letter-spacing: 0.02em;
opacity: 0.85;
color: #fff;
}
ha-card h2 {
margin: 2px 0 0 0;
font-size: 1.5rem;
font-weight: 800;
letter-spacing: -0.01em;
color: #fff;
}
- type: grid
columns: 3
square: false
cards:
- type: markdown
title: BHS Lunch Menu
entity_id: sensor.bhs_lunch_menu_week
content: |
{% set events = state_attr('sensor.bhs_lunch_menu_week', 'events') or [] %}
{% if events is string %}{% set events = [] %}{% endif %}
{% set wd = now().weekday() %}
{% if wd >= 5 %}
{% set monday = today_at() + timedelta(days=(7 - wd)) %}
{% else %}
{% set monday = today_at() - timedelta(days=wd) %}
{% endif %}
{% for offset in range(5) %}
{% set d = (monday + timedelta(days=offset)).date() %}
{% set d_str = d.isoformat() %}
{% set ns = namespace(found=false) %}
### {{ d.strftime("%A") }}
{{ d.strftime("%b %-d") }}
{% for e in events if e.start is defined and e.start[:10] == d_str %}
{% set ns.found = true %}
- {{ e.summary }}
{% endfor %}
{% if not ns.found %}
_No menu listed_
{% endif %}
{% endfor %}
card_mod: &cc_menu
style: |
ha-card .card-header {
color: var(--cc-text, var(--primary-text-color));
font-weight: 700;
}
ha-markdown {
padding-top: 0 !important;
}
ha-markdown h3 {
margin: 0.85rem 0 0.15rem 0;
font-size: 1rem;
font-weight: 700;
color: var(--cc-accent, var(--primary-color));
}
ha-markdown h3:first-child {
margin-top: 0;
}
ha-markdown p {
margin: 0 0 0.35rem 0;
color: var(--cc-text-muted, var(--secondary-text-color));
font-size: 0.85rem;
}
ha-markdown ul {
margin: 0 0 0.5rem 0;
padding-left: 1.1rem;
}
ha-markdown li {
margin: 0.15rem 0;
color: var(--cc-text, var(--primary-text-color));
}
ha-markdown em {
color: var(--cc-text-muted, var(--secondary-text-color));
}
- type: markdown
title: BIS School Lunches
entity_id: sensor.bis_lunch_menu_week
content: |
{% set events = state_attr('sensor.bis_lunch_menu_week', 'events') or [] %}
{% if events is string %}{% set events = [] %}{% endif %}
{% set wd = now().weekday() %}
{% if wd >= 5 %}
{% set monday = today_at() + timedelta(days=(7 - wd)) %}
{% else %}
{% set monday = today_at() - timedelta(days=wd) %}
{% endif %}
{% for offset in range(5) %}
{% set d = (monday + timedelta(days=offset)).date() %}
{% set d_str = d.isoformat() %}
{% set ns = namespace(found=false) %}
### {{ d.strftime("%A") }}
{{ d.strftime("%b %-d") }}
{% for e in events if e.start is defined and e.start[:10] == d_str %}
{% set ns.found = true %}
- {{ e.summary }}
{% endfor %}
{% if not ns.found %}
_No menu listed_
{% endif %}
{% endfor %}
card_mod: *cc_menu
- type: markdown
title: HMS Lunch Menu
entity_id: sensor.hms_lunch_menu_week
content: |
{% set events = state_attr('sensor.hms_lunch_menu_week', 'events') or [] %}
{% if events is string %}{% set events = [] %}{% endif %}
{% set wd = now().weekday() %}
{% if wd >= 5 %}
{% set monday = today_at() + timedelta(days=(7 - wd)) %}
{% else %}
{% set monday = today_at() - timedelta(days=wd) %}
{% endif %}
{% for offset in range(5) %}
{% set d = (monday + timedelta(days=offset)).date() %}
{% set d_str = d.isoformat() %}
{% set ns = namespace(found=false) %}
### {{ d.strftime("%A") }}
{{ d.strftime("%b %-d") }}
{% for e in events if e.start is defined and e.start[:10] == d_str %}
{% set ns.found = true %}
- {{ e.summary }}
{% endfor %}
{% if not ns.found %}
_No menu listed_
{% endif %}
{% endfor %}
card_mod: *cc_menu