Mealie Menu generator

Hi All - Thought i would share this cool automation I made, This creates a meal plan in mealie for the next 7 days on Sunday morning. When I get undesirable results I usually just adjust the randomized menu from there, overall it’s less work than manually creating a meal plan every week. I use this also to create grocery lists to go back into home assistant when I go to the grocery store.

Enjoy

Rest Commands - goes in configuration.yaml (or wherever you keep you rest commands)

rest_command:
  mealie_random_dinner:
    url: "https://[mealieurl]/api/households/mealplans/random"
    method: POST
    headers:
      Authorization: !secret mealie_api_token # IMPORTANT: should be "Bearer <token>" unless your secret already includes Bearer
      Content-Type: application/json
      Accept: application/json
    payload: >
      {
        "date": "{{ date }}",
        "entryType": "dinner"
      }
  mealie_random_lunch:
    url: "https://[mealieurl]/api/households/mealplans/random"
    method: POST
    headers:
      Authorization: !secret mealie_api_token
      Content-Type: application/json
      Accept: application/json
    payload: >
      {
        "date": "{{ date }}",
        "entryType": "lunch"
      }
  mealie_random_side:
    url: "https://[mealieurl]/api/households/mealplans/random"
    method: POST
    headers:
      Authorization: !secret mealie_api_token
      Content-Type: application/json
      Accept: application/json
    payload: >
      {
        "date": "{{ date }}",
        "entryType": "side"
      }

Mealie token from secrets - Goes in secrets.yaml

mealie_api_token: Bearer [token]

Mealie lunch 7 day automation - Goes in the Automation UI

alias: Mealie - Lunch for 7 Days
description: ""
triggers:
  - trigger: time
    at: "08:00:00"
conditions:
  - condition: time
    weekday:
      - sun
    enabled: true
actions:
  - repeat:
      count: 7
      sequence:
        - variables:
            target_date: >-
              {{ (now() + timedelta(days=repeat.index - 1)).strftime('%Y-%m-%d')
              }}
        - action: rest_command.mealie_random_lunch
          data:
            date: "{{ target_date }}"
        - delay: "00:00:01"
mode: single

Mealie Dinner and side 7 day automation - goes in the automation UI

alias: Mealie - Dinner for next 7 days
description: ""
triggers:
  - trigger: time
    at: "08:00:00"
conditions:
  - condition: time
    weekday:
      - sun
    enabled: true
actions:
  - repeat:
      count: 7
      sequence:
        - variables:
            target_date: >-
              {{ (now() + timedelta(days=repeat.index - 1)).strftime('%Y-%m-%d')
              }}
        - action: rest_command.mealie_random_dinner
          data:
            date: "{{ target_date }}"
        - delay: "00:00:01"
        - action: rest_command.mealie_random_side
          data:
            date: "{{ target_date }}"
        - delay: "00:00:01"
mode: single

Produces a fully filled out meal plan from your recipies