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

Make core config move backwards compatible #167

Merged
merged 3 commits into from
Nov 2, 2024
Merged

Conversation

elcajon
Copy link
Contributor

@elcajon elcajon commented Nov 1, 2024

@FL550
Copy link
Owner

FL550 commented Nov 1, 2024

Thanks for the PR.

So importing directly from homeassistant.core_config isn't the correct way? I can only find references to core_config. Where did you get the reference to helpers.typing from?

@elcajon
Copy link
Contributor Author

elcajon commented Nov 1, 2024

So importing directly from homeassistant.core_config isn't the correct way?

According to the HA dev draft blog post it is not the correct way if it is only used for async_setup.

Normally, integrations won't need to use the core Config class. But there's been custom integrations that have incorrect type annotations where the config object passed to the integration's async_setup is specified as a Config instance:

A correct type annotation would be like this:

from homeassistant.helpers.typing import ConfigType

async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
    """Set up the integration."""

@FL550
Copy link
Owner

FL550 commented Nov 2, 2024

Ah, I missed this one. Thanks for the explanation!

@FL550 FL550 merged commit 0bfa2e0 into FL550:master Nov 2, 2024
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants