Skip to content

Commit

Permalink
Fixes non async call async_forward_entry_setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rrooggiieerr committed Jul 3, 2024
1 parent 55eedb8 commit 3b3c9da
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 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,15 +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)
await hass.config_entries.async_forward_entry_setups(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

0 comments on commit 3b3c9da

Please sign in to comment.