dlarrick / hass-kumo

Home Assistant module interfacing with Mitsubishi mini-split units
MIT License
97 stars 21 forks source link

add await to async_forward_entry_setup #156

Closed bmos closed 1 month ago

bmos commented 2 months ago

working on a fix for https://github.com/dlarrick/hass-kumo/issues/152

I haven't tested this yet.

bmos commented 2 months ago

This is based on what I see in source code of other integrations: https://github.com/gody01/ecovent_v2/blob/da9919699538d3dd7c41c58a1d630480b1f94bf1/README.md?plain=1#L106-L108

https://github.com/toreamun/amshan-homeassistant/blob/7e1d8657cea15093a6b7a2d953aff875d9925381/custom_components/amshan/__init__.py#L136

I'm unclear whether both calls need await, as here it's just on the create_task call:

https://github.com/loso2255/HA_idrac7_redfish/blob/345dc78059a58a836ca77f3b599e3d065c6732dc/__init__.py#L70-L74

dlarrick commented 1 month ago

Thanks. I should be able to take a look this coming weekend.

dlarrick commented 1 month ago

Hmmm... components that ship with HA seem to use a different pattern, just:

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

.... not even looping over the platforms. Just picking one at random: https://github.com/home-assistant/core/blob/dev/homeassistant/components/aemet/__init__.py#L54

dlarrick commented 1 month ago

Yeah... note the new call is _setups (plural). This works and gets rid of the deprecation warning. Thanks for this PR, but I'm going to close it and include the above fix in my own PR.