|
7 | 7 | import voluptuous as vol
|
8 | 8 | from homeassistant.config_entries import ConfigEntry
|
9 | 9 | from homeassistant.core import Config, HomeAssistant
|
| 10 | +from homeassistant.const import Platform |
10 | 11 | from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
11 | 12 | from homeassistant.helpers.dispatcher import async_dispatcher_send
|
12 | 13 | from homeassistant.helpers.event import async_track_time_change
|
|
44 | 45 | -------------------------------------------------------------------
|
45 | 46 | """
|
46 | 47 |
|
| 48 | +PLATFORMS: list[Platform] = [Platform.SENSOR] |
| 49 | + |
47 | 50 |
|
48 | 51 | class NordpoolData:
|
49 | 52 | """Holds the data"""
|
@@ -197,17 +200,15 @@ async def async_setup(hass: HomeAssistant, config: Config) -> bool:
|
197 | 200 | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
198 | 201 | """Set up nordpool as config entry."""
|
199 | 202 | res = await _dry_setup(hass, entry.data)
|
200 |
| - hass.async_create_task( |
201 |
| - hass.config_entries.async_forward_entry_setup(entry, "sensor") |
202 |
| - ) |
| 203 | + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) |
203 | 204 |
|
204 | 205 | entry.add_update_listener(async_reload_entry)
|
205 | 206 | return res
|
206 | 207 |
|
207 | 208 |
|
208 | 209 | async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
209 | 210 | """Unload a config entry."""
|
210 |
| - unload_ok = await hass.config_entries.async_forward_entry_unload(entry, "sensor") |
| 211 | + unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) |
211 | 212 |
|
212 | 213 | if unload_ok:
|
213 | 214 | # This is an issue if you have multiple sensors as everything related to DOMAIN
|
|
0 commit comments