Add lunch menu functionality
This commit is contained in:
@ -94,6 +94,110 @@ sensor:
|
||||
spring_break_days2go:
|
||||
value_template: "{{ ((state_attr('input_datetime.spring_break_start', 'timestamp')-as_timestamp(now())) | int /60/1440) | round(0) }}"
|
||||
unit_of_measurement: 'Days'
|
||||
lunch_menu_week:
|
||||
friendly_name: Lunch Menu Week
|
||||
value_template: >
|
||||
{% if is_state('calendar.elementary_school_lunch','on') %}
|
||||
{{ state_attr('calendar.elementary_school_lunch','message') }}
|
||||
{% else %}
|
||||
No Menu
|
||||
{% endif %}
|
||||
icon_template: >
|
||||
{% if is_state_attr('calendar.elementary_school_lunch','message','First Menu') %}
|
||||
mdi:numeric-1-circle
|
||||
{% elif is_state_attr('calendar.elementary_school_lunch','message','Second Menu') %}
|
||||
mdi:numeric-2-circle
|
||||
{% elif is_state_attr('calendar.elementary_school_lunch','message','Third Menu') %}
|
||||
mdi:numeric-3-circle
|
||||
{% elif is_state_attr('calendar.elementary_school_lunch','message','Fourth Menu') %}
|
||||
mdi:numeric-4-circle
|
||||
{% else %}
|
||||
mdi:calendar-end
|
||||
{% endif %}
|
||||
lunch_menu_items:
|
||||
friendly_name: Lunch Menu Items
|
||||
icon_template: >
|
||||
{% set week = states('sensor.lunch_menu_week') %}
|
||||
{% if week == 'First Menu' %}
|
||||
mdi:numeric-1-circle
|
||||
{% elif week == 'Second Menu' %}
|
||||
mdi:numeric-2-circle
|
||||
{% elif week == 'Third Menu' %}
|
||||
mdi:numeric-3-circle
|
||||
{% elif week == 'Fourth Menu' %}
|
||||
mdi:numeric-4-circle
|
||||
{% else %}
|
||||
mdi:calendar-end
|
||||
{% endif %}
|
||||
value_template: >
|
||||
{%- macro getReport() -%}
|
||||
{% set week = states('sensor.lunch_menu_week') %}
|
||||
{% set dow = now().strftime('%A') %}
|
||||
{% if week == 'First Menu' %}
|
||||
{% if dow == 'Monday' %}
|
||||
Sloppy Joe, tomatoes or dip, green beans, mixed fruit, and milk.
|
||||
{% elif dow == 'Tuesday' %}
|
||||
Beef, taco salad, refried beans, spanish rice, peaches, and milk.
|
||||
{% elif dow == 'Wednesday' %}
|
||||
Pulled Pork, steamed broccoli, carrots, apples, and milk.
|
||||
{% elif dow == 'Thursday' %}
|
||||
Beef Stroganoff, steamed cauliflower, cucumbers, fresh fruit, and milk.
|
||||
{% elif dow == 'Friday' %}
|
||||
Hamburger, spinach salad, oven potatoes, applesauce, and milk.
|
||||
{% endif %}
|
||||
{% elif week == 'Second Menu' %}
|
||||
{% if dow == 'Monday' %}
|
||||
Popcorn chicken, mashed potatoes, corn, pears, bread, and milk.
|
||||
{% elif dow == 'Tuesday' %}
|
||||
Lasagna, garlic bread, celery, tomatoes, apple crisp, and milk.
|
||||
{% elif dow == 'Wednesday' %}
|
||||
Hot ham and cheese, spinach salad, broccoli, fresh fruit, and milk.
|
||||
{% elif dow == 'Thursday' %}
|
||||
Turkey and noodles, mashed potatoes, carrots, peaches, bread, and milk.
|
||||
{% elif down == 'Friday' %}
|
||||
Hot dog with chili sauce, oven potatoes, backed beans, mixed fruit, and milk.
|
||||
{% endif %}
|
||||
{% elif week == 'Third Menu' %}
|
||||
{% if dow == 'Monday' %}
|
||||
Bosco sticks with pizza sauce, black bean salad, oven potatoes, peach crisp, and milk.
|
||||
{% elif dow == 'Tuesday' %}
|
||||
Toasted cheese, tomato soup, mixed vegetables, fresh fruit, treat, and milk.
|
||||
{% elif dow == 'Wednesday' %}
|
||||
Popcorn chicken, mashed potatoes, carrots, apples, corn bread, and milk.
|
||||
{% elif dow == 'Thursday' %}
|
||||
Spaghetti, broccoli, green beans, fresh fruit, breadsticks, and milk.
|
||||
{% elif dow == 'Friday' %}
|
||||
Cold cut sub, spinach salad, tomatoes, pears, and milk.
|
||||
{% endif %}
|
||||
{% elif week == 'Fourth Menu' %}
|
||||
{% if dow == 'Monday' %}
|
||||
Chicken patty, baked beans, celery, mixed fruit, and milk.
|
||||
{% elif dow == 'Tuesday' %}
|
||||
Omelet or french toast, sausage, hash browns, tomatoes, orange, and milk.
|
||||
{% elif dow == 'Wednesday' %}
|
||||
Hamburger, green beans, cauliflower, apple crisp, and milk.
|
||||
{% elif dow == 'Thursday' %}
|
||||
Mac and cheese, steamed broccoli, carrots, pears, bread, and milk.
|
||||
{% elif dow == 'Friday' %}
|
||||
Hot dog, spinach salad, oven potatoes, fresh fruit, and milk.
|
||||
{% endif %}
|
||||
{% else %}
|
||||
No menu for the current day.
|
||||
{% endif %}
|
||||
{%- endmacro -%}
|
||||
{# a macro that removes all newline characters, empty spaces, and returns formatted text #}
|
||||
{%- macro cleanup(data) -%}
|
||||
{%- for item in data.split("\n") if item | trim != "" -%}
|
||||
{{ item | trim }} {% endfor -%}
|
||||
{%- endmacro -%}
|
||||
{# a macro to call all macros :) #}
|
||||
{%- macro mother_of_all_macros() -%}
|
||||
{{ getReport() }}
|
||||
{%- endmacro -%}
|
||||
{# Call the macro #}
|
||||
{{- cleanup(mother_of_all_macros()) -}}
|
||||
|
||||
|
||||
# - platform: rest
|
||||
# resource: https://raw.githubusercontent.com/tm24fan8/Home-Assistant-Configs/master/packages/json_data/school.json
|
||||
# name: School Lunch
|
||||
|
Reference in New Issue
Block a user