Parse ingredient
Use this action to parse an ingredient from Mealie using the recognition method set within options, attempting to find matches in your food items and identify quantities and units.
This action returns its result in a response variable, which you can use in later steps of the same automation or script.
Using this action from the user interface
If you prefer building automations and scripts visually, Home Assistant walks you through this action step by step. You pick what to target, tweak a few options, and save. No YAML knowledge required.
To parse an ingredient from an automation or a script:
- Go to Settings > Automations & scenes.
- Open an existing automation or script, or select Create automation > Create new automation.
- If you’re setting up a new automation, add a trigger in the When section. Scripts don’t need a trigger. They run when something else calls them.
- In the Then do section, select Add action.
- From the search box, search for and select Mealie: Parse ingredient.
- Select the Mealie instance you want to use, and enter the ingredient you want to parse, such as
1 kg bananas. - In the Response variable field, enter a name to store the data in, such as
ingredient. - Select Save.
Options in the UI
Using this action in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required. For how an automation or a script is built in YAML, refer to Automations in YAML and Scripts.
In YAML, refer to this action as mealie.parse_ingredient. Store the result in a response variable so you can use it in later steps:
action: mealie.parse_ingredient
data:
config_entry_id: YOUR_MEALIE_CONFIG_ENTRY_ID
ingredient: "1 kg bananas"
response_variable: ingredient
This parses the food, unit, and quantity that matches 1 kg bananas with the confidence rating of matching accuracy and stores it in the ingredient response variable.
Options in YAML
Response data
The action returns the parsed ingredient, how confident Mealie is about the match, and the text you sent. The most useful keys are:
-
input: The text you sent, such as1 kg bananas. -
ingredient.quantity: The quantity, such as1.0. -
ingredient.unit.name: The unit, such askg. -
ingredient.food.name: The matched food, such asbananas. -
ingredient.display: The full ingredient as Mealie displays it. -
confidence.average: How confident Mealie is about the match, from0to1. -
confidence.acceptable_confidence:trueif the confidence is high enough for Mealie to-do lists to add the item as a food instead of a note.
Good to know
- The action uses the Recognition method set in the Mealie integration options.
-
acceptable_confidenceuses the same check as Mealie to-do lists. When Recognize food in new items is turned on, an item would be added as a food with a separate quantity and unit only ifacceptable_confidenceistrue. Otherwise, it would be added as a note. - If Mealie can’t parse the text at all, the action fails with the message “Mealie could not parse the ingredient.”
Still stuck?
To test the action on its own, run it in the automation editor with Run action, and check the message that it shows. To see what the action did when the automation ran, open the trace of that run. For details, refer to Testing automations. For common problems and their solutions, refer to Troubleshooting automations.
If that doesn’t help, the Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the action you’re calling and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain actions or suggest the right one when you describe what you want in plain language.
Related actions
Explore related actions:
-
Add ingredient: Adds an ingredient to Mealie.
-
Get recipe: Get a Mealie recipe by its ID or slug.
-
Get shopping list items: Get the items on a Mealie shopping list.
-
Add to-do list item: Adds a new item to a to-do list.