From eebbd238a529b91e1e5d8c7a1b2f228c76cbc9c5 Mon Sep 17 00:00:00 2001 From: Jeffrey Stone Date: Sat, 6 Mar 2021 10:10:07 -0500 Subject: [PATCH] Adding school lunch sensor --- config/packages/events.yaml | 8 +++++++ config/packages/json_data/school_lunch.json | 25 +++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 config/packages/json_data/school_lunch.json diff --git a/config/packages/events.yaml b/config/packages/events.yaml index 361f316..cdea55d 100755 --- a/config/packages/events.yaml +++ b/config/packages/events.yaml @@ -106,6 +106,14 @@ sensor: school_end_days2go: value_template: '{{ (((states.input_datetime.school_last_day.attributes.timestamp)-as_timestamp(now())) | int /60/1440) | round(0) }}' unit_of_measurement: 'Days' + - platform: rest + resource: https://raw.githubusercontent.com/thejeffreystone/home-assistant-configuration/master/config/packages/json_data/school_lunch.json + name: School Lunch + scan_interval: 14400 + value_template: > + {% set today = now().month ~ '/' ~ now().day %} + {% set lunch = value_json.MENU.static[ today ] %} + {{ lunch }} automation: - id: refresh_special_event_sensors diff --git a/config/packages/json_data/school_lunch.json b/config/packages/json_data/school_lunch.json new file mode 100755 index 0000000..88c5584 --- /dev/null +++ b/config/packages/json_data/school_lunch.json @@ -0,0 +1,25 @@ +{ + "MENU": { + "static": { + "3/2": "Quesadillas", + "3/3": "Pizza", + "3/4": "Taco Burger", + "3/11": "Burger", + "3/12": "Pizza", + "3/18": "Pizza", + "3/19": "Mac and Cheese", + "3/23": "Quesadilla", + "3/24": "Pizza", + "3/25": "Taco Burger", + "4/1": "Burger", + "4/2": "Pizza", + "4/13": "Quesadilla", + "4/14": "Pizza", + "4/15": "Taco Burger", + "4/22": "Burger", + "4/23": "Pizza", + "4/29": "Pizza", + "4/30": "Mac and Cheese" + } + } + } \ No newline at end of file