Show Mon–Fri school lunch menus in a full-width panel layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Joshua King
2026-08-09 14:47:55 -04:00
parent 1ee7f0c739
commit f0af1eacfa
2 changed files with 227 additions and 60 deletions
+62
View File
@@ -0,0 +1,62 @@
################################################################################
# lunch_menus.yaml
#
# Pulls MonFri of the current school week from each lunch Google Calendar into
# template sensors. On Sat/Sun, advances to next week's Monday. The Lunch Menus
# dashboard renders those attributes — the stock calendar card has no school-
# week view.
################################################################################
template:
- trigger:
- platform: time_pattern
minutes: "/15"
- platform: homeassistant
event: start
- platform: event
event_type: event_template_reloaded
action:
- variables:
# weekday(): Mon=0 … Sun=6. Weekend → next Monday.
school_monday: >-
{% set wd = now().weekday() %}
{% if wd >= 5 %}
{{ (today_at() + timedelta(days=(7 - wd))).isoformat() }}
{% else %}
{{ (today_at() - timedelta(days=wd)).isoformat() }}
{% endif %}
- action: calendar.get_events
target:
entity_id:
- calendar.bhs_lunch_menu
- calendar.bis_school_lunches
- calendar.hms_lunch_menu
data:
start_date_time: "{{ school_monday }}"
duration:
days: 5
response_variable: agenda
sensor:
- name: "BHS Lunch Menu Week"
unique_id: bhs_lunch_menu_week
icon: mdi:food-apple
state: "{{ agenda['calendar.bhs_lunch_menu'].events | count }}"
attributes:
events: "{{ agenda['calendar.bhs_lunch_menu'].events }}"
week_start: "{{ school_monday }}"
- name: "BIS Lunch Menu Week"
unique_id: bis_lunch_menu_week
icon: mdi:food-apple
state: "{{ agenda['calendar.bis_school_lunches'].events | count }}"
attributes:
events: "{{ agenda['calendar.bis_school_lunches'].events }}"
week_start: "{{ school_monday }}"
- name: "HMS Lunch Menu Week"
unique_id: hms_lunch_menu_week
icon: mdi:food-apple
state: "{{ agenda['calendar.hms_lunch_menu'].events | count }}"
attributes:
events: "{{ agenda['calendar.hms_lunch_menu'].events }}"
week_start: "{{ school_monday }}"