Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mealie fields as shown in the UI do not work in the integration #130558

Open
alexbarcelo opened this issue Nov 13, 2024 · 6 comments · May be fixed by #130606
Open

Mealie fields as shown in the UI do not work in the integration #130558

alexbarcelo opened this issue Nov 13, 2024 · 6 comments · May be fixed by #130606
Assignees

Comments

@alexbarcelo
Copy link
Contributor

alexbarcelo commented Nov 13, 2024

The problem

There are certain inconsistencies on the mealie integration (either that or I am looking at the wrong documentation).

First of all, the fields note_text and note_title are mentioned in the documentation and available in the UI, but trying to call set_mealplan with them populated result in an error.

The UI also says "ID or slug" when specifying the recipe_id field, but the validation clearly tries to check it against a UUID and fails if a slug is used instead.

What version of Home Assistant Core has the issue?

core-2024.11.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

mealie

Link to integration documentation on our website

https://www.home-assistant.io/integrations/mealie

Diagnostics information

No response

Example YAML snippet

action: mealie.set_mealplan
data:
  note_text: some notes
  note_title: some title
  recipe_id: 58451f87-bb28-40d5-b260-e43cf40d6958
  entry_type: lunch
  date: "2024-11-15"
  config_entry_id: 01J3G1V9RNGB2R15XJV5TSTNJ1

Anything in the logs that might be useful for us?

aiomealie.exceptions.MealieValidationError: ('Mealie validation error', {'response': '{"detail":[{"type":"uuid_parsing","loc":["body","recipeId"],"msg":"Input should be a valid UUID, invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-fA-F-], found `x` at 1","input":"xikkkkkchili","ctx":{"error":"invalid character: expected an optional prefix of `urn:uuid:` followed by [0-9a-fA-F-], found `x` at 1"}}]}'})

Failed to perform the action mealie.set_mealplan. extra keys not allowed @ data['note_text']. Got None extra keys not allowed @ data['note_title']. Got None

Additional information

No response

@home-assistant
Copy link

Hey there @joostlek, @andrew-codechimp, mind taking a look at this issue as it has been labeled with an integration (mealie) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of mealie can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign mealie Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


mealie documentation
mealie source
(message by IssueLinks)

@andrew-codechimp
Copy link
Contributor

Just done some investigation on this

recipe_id no longer accepts the slug, using the ID will work though as per example 1, possibly a breaking change in Mealie @joostlek since you wrote this piece maybe you have more thoughts?
The Notes fields state they are used when you are not using a recipe, this is working as intended and you specify either the recipe_id or notes as per example 2

action: mealie.set_mealplan
data:
  config_entry_id: 01J64VVNTQCB2G7E4MFMZ0Z2NS
  date: "2024-11-15"
  recipe_id: 415594b6-9a29-4e4d-b3a4-583df9065f61
  entry_type: dinner
action: mealie.set_mealplan
data:
  config_entry_id: 01J64VVNTQCB2G7E4MFMZ0Z2NS
  date: "2024-11-15"
  entry_type: breakfast
  note_title: Porridge
  note_text: With honey

@joostlek
Copy link
Member

Oh, did mealie change that? Let me check. I do like this added consistency though

@alexbarcelo
Copy link
Contributor Author

Ok, I see my confusion (and, I would argue, it's understandable given the error message). If you only set note_title or only set note_text, the error is something along:

Failed to perform the action mealie.set_mealplan. extra keys not allowed @ data['note_text']. Got None required key not provided @ data['recipe_id']. Got None

So I believed that.

You are right: the message is a lie! You can either set the recipe_id, or you can set both fields.

It would be nice to add a comment in the documentation and change slightly the error message... it's not a big deal, but without your reply I would have missed that and assumed that it was broken.

@joostlek
Copy link
Member

Oh but I think you should be able to set only note title. Let me check

@alexbarcelo
Copy link
Contributor Author

alexbarcelo commented Nov 14, 2024

I tested both individually 🤷 Home Assistant throws me the same error (changing data['note_text'] for data['note_title'] ofc).

I thought that it should allow me to do that, that's why I didn't bother to check both.

Thanks for looking into it, and thanks also to andrew for pointing out what I was missing :)

@joostlek joostlek linked a pull request Nov 14, 2024 that will close this issue
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants