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:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation or script, or select Create automation > Create new automation.
  3. 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.
  4. In the Then do section, select Add action.
  5. From the search box, search for and select Mealie: Parse ingredient.
  6. Select the Mealie instance you want to use, and enter the ingredient you want to parse, such as 1 kg bananas.
  7. In the Response variable field, enter a name to store the data in, such as ingredient.
  8. Select Save.

Options in the UI

Mealie instance

The Mealie instance to parse the ingredient from.

Ingredient (Required)

The ingredient to find matches for in your food items and identify quantities and units.

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:

ActionAn action makes Home Assistant do something, for example, turn on a light, send a notification, or activate a scene. Automations and scripts run a list of actions. [Learn more]
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

config_entry_id string Required

The ID of the Mealie config entry to parse the ingredient from.

ingredient string Required

The ingredient to find matches for in your food items and identify quantities and units.

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 as 1 kg bananas.
  • ingredient.quantity: The quantity, such as 1.0.
  • ingredient.unit.name: The unit, such as kg.
  • ingredient.food.name: The matched food, such as bananas.
  • ingredient.display: The full ingredient as Mealie displays it.
  • confidence.average: How confident Mealie is about the match, from 0 to 1.
  • confidence.acceptable_confidence: true if 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_confidence uses 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 if acceptable_confidence is true. 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.

Tip

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: