From 5977532d7f76b1d774f0ed6257daf5d3330cfd05 Mon Sep 17 00:00:00 2001 From: Daniel Raper Date: Mon, 15 Jan 2024 17:00:36 +0000 Subject: [PATCH] Deduplicate entity types --- custom_components/ohme/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/custom_components/ohme/__init__.py b/custom_components/ohme/__init__.py index cbea312..d7c4c34 100644 --- a/custom_components/ohme/__init__.py +++ b/custom_components/ohme/__init__.py @@ -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) ) @@ -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)