Mealie
Mealie
Use cases
- View your upcoming meal plans in the calendars.
- Use automations or your voice assistant to add items to a shopping list.
- Use zone presence-detection to remind you when you approach a store that you have items on your shopping list to pick up.
- Search for a recipe by ingredient.
Supported versions
Mealie instances version 2 and later are supported.
Prerequisites
You create your API token on your Mealie installation:
- Sign in to Mealie.
- Go to your user (profile).
- Go to Manage Your API Tokens under (
/user/profile/api-tokens). - Enter a meaningful token name, such as ‘Home Assistant’.
- Select Generate.
- Copy the token that now appears so that you can later paste it into Home Assistant.
Configuration
To add the Mealie service to your Home Assistant instance, use this My button:
Manual configuration steps
If the above My button doesn’t work, you can also perform the following steps manually:
-
Browse to your Home Assistant instance.
-
In the bottom right corner, select the
Add Integration button. -
From the list, select Mealie.
-
Follow the instructions on screen to complete the setup.
Available calendars
The integration will create a calendar for every type of meal plan, which are updated once an hour:
- Breakfast
- Lunch
- Dinner
- Side
Shopping Lists
The integration will create a to-do list for every Mealie shopping list, which are updated every 5 minutes.
Sensors
The integration provides the following sensors for the statistics, which are updated every 15 minutes:
- number of recipes
- categories (such as beverage, dessert, Italian, seafood)
- tags (such as alcohol)
- tools (such as instant pot, air fryer, or BBQ)
- users
Actions
The Mealie integration has the following actions:
mealie.get_mealplanmealie.get_recipemealie.get_recipesmealie.import_recipemealie.set_mealplanmealie.set_random_mealplan
Action mealie.get_mealplan
Get the meal plan for a specified range.
| Data attribute | Optional | Description |
|---|---|---|
config_entry_id |
No | The ID of the Mealie config entry to get data from. |
start_date |
Yes | The start date of the meal plan. (today if not supplied) |
end_date |
Yes | The end date of the meal plan. (today if not supplied) |
Action mealie.get_recipe
Get the recipe for a specified recipe ID or slug.
| Data attribute | Optional | Description |
|---|---|---|
config_entry_id |
No | The ID of the Mealie config entry to get data from. |
recipe_id |
No | The ID or the slug of the recipe to get. |
Action mealie.get_recipes
Get a list of recipes that match your search terms. You can use this action to find the recipe ID or slug. The response includes a brief description of each recipe. To view full details and steps for a specific recipe, use the mealie.get_recipe action afterwards.
Please note the behavior of the search function depends on the backend used for Mealie (see documentation
| Data attribute | Optional | Description |
|---|---|---|
config_entry_id |
No | The ID of the Mealie config entry to get data from. |
search_terms |
Yes | Search terms on which all the properties of recipes are searched. |
result_limit |
Yes | The maximum number of recipes to return. |
Action mealie.import_recipe
Import the recipe into Mealie from a URL.
| Data attribute | Optional | Description |
|---|---|---|
config_entry_id |
No | The ID of the Mealie config entry to get data from. |
url |
No | The URL of the recipe. |
include_tags |
Yes | Include tags from the website to the recipe. (false by default) |
Action mealie.set_mealplan
Set a mealplan on a specific date.
| Data attribute | Optional | Description |
|---|---|---|
config_entry_id |
No | The ID of the Mealie config entry to get data from. |
date |
No | The date that should be filled. |
entry_type |
No | One of “breakfast”, “lunch”, “dinner”, or “side”. |
recipe_id |
Yes | The recipe to plan. |
note_title |
Yes | The title of the meal note. |
note_text |
Yes | The description of the meal note. |
Action mealie.set_random_mealplan
Set a random mealplan on a specific date.
| Data attribute | Optional | Description |
|---|---|---|
config_entry_id |
No | The ID of the Mealie config entry to get data from. |
date |
No | The date that should be filled. |
entry_type |
No | One of “breakfast”, “lunch”, “dinner” or “side”. |
You can get your config_entry_id by using actions within Developer Tools, using one of the above actions and viewing the YAML.
Examples
Example template sensor using get_mealplan
Example template sensor that contains today’s dinner meal plan entries:
template:
- triggers:
- trigger: time_pattern
hours: /1
actions:
- action: mealie.get_mealplan
data:
config_entry_id: YOUR_MEALIE_CONFIG_ENTITY_ID
response_variable: result
sensor:
- name: "Dinner today"
unique_id: mealie_dinner_today
state: >
{% for meal in result.mealplan if meal.entry_type == "dinner" -%}
{{ meal.recipe['name'] if meal.recipe is not none else meal.title -}}
{{ ", " if not loop.last }}
{%- endfor %}
Known limitations
- When editing a food item within the shopping list the item will be converted to a note style item.
Troubleshooting
If you are using the Mealie add-on, use the direct URL with port number (default 9090) for the Mealie web page. Do not use the ingress URL that ends with /xxx_mealie.
Before reporting an issue, enable debug logging and restart the integration. As soon as the issue re-occurs, stop the debug logging again (download of debug log file will start automatically). Further, if still possible, download the diagnosticsThe diagnostics integration provides a way to download diagnostic data from a device or integration for sharing in issue reports. Sharing diagnostics data when reporting an issue allows developers to diagnose and fix your reported problem quicker. [Learn more] data. If you have collected the debug log and the diagnostics data, include them in the issue report.
Removing the integration
This integration follows standard integration removal, once the integration is removed you can remove the API token (assuming it was only used by this integration) by going to your Account in the Mealie web interface, then to Manage Your API Tokens and deleting the token you created for Home Assistant.
To remove an integration instance from Home Assistant
- Go to Settings > Devices & services and select the integration card.
- From the list of devices, select the integration instance you want to remove.
- Next to the entry, select the three dots
menu. Then, select Delete.