Files
N22/dashboards/views/04c_madplan.yaml
T

120 lines
3.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
title: Madplan
path: madplan
icon: mdi:chef-hat
cards:
# 🍽️ Dagens ret - stort fremhævet kort med link til Mealie
- type: custom:button-card
entity: sensor.dagens_aftensmad
show_icon: true
show_name: true
show_state: true
icon: mdi:food-variant
name: I dag
tap_action:
action: url
url_path: >
[[[
var slug = states['sensor.dagens_aftensmad_slug'].state;
if (slug && slug !== '' && slug !== 'unknown') {
return 'http://anneclaus.dk:9925/g/home/r/' + slug;
}
return 'http://anneclaus.dk:9925';
]]]
styles:
card:
- padding: 16px
- background: var(--primary-color)
- border-radius: 12px
icon:
- color: white
- width: 40px
name:
- font-size: 13px
- color: "rgba(255,255,255,0.7)"
- text-transform: uppercase
- letter-spacing: 1px
state:
- font-size: 22px
- font-weight: bold
- color: white
- padding-top: 4px
# 🎵 Musik i køkken + Vi laver mad + Der er mad
- type: grid
columns: 2
square: false
cards:
- type: button
name: Musik i køkken
icon: mdi:music-note-outline
tap_action:
action: call-service
service: media_player.select_source
target:
entity_id: media_player.kokken
data:
source: "1 Family Mix"
- type: button
name: Vi laver mad
icon: mdi:chef-hat
tap_action:
action: call-service
service: script.vi_laver_mad
- type: button
name: Der er mad!
icon: mdi:silverware-fork-knife
tap_action:
action: call-service
service: script.mad_announcement
# 📅 Madplan: i dag + 6 dage
- type: markdown
content: |-
{%- set ns = namespace(rows="") -%}
{%- set items = state_attr('sensor.mealie_madplan_ugen', 'items') or [] -%}
{%- set days = ['Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag','Søndag'] -%}
{%- for offset in range(7) -%}
{%- set day = now().date() + timedelta(days=offset) -%}
{%- set ms = items | selectattr('date', 'eq', day.isoformat()) | list -%}
{%- set m = ms[0] if ms else none -%}
{%- set recipe = m.recipe if m else none -%}
{%- set name = recipe.name if recipe else '' -%}
{%- set slug = recipe.slug if recipe else '' -%}
{%- set label = 'I dag' if offset == 0 else days[day.weekday()] -%}
{%- if slug -%}
{%- set ns.rows = ns.rows + "| **" + label + "** | [" + name + "](http://anneclaus.dk:9925/g/home/r/" + slug + ") |\n" -%}
{%- elif name -%}
{%- set ns.rows = ns.rows + "| **" + label + "** | " + name + " |\n" -%}
{%- else -%}
{%- set ns.rows = ns.rows + "| **" + label + "** | - |\n" -%}
{%- endif -%}
{%- endfor -%}
## Næste 7 dage
| Dag | Ret |
| --- | --- |
{{ ns.rows }}
# 🛒 Bilka ToGo - opdater og vis kryds-af liste
- type: vertical-stack
cards:
- type: markdown
content: |
## Bilka ToGo - kryds-af
Tryk på knappen for at hente ingredienser fra ugeplanen (fredagtorsdag).
- type: button
name: Opdater Bilka ToGo-liste nu
icon: mdi:cart-check
tap_action:
action: call-service
service: script.mealie_shopping_refresh
- type: iframe
url: /local/bilka_togo_checklist.html
aspect_ratio: 100%