Skip to content

zanix/MMM-MealieMenu

Repository files navigation

MMM-MealieMenu Version

GitHub issues GitHub pull requests GitHub forks GitHub stars License

Build status Last commit Commits

MMM-MealieMenu is a module for MagicMirror² that displays your Mealie meal plan for the week.

Description

This module shows your meal plan from Mealie.

Mealie is an intuitive and easy to use recipe management app. It's designed to make your life easier by being the best recipes management experience on the web and providing you with an easy to use interface to manage your growing collection of recipes.

Mealie is self-hostable, meaning you can run it on your own server without any reliance on cloud-services.

How it Works

After you installed MMM-MealieMenu you just configure it to your needs and that's it. You will need to provide the Mealie host and credentials as an apiKey or username & password.

For more information see the Configuration section.

Screenshots

Example: Mealie meal plan

Installation

Just clone MMM-MealieMenu into the modules folder of your MagicMirror² installation:

cd ~/MagicMirror/modules
git clone https://github.com/zanix/MMM-MealieMenu

Update

Go to the MMM-MealieMenu folder inside MagicMirror² modules folder and pull the latest version from GitHub:

cd ~/MagicMirror/modules/MMM-MealieMenu
git pull

Restart MagicMirror² after updating.

Configuration

The module is quite configurable. The only required options are host, apiKey (or username/password) - all other options are optional.

These are the possible options:

Option Description
host

The URL to your Mealie instance.

REQUIRED
Type: string
Example: "https://mealie.yourdomain.com"
Default value: none

apiKey

An API key generated from a user profile in Mealie.

REQUIRED When not using username and password
Type: string
Example: "eyhJbcG..."
Default value: none

Note: You can generate a key by going to your user profile in Mealie then to API Tokens link (or using this path /user/profile/api-tokens).

username

The username/email for your Mealie account.

REQUIRED When not using apiKey
Type: string
Example: "yourmeailieemail@email.com"
Default value: none

password

The password for your for Mealie account.

REQUIRED When not using apiKey
Type: string
Example: "Secret!"
Default value: none

groupId

The Group ID (as a UUID) to use when fetching the meal plan.

Type: string
Example: "c0aa0c1c-bdbb-4948-823b-2a725fb05ce1"
Default value: none ("Home" group)

Note 1: You can get the UUID of a group from Settings > Groups.

Note 2: The default "Home" group is used when this is blank.

weekStartsOnMonday

Show Monday as the first day of the week. Set to true to show Monday as the first day of the week.

Type: boolean
Default value: false
Possible values: true and false

priorDayLimit

How many previous days of the current week will be displayed.

Type: integer
Example: 5
Default value: 7
Unit: days

Note: If 0, only today until the end of the week will be shown.

priorEntryLimit

How many entries from previous days should be shown in total.

Type: integer
Example: 25
Default value: 50
Unit: days

Note: priorDayLimit takes precedence. For example, with 3 entries per day, priorEntryLimit set to 5 and priorDayLimit set to 1, you will only see 3 prior entries.

fadePriorEntries

Fade previous days in the current week.

Type: boolean
Default value: true
Possible values: true and false

showPictures

Show pictures corresponding to that days meal.

Type: boolean
Default value: true
Possible values: true and false

roundPictureCorners

Round the meal picture corners.

Type: boolean
Default value: false
Possible values: true and false

defaultPicture

Picture to display for missing recipe images or meal notes.

Type: string
Example: "https://img.icons8.com/nolan/64/meal.png"
Default value: "mealie.png"

Note: If the image does not have http or / in the name, the MMM-MealieMenu module path will be prepended to the name.

showDescription

Show the recipe description or meal note.

Type: boolean
Default value: false
Possible values: true and false

dateFormat

Display format for the date; uses moment.js format string

Type: string
Example: "ddd DD"
Default value: "dddd"

dateMealSeperator

Set the separator between the date and meal type.

Type: string
Example: " | "
Default value: " - "

Note: Above each menu item, the date and meal type are displayed. For example, by default you'll see "Tuesday - Dinner". This setting controls the characters separating dateFormat and the meal display.

mealSortOrder

An array determining the order of the meal type headers.

Type: array
Example: [ "lunch", "dinner" ]
Default value: [ "breakfast", "lunch", "dinner", "side" ]
Possible values: [ "breakfast", "lunch", "dinner", "side" ]

Note 1: You can remove a meal type here by removing the value.

Note 2: The vaules MUST match the possible values above. You can change what is displayed using the mealTypeName options below.

mealTypeName

An object defining strings which are to be replaced in the displayed directions.

Type: object
Example: { "side": "Meal Prep", "dinner": "Supper" }
Default value: {}

Note: The strings which appear as the keys of the object will be replaced by their values. Given a meal type "side" and the above mentioned example setting the displayed meal type will be "Meal Prep".

Note 2: If you want to replace special symbols like (, ) or - you must escape these characters by placing two back-slashes \ in front of the character.

updateInterval

The time in seconds when the meal plan should be updated.

Type: integer
Example: 60 (The meal plan will be refreshed every minute.)
Default value: 60
Unit: seconds

animationSpeed

Speed of the update animation.

Type: integer
Possible values: 0 - 5000
Default value: 500
Unit: milliseconds

displayLastUpdate

Display the last update time at the end of the meal plan list. See screenshot above

Type: boolean
Default value: true
Possible values: true and false

displayLastUpdateFormat

Format to use for the time display if displayLastUpdate:true; uses moment.js format string

Type: string
Example: 'HH:mm:ss'
Default value: 'MMM D - h:mm:ss a'

Here is an example of an entry in config.js. Take note of mealTypeName and mealSortOrder. Here, we use the side meal type as a reminder of things we need to do to prepare for future meals, e.g., thaw meat. mealTypeName changes what appears, and mealSortOrder moves the snack entries to the top of the list for that day.

{
    module: "MMM-MealieMenu",
    header: "Dinner Menu",
    position: "top_left",
    config: {
        apiKey: "eyhJbcG...",                  // Not needed when using username/password
        username: "yourmealieemail@email.com", // Not needed when using apiKey
        password: "Secret!",                   // Not needed when using apiKey
        weekStartsOnMonday: true,
        roundPictureCorners: true,
        mealSortOrder: ["side", "breakfast", "lunch", "dinner"],
        mealTypeName: {
            side: "Meal Prep"
        }
    }
},

Multiple Instances

It is possible to use multiple instances of this module just by adding another entry of the MMM-MealieMenu module to the config.js of your mirror.

Special Thanks

Contributing

If you find any problems, bugs or have questions, please open a GitHub issue in this repository.

Pull requests are of course very welcome. Please see Contributing and the Pull Request Template for details.