FL550 / dwd_weather

Deutscher Wetterdienst integration for Home-Assistant
MIT License
197 stars 13 forks source link

Make core config move backwards compatible #167

Closed elcajon closed 3 weeks ago

elcajon commented 3 weeks ago

SSIA for reference https://github.com/home-assistant/developers.home-assistant/pull/2433/files

FL550 commented 3 weeks ago

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 commented 3 weeks ago

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 commented 3 weeks ago

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