Skip to content

Commit

Permalink
Deduplicate entity types
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-r committed Jan 15, 2024
1 parent 713d7ec commit 5977532
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions custom_components/ohme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ async def async_setup_entry(hass, entry):
hass.data[DOMAIN][DATA_COORDINATORS] = coordinators

# Create tasks for each entity type
entity_types = ["sensor", "binary_sensor", "switch", "button", "number", "time"]
for entity_type in entity_types:
for entity_type in ENTITY_TYPES:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, entity_type)
)
Expand All @@ -77,4 +76,4 @@ async def async_setup_entry(hass, entry):
async def async_unload_entry(hass, entry):
"""Unload a config entry."""

return await hass.config_entries.async_unload_platforms(entry, ['binary_sensor', 'sensor', 'switch'])
return await hass.config_entries.async_unload_platforms(entry, ENTITY_TYPES)

0 comments on commit 5977532

Please sign in to comment.