Skip to content

Commit

Permalink
apps/homeassistant: add tomorrow meals and remove todays
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfantom committed Oct 16, 2023
1 parent fcfe6e6 commit 62782f7
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 21 deletions.
56 changes: 46 additions & 10 deletions apps/homeassistant/config/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,34 +201,70 @@ sensor:
{% endif %}
rest:
# - resource: https://recipes.krupa.net.pl/api/meal-plan
# scan_interval: 3600
# headers:
# content-type: application/json
# authorization: !secret recipes_token
# params:
# from_date: >
# {{ now().strftime("%Y-%m-%d") }}
# to_date: >
# {{ now().strftime("%Y-%m-%d") }}
# sensor:
# - name: "Today's Breakfast"
# unique_id: "meal_today_breakfast"
# value_template: >
# {% set data = value_json | selectattr('meal_type_name', 'eq', 'Breakfast') | first -%}
# {{ data.title if data.title else data.recipe_name | default() }}
# - name: "Today's Lunch"
# unique_id: "meal_today_lunch"
# value_template: >
# {% set data = value_json | selectattr('meal_type_name', 'eq', 'Lunch') | first -%}
# {{ data.title if data.title else data.recipe_name | default() }}
# - name: "Today's Snack"
# unique_id: "meal_today_snack"
# value_template: >
# {% set data = value_json | selectattr('meal_type_name', 'eq', 'Snack') | first -%}
# {{ data.title if data.title else data.recipe_name | default() }}
# - name: "Today's Dinner"
# unique_id: "meal_today_dinner"
# value_template: >
# {% set data = value_json | selectattr('meal_type_name', 'eq', 'Dinner') | first -%}
# {{ data.title if data.title else data.recipe_name | default() }}
# json_attributes_path: "$.[?(@.meal_type_name=='Dinnert')].recipe"
# json_attributes:
# - image
# - id
# - name
- resource: https://recipes.krupa.net.pl/api/meal-plan
scan_interval: 3600
headers:
content-type: application/json
authorization: !secret recipes_token
params:
from_date: >
{{ now().strftime("%Y-%m-%d") }}
{{ (now().date() + timedelta(days=1)).strftime("%Y-%m-%d") }}
to_date: >
{{ now().strftime("%Y-%m-%d") }}
{{ (now().date() + timedelta(days=1)).strftime("%Y-%m-%d") }}
sensor:
- name: "Today's Breakfast"
unique_id: "meal_today_breakfast"
- name: "Tomorrow's Breakfast"
unique_id: "meal_tomorrow_breakfast"
value_template: >
{% set data = value_json | selectattr('meal_type_name', 'eq', 'Breakfast') | first -%}
{{ data.title if data.title else data.recipe_name | default() }}
- name: "Today's Lunch"
unique_id: "meal_today_lunch"
- name: "Tomorrow's Lunch"
unique_id: "meal_tomorrow_lunch"
value_template: >
{% set data = value_json | selectattr('meal_type_name', 'eq', 'Lunch') | first -%}
{{ data.title if data.title else data.recipe_name | default() }}
- name: "Today's Snack"
unique_id: "meal_today_snack"
- name: "Tomorrow's Snack"
unique_id: "meal_tomorrow_snack"
value_template: >
{% set data = value_json | selectattr('meal_type_name', 'eq', 'Snack') | first -%}
{{ data.title if data.title else data.recipe_name | default() }}
- name: "Today's Dinner"
unique_id: "meal_today_dinner"
- name: "Tomorrow's Dinner"
unique_id: "meal_tomorrow_dinner"
value_template: >
{% set data = value_json | selectattr('meal_type_name', 'eq', 'Dinner') | first -%}
{{ data.title if data.title else data.recipe_name | default() }}
Expand Down
56 changes: 46 additions & 10 deletions apps/homeassistant/manifests/homeassistant/configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,34 +204,70 @@ data:
{% endif %}
rest:
# - resource: https://recipes.krupa.net.pl/api/meal-plan
# scan_interval: 3600
# headers:
# content-type: application/json
# authorization: !secret recipes_token
# params:
# from_date: >
# {{ now().strftime("%Y-%m-%d") }}
# to_date: >
# {{ now().strftime("%Y-%m-%d") }}
# sensor:
# - name: "Today's Breakfast"
# unique_id: "meal_today_breakfast"
# value_template: >
# {% set data = value_json | selectattr('meal_type_name', 'eq', 'Breakfast') | first -%}
# {{ data.title if data.title else data.recipe_name | default() }}
# - name: "Today's Lunch"
# unique_id: "meal_today_lunch"
# value_template: >
# {% set data = value_json | selectattr('meal_type_name', 'eq', 'Lunch') | first -%}
# {{ data.title if data.title else data.recipe_name | default() }}
# - name: "Today's Snack"
# unique_id: "meal_today_snack"
# value_template: >
# {% set data = value_json | selectattr('meal_type_name', 'eq', 'Snack') | first -%}
# {{ data.title if data.title else data.recipe_name | default() }}
# - name: "Today's Dinner"
# unique_id: "meal_today_dinner"
# value_template: >
# {% set data = value_json | selectattr('meal_type_name', 'eq', 'Dinner') | first -%}
# {{ data.title if data.title else data.recipe_name | default() }}
# json_attributes_path: "$.[?(@.meal_type_name=='Dinnert')].recipe"
# json_attributes:
# - image
# - id
# - name
- resource: https://recipes.krupa.net.pl/api/meal-plan
scan_interval: 3600
headers:
content-type: application/json
authorization: !secret recipes_token
params:
from_date: >
{{ now().strftime("%Y-%m-%d") }}
{{ (now().date() + timedelta(days=1)).strftime("%Y-%m-%d") }}
to_date: >
{{ now().strftime("%Y-%m-%d") }}
{{ (now().date() + timedelta(days=1)).strftime("%Y-%m-%d") }}
sensor:
- name: "Today's Breakfast"
unique_id: "meal_today_breakfast"
- name: "Tomorrow's Breakfast"
unique_id: "meal_tomorrow_breakfast"
value_template: >
{% set data = value_json | selectattr('meal_type_name', 'eq', 'Breakfast') | first -%}
{{ data.title if data.title else data.recipe_name | default() }}
- name: "Today's Lunch"
unique_id: "meal_today_lunch"
- name: "Tomorrow's Lunch"
unique_id: "meal_tomorrow_lunch"
value_template: >
{% set data = value_json | selectattr('meal_type_name', 'eq', 'Lunch') | first -%}
{{ data.title if data.title else data.recipe_name | default() }}
- name: "Today's Snack"
unique_id: "meal_today_snack"
- name: "Tomorrow's Snack"
unique_id: "meal_tomorrow_snack"
value_template: >
{% set data = value_json | selectattr('meal_type_name', 'eq', 'Snack') | first -%}
{{ data.title if data.title else data.recipe_name | default() }}
- name: "Today's Dinner"
unique_id: "meal_today_dinner"
- name: "Tomorrow's Dinner"
unique_id: "meal_tomorrow_dinner"
value_template: >
{% set data = value_json | selectattr('meal_type_name', 'eq', 'Dinner') | first -%}
{{ data.title if data.title else data.recipe_name | default() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
template:
metadata:
annotations:
checksum.config/md5: 04e3e5c08a9eaa39e8c97afc9f17c7af
checksum.config/md5: 1e20742629d2ff25dec30a78f9fe1e60
labels:
app.kubernetes.io/component: server
app.kubernetes.io/name: homeassistant
Expand Down

0 comments on commit 62782f7

Please sign in to comment.