Skip to content

Commit

Permalink
Merge pull request #390 from rrooggiieerr/master
Browse files Browse the repository at this point in the history
Fixes non async call async_forward_entry_setup
  • Loading branch information
Hellowlol authored Aug 16, 2024
2 parents 4b65997 + fe5367e commit 010bbc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions custom_components/nordpool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import Config, HomeAssistant
from homeassistant.const import Platform
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.event import async_track_time_change
Expand Down Expand Up @@ -44,6 +45,8 @@
-------------------------------------------------------------------
"""

PLATFORMS: list[Platform] = [Platform.SENSOR]


class NordpoolData:
"""Holds the data"""
Expand Down Expand Up @@ -197,17 +200,15 @@ async def async_setup(hass: HomeAssistant, config: Config) -> bool:
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up nordpool as config entry."""
res = await _dry_setup(hass, entry.data)
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, "sensor")
)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

entry.add_update_listener(async_reload_entry)
return res


async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
unload_ok = await hass.config_entries.async_forward_entry_unload(entry, "sensor")
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

if unload_ok:
# This is an issue if you have multiple sensors as everything related to DOMAIN
Expand Down
2 changes: 1 addition & 1 deletion custom_components/nordpool/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"backoff"
],
"version": "0.0.14"
}
}

0 comments on commit 010bbc8

Please sign in to comment.