Madplan dashboard view + Mealie sensorer + mad_announcement med dagens ret

This commit is contained in:
2026-04-16 19:14:39 +02:00
parent 42930ef2f0
commit 2c4f6c4308
5 changed files with 231 additions and 5 deletions
+35 -5
View File
@@ -38,7 +38,13 @@ mad_announcement:
sequence:
- service: notify.mobile_app_claus_iphone_15pro
data:
message: Der er mad
message: >-
{% set meal = states('sensor.dagens_aftensmad') %}
{% if meal and meal not in ['unknown','unavailable','Ingen planlagt'] %}
Der er mad! I dag: {{ meal }}
{% else %}
Der er mad!
{% endif %}
- choose:
- conditions:
- condition: state
@@ -47,7 +53,13 @@ mad_announcement:
sequence:
- service: notify.mobile_app_annes_iphone_14_pro
data:
message: Der er mad
message: >-
{% set meal = states('sensor.dagens_aftensmad') %}
{% if meal and meal not in ['unknown','unavailable','Ingen planlagt'] %}
Der er mad! I dag: {{ meal }}
{% else %}
Der er mad!
{% endif %}
- choose:
- conditions:
- condition: state
@@ -56,7 +68,13 @@ mad_announcement:
sequence:
- service: notify.mobile_app_andreas_iphone_12
data:
message: Der er mad
message: >-
{% set meal = states('sensor.dagens_aftensmad') %}
{% if meal and meal not in ['unknown','unavailable','Ingen planlagt'] %}
Der er mad! I dag: {{ meal }}
{% else %}
Der er mad!
{% endif %}
- choose:
- conditions:
- condition: state
@@ -65,7 +83,13 @@ mad_announcement:
sequence:
- service: notify.mobile_app_daniels_iphone_13_mini
data:
message: Der er mad
message: >-
{% set meal = states('sensor.dagens_aftensmad') %}
{% if meal and meal not in ['unknown','unavailable','Ingen planlagt'] %}
Der er mad! I dag: {{ meal }}
{% else %}
Der er mad!
{% endif %}
- service: media_player.volume_set
target:
entity_id:
@@ -88,7 +112,13 @@ mad_announcement:
- media_player.daniel
- media_player.sovevaerelse
- media_player.badevaerelse
message: Der er mad
message: >-
{% set meal = states('sensor.dagens_aftensmad') %}
{% if meal and meal not in ['unknown','unavailable','Ingen planlagt'] %}
Der er mad! I dag spiser vi {{ meal }}
{% else %}
Der er mad!
{% endif %}
- delay: "00:00:10"
- service: sonos.restore
data:
+13
View File
@@ -0,0 +1,13 @@
- platform: rest
name: mealie_madplan_ugen
resource_template: >-
http://10.0.0.142:9925/api/households/mealplans?start_date={{ now().strftime('%Y-%m-%d') }}&end_date={{ (now() + timedelta(days=6)).strftime('%Y-%m-%d') }}
headers:
Authorization: !secret mealie_bearer_token
Content-Type: application/json
method: GET
scan_interval: 1800
value_template: "{{ value_json.items | length }}"
json_attributes_path: "$"
json_attributes:
- items
+34
View File
@@ -0,0 +1,34 @@
- sensor:
- name: "Dagens aftensmad"
unique_id: mealie_dagens_aftensmad
icon: mdi:silverware-fork-knife
state: >
{% set today = now().strftime('%Y-%m-%d') %}
{% set items = state_attr('sensor.mealie_madplan_ugen', 'items') %}
{% if items %}
{% set ns = namespace(meal='Ingen planlagt') %}
{% for item in items %}
{% if item.date == today and item.recipe %}
{% set ns.meal = item.recipe.name %}
{% endif %}
{% endfor %}
{{ ns.meal }}
{% else %}
Ingen planlagt
{% endif %}
- name: "Dagens aftensmad slug"
unique_id: mealie_dagens_aftensmad_slug
state: >
{% set today = now().strftime('%Y-%m-%d') %}
{% set items = state_attr('sensor.mealie_madplan_ugen', 'items') %}
{% if items %}
{% set ns = namespace(slug='') %}
{% for item in items %}
{% if item.date == today and item.recipe %}
{% set ns.slug = item.recipe.slug %}
{% endif %}
{% endfor %}
{{ ns.slug }}
{% else %}
{% endif %}