Skip to content

Commit 116f793

Browse files
Fix deleting and readding nws entry (#34555)
* fix deleting and readding nws * Clean up * Fix variable name clash Co-authored-by: Martin Hjelmare <[email protected]>
1 parent 561b033 commit 116f793

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

homeassistant/components/nws/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def base_unique_id(latitude, longitude):
5353

5454
async def async_setup(hass: HomeAssistant, config: dict):
5555
"""Set up the National Weather Service (NWS) component."""
56-
hass.data.setdefault(DOMAIN, {})
5756
return True
5857

5958

@@ -93,8 +92,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
9392
update_method=nws_data.update_forecast_hourly,
9493
update_interval=DEFAULT_SCAN_INTERVAL,
9594
)
96-
97-
hass.data[DOMAIN][entry.entry_id] = {
95+
nws_hass_data = hass.data.setdefault(DOMAIN, {})
96+
nws_hass_data[entry.entry_id] = {
9897
NWS_DATA: nws_data,
9998
COORDINATOR_OBSERVATION: coordinator_observation,
10099
COORDINATOR_FORECAST: coordinator_forecast,

0 commit comments

Comments
 (0)