Skip to content

Commit 010bbc8

Browse files
authored
Merge pull request #390 from rrooggiieerr/master
Fixes non async call async_forward_entry_setup
2 parents 4b65997 + fe5367e commit 010bbc8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

custom_components/nordpool/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import voluptuous as vol
88
from homeassistant.config_entries import ConfigEntry
99
from homeassistant.core import Config, HomeAssistant
10+
from homeassistant.const import Platform
1011
from homeassistant.helpers.aiohttp_client import async_get_clientsession
1112
from homeassistant.helpers.dispatcher import async_dispatcher_send
1213
from homeassistant.helpers.event import async_track_time_change
@@ -44,6 +45,8 @@
4445
-------------------------------------------------------------------
4546
"""
4647

48+
PLATFORMS: list[Platform] = [Platform.SENSOR]
49+
4750

4851
class NordpoolData:
4952
"""Holds the data"""
@@ -197,17 +200,15 @@ async def async_setup(hass: HomeAssistant, config: Config) -> bool:
197200
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
198201
"""Set up nordpool as config entry."""
199202
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)
203204

204205
entry.add_update_listener(async_reload_entry)
205206
return res
206207

207208

208209
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
209210
"""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)
211212

212213
if unload_ok:
213214
# This is an issue if you have multiple sensors as everything related to DOMAIN

custom_components/nordpool/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
"backoff"
1818
],
1919
"version": "0.0.14"
20-
}
20+
}

0 commit comments

Comments
 (0)