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

Add Cookidoo integration #129800

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open

Add Cookidoo integration #129800

wants to merge 9 commits into from

Conversation

miaucl
Copy link
Contributor

@miaucl miaucl commented Nov 4, 2024

Proposed change

Add an integration for Cookidoo. We start by adding the shopping list, which is actually two lists in one. There is a list for all ingredients which are related to recipe one wants to cook and one for additional items. The additional items behaves as one would expect from a todo list, but the ingredients list can only be ticked off and not add/rename/delete is available, as the ingredients are controlled by the parent-recipe.

Brands: home-assistant/brands#6037

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

translation_key="setup_request_exception",
) from e
except CookidooAuthException as e:
raise ConfigEntryAuthFailed(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will trigger the reauth, use ConfigEntryNotReady while there isn't a reauth flow implemented

Suggested change
raise ConfigEntryAuthFailed(
raise ConfigEntryNotReady(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently there is a reauth implemented, depends on the decision on #129800 (comment)

errors=errors,
)

async def async_step_reauth(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reauth and reconfigure flows are usually not accepted in the first PR, they should be added in follow-up PRs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, sad. They are the same as in the bring integration and essential just copy paste.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will leave it in until home assistant tells me to remove it for a first PR :)

homeassistant/components/cookidoo/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/cookidoo/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/cookidoo/config_flow.py Outdated Show resolved Hide resolved
homeassistant/components/cookidoo/strings.json Outdated Show resolved Hide resolved
homeassistant/components/cookidoo/todo.py Outdated Show resolved Hide resolved
homeassistant/components/cookidoo/todo.py Outdated Show resolved Hide resolved
homeassistant/components/cookidoo/todo.py Outdated Show resolved Hide resolved
homeassistant/components/cookidoo/todo.py Outdated Show resolved Hide resolved
@miaucl
Copy link
Contributor Author

miaucl commented Nov 4, 2024

Questions remaining?

  • What to do about the reauth and reconfigure flows which are already implemented?
  • How to treat the selection of the localization (country, language)?

homeassistant/components/cookidoo/config_flow.py Outdated Show resolved Hide resolved
Comment on lines +57 to +63
reauth_entry: CookidooConfigEntry
reconfigure_entry: CookidooConfigEntry
AUTH_DATA_SCHEMA: dict
LOCALIZATION_DATA_SCHEMA: dict
country_codes: list[str]
languages: list[str]
localizations: list[CookidooLocalizationConfig]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move those to instance instead of class vars

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why and how? In did copy the bring setup which does have it like that? @zweckj

homeassistant/components/cookidoo/coordinator.py Outdated Show resolved Hide resolved
homeassistant/components/cookidoo/todo.py Outdated Show resolved Hide resolved
homeassistant/components/cookidoo/todo.py Outdated Show resolved Hide resolved
tests/components/cookidoo/test_init.py Outdated Show resolved Hide resolved
tests/components/cookidoo/test_todo.py Outdated Show resolved Hide resolved
tests/components/cookidoo/test_todo.py Outdated Show resolved Hide resolved
tests/components/cookidoo/test_todo.py Outdated Show resolved Hide resolved
tests/components/cookidoo/test_todo.py Outdated Show resolved Hide resolved
@joostlek
Copy link
Member

joostlek commented Nov 5, 2024

Ugh, I can't unread it as cookie dough now

@miaucl
Copy link
Contributor Author

miaucl commented Nov 5, 2024

Ugh, I can't unread it as cookie dough now

haha

(oups, commented and closed accidentally)

@miaucl miaucl closed this Nov 5, 2024
@miaucl miaucl reopened this Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants