Skip to main content

Mealie smart home integration, free and open source

Mealie integration for Gladys Assistant

Your Mealie meal plan and shopping lists in Gladys: menus, scenes and widgets.

Mealie is a self-hosted recipe manager: your recipes, a meal plan for the week and shared shopping lists. This integration brings it into Gladys: one device shows today's and tomorrow's meals, the number of recipes and the items left to buy on each list; scenes can add an item to a list ("the milk is finished"), check one, plan a recipe, or send the menu of the day; two dashboard widgets show the menu and a shopping list, with buttons to add, check and plan from the wall tablet.

Tested against real Mealie 2.0.0 and 3.28 servers; not yet on a real Gladys installation: feedback welcome on the issues.

What you need​

  • Gladys Assistant 5.2.0 or later.
  • Mealie 2.0 or later (Mealie 1.x has no household API), reachable from the Gladys machine: on the local network, or on the Internet in HTTPS.
  • An API token of a Mealie user. It acts with the rights of that user, on the meal plan and the shopping lists of that user's household.

Getting started​

1. Create an API token​

In Mealie, click your avatar, open your profile, then API Tokens. Give the token a name (for example Gladys) and click Generate. Copy the token: Mealie shows it only once.

2. Configure the integration​

In Gladys, Integrations → Mealie → Configuration:

  • Mealie address: the address you open Mealie with, port included, for example http://192.168.1.2:9925 or https://mealie.example.com. An address copied from the browser (…/g/home/recipes) works too.
  • API token: the token of step 1.
  • Accept self-signed certificates: only for an https:// address whose certificate your browser does not trust either.
  • Refresh interval: how often Mealie is read, 5 minutes by default (1 to 15 minutes). What you do from Gladys shows at once.
  • Language of the names and messages: the language of the feature names and of the texts of the scene actions (French by default).

Save, then click Test the connection: Mealie answers with its version, its household and what it holds.

3. Add the device​

In Integrations → Mealie → Discover, add the Mealie device. Its values appear at once. When a shopping list is created in Mealie, the device offers Update in the Discover tab: its counter is added then.

The Mealie device​

One device per Mealie household (the household of the token's user). Its features:

FeatureTypeValue
Breakfast todayTextThe recipes (or notes) of the meal plan, or "Nothing planned"
Lunch todayTextSame
Dinner todayTextSame
Breakfast tomorrowTextSame, for tomorrow
Lunch tomorrowTextSame
Dinner tomorrowTextSame
RecipesCounterNumber of recipes in Mealie
To buy: <list>CounterItems still to buy on each shopping list (unchecked)

Two recipes for one meal show as Quiche lorraine · Salad. "Today" follows the time zone of Gladys: right after midnight, tomorrow's meals become today's. The names are given in the language of the configuration when the device is added, and stay as they are then (a Gladys rule).

Dashboard widgets​

In Dashboard → Edit dashboard, add a widget of the Mealie integration.

Meal plan​

  • Period: Today: the date and one row per meal of the day (breakfast, lunch, dinner, side, snack, drink, dessert).
  • Period: Next 7 days: one row per day, today and tomorrow marked; tap a day to see its meals.
  • Plan opens a short form (recipe, day, meal) and puts the recipe in the Mealie meal plan. An empty recipe lets Mealie pick one at random (its meal plan rules apply). The same recipe already planned for the same meal is not added twice.
  • Refresh reads Mealie again.
  • Open Mealie opens the meal planner, when Mealie has an https:// address (Gladys opens no other links).

Shopping list​

The items still to buy on one list (setting Shopping list: its name in Mealie; empty: the first list created), with their quantity and note.

  • Add opens a form with one field, Item: typed as it should read on the list. An item already on the list (upper case, accents and plural aside) is not added twice.
  • Check opens a form listing the items: the chosen one is checked in Mealie, as in its app (unchecking it there undoes it).
  • Refresh reads Mealie again.
  • Open Mealie opens the list, when Mealie has an https:// address.

Scenes​

Actions​

ActionFieldsResults
Add to the shopping listItem, Shopping list (empty: the first)Item added (yes/no), Item, list, items to buy
Check a shopping list itemItem, Shopping listItem checked (yes/no), Item, list, items to buy
Add a recipe to the meal planRecipe (empty: random), Day, MealRecipe added (yes/no), Recipe, Date
Get the meals of a dayDay (today, tomorrow, day after tomorrow)Breakfast, Lunch, Dinner, every meal of the day, meals planned
Get a shopping listShopping listItems to buy (comma separated), number, list
  • An item is found the way you say it: oeufs finds Œufs, tomatoes finds Tomato. A list is found by its name, or by its beginning (groc for Groceries).
  • A recipe is found by its name or part of it, like the Mealie search box.
  • An item already on the list is not added again: the result Item added is then "no". An item not on the list is not an error: Item checked is "no".
  • The results go into the next actions of the scene, for example a message Tonight: {{0.0.dinner}} (0.0: the position of the action in the scene; the message editor lists the results).
  • The meals snack, drink and dessert need Mealie 3.7 or later; an older Mealie knows breakfast, lunch, dinner and side.

Triggers​

None. What changes in Mealie (a meal planned, a list growing) is a state of the device: a scene starts on a change of To buy: Groceries or of Dinner today with the usual "device state" trigger.

Scene ideas​

  • "The milk is finished": a button (or a voice assistant) runs Add to the shopping list with Milk.
  • The menu in the morning: every day at 7:30, Get the meals of a day (today), then send Lunch: {{0.0.lunch}}, dinner: {{0.0.dinner}} on Telegram.
  • On the way to the shops: when someone leaves work, Get a shopping list, then send its items if there are some.
  • No dinner planned yet: at 17:00, if Dinner today is "Nothing planned", Add a recipe to the meal plan with no recipe (Mealie picks one), then announce it.

Refresh and use of the Mealie API​

The integration reads Mealie on its own timer (Gladys does not poll it), at the interval of the configuration, and right after midnight. One reading is four requests: the meal plan of the next seven days, the shopping lists, the items to buy of every list (one request), the statistics; "who am I" (version and household) is read again once an hour. Mealie sets no API quota. A scene action or a widget reads Mealie again when the last reading is older than 30 seconds; what the integration changes is read again at once.

Only the values that change are sent to Gladys, and every value again every 6 hours.

Troubleshooting​

  • "API token refused": the token was deleted or belongs to another Mealie. Create a new one (step 1).
  • "Mealie does not answer": check the address and the port from the Gladys machine (http://<address>:9925/api/app/about must answer). The device badge then shows "unreachable", and its values stay the last ones read.
  • "certificate refused": tick Accept self-signed certificates, or use the http:// address on the local network.
  • "Mealie 2.0 or later is needed": update Mealie.
  • "no Mealie at this address": the address answers with another web page (a reverse proxy login page…). Use the address of Mealie itself.
  • A list has no counter: open the Discover tab and click Update on the Mealie device.
  • More details: set the LOG_LEVEL environment variable to debug; the logs never contain the API token.

Limits​

  • One Mealie household per integration: the household of the token's user.
  • The device shows breakfast, lunch and dinner of today and tomorrow; the other meals (side, snack, drink, dessert) and the rest of the week are in the widget and in Get the meals of a day.
  • Items are added as free text (Mealie does not parse their quantity), and are never deleted: checked items stay in Mealie until you clear them there.
  • The Check form lists the first 50 items; the widget shows 7 items and the number of the others.
  • Open Mealie appears only for an https:// address.
  • Not tested on a real Gladys installation yet; tested against real Mealie 2.0.0 and 3.28 servers.

Configuration settings​

These are the settings Mealie asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
Your MealiesectionNoIn Mealie, open your profile, then API Tokens, generate a token and paste it below with the address of Mealie. Then add the Mealie device from the Discover tab.
Mealie addressstringYesThe address you open Mealie with, port included (9925 by default with Docker).
API tokensecretYesCreated in Mealie: profile → API Tokens → Generate. It acts with the rights of your user.
Accept self-signed certificatesbooleanNoOnly for an https:// address whose certificate your browser does not trust either.
Refresh intervalselectNoHow often Mealie is read. Gladys' own changes show at once.
Language of the names and messagesselectNoNames of the features (set when the device is added) and texts of the scene actions.

How to install Mealie in Gladys​

  1. In Gladys, open Integrations: Mealie appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/guim31/gladys-mealie:1.0.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/guim31/gladys-mealie.

Mealie requires Gladys >=5.2.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.

Not running Gladys yet? It is free and open source: follow the installation guide to get started.

About external integrations​

Mealie is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by guim31, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂