Skip to content

Commit

Permalink
apps/homassistant: better tandoor sensor
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfantom committed Oct 14, 2023
1 parent 984c81c commit b0a069a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
20 changes: 13 additions & 7 deletions apps/homeassistant/config/configuration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,22 @@ sensor:
authorization: !secret recipes_token
resource: https://recipes.krupa.net.pl/api/meal-plan
params:
from_date: '{{ now().strftime("%Y-%m-%d") }}'
to_date: '{{ now().strftime("%Y-%m-%d") }}'
from_date: >
{{ now().strftime("%Y-%m-%d") }}
to_date: >
{{ (now().date() + timedelta(days=1)).strftime("%Y-%m-%d") }}
value_template: >
{% if value_json is none or value_json == [] %}
No meal plan
{% elif value_json[0].title %}
{{ value_json[0].title }}
{% elif value_json[0].recipe_name %}
{{ value_json[0].recipe_name }}
No meal plan found
{% else %}
{% for date, dish in value_json | groupby('date') -%}
{% for type in ['Breakfast', 'Lunch', 'Snack', 'Dinner'] %}
{% set curr = (dish|selectattr('meal_type_name', 'eq', type)|first) -%}
{{ date }}: {{ curr.meal_type_name | default('Meal') }}: {{ curr.title | default('') }}{{ curr.recipe_name | default('') -}}
{% endfor %}
{% endfor %}
{% endif %}
#- name: we_wash_w1
# platform: imap_email_content
# server: imap.gmail.com
Expand Down
20 changes: 13 additions & 7 deletions apps/homeassistant/manifests/homeassistant/configs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,22 @@ data:
authorization: !secret recipes_token
resource: https://recipes.krupa.net.pl/api/meal-plan
params:
from_date: '{{ now().strftime("%Y-%m-%d") }}'
to_date: '{{ now().strftime("%Y-%m-%d") }}'
from_date: >
{{ now().strftime("%Y-%m-%d") }}
to_date: >
{{ (now().date() + timedelta(days=1)).strftime("%Y-%m-%d") }}
value_template: >
{% if value_json is none or value_json == [] %}
No meal plan
{% elif value_json[0].title %}
{{ value_json[0].title }}
{% elif value_json[0].recipe_name %}
{{ value_json[0].recipe_name }}
No meal plan found
{% else %}
{% for date, dish in value_json | groupby('date') -%}
{% for type in ['Breakfast', 'Lunch', 'Snack', 'Dinner'] %}
{% set curr = (dish|selectattr('meal_type_name', 'eq', type)|first) -%}
{{ date }}: {{ curr.meal_type_name | default('Meal') }}: {{ curr.title | default('') }}{{ curr.recipe_name | default('') -}}
{% endfor %}
{% endfor %}
{% endif %}
#- name: we_wash_w1
# platform: imap_email_content
# server: imap.gmail.com
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: 3fcc0108a83a5756750840f271420bf9
checksum.config/md5: 186af01be41ae4a1ee8806dfa07fe137
labels:
app.kubernetes.io/component: server
app.kubernetes.io/name: homeassistant
Expand Down

0 comments on commit b0a069a

Please sign in to comment.