Skip to content

Commit

Permalink
fix: remove async_setup to pass hassfest
Browse files Browse the repository at this point in the history
  • Loading branch information
Olen committed Oct 8, 2024
1 parent e2231e9 commit 36a46e3
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions custom_components/plant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,29 +83,31 @@
SETUP_DUMMY_SENSORS = False
USE_DUMMY_SENSORS = False


async def async_setup(hass: HomeAssistant, config: dict):
"""
Set up the plant component
Configuration.yaml is no longer used.
This function only tries to migrate the legacy config.
"""
if config.get(DOMAIN):
# Only import if we haven't before.
config_entry = _async_find_matching_config_entry(hass)
if not config_entry:
_LOGGER.debug("Old setup - with config: %s", config[DOMAIN])
for plant in config[DOMAIN]:
if plant != DOMAIN_PLANTBOOK:
_LOGGER.info("Migrating plant: %s", plant)
await async_migrate_plant(hass, plant, config[DOMAIN][plant])
else:
_LOGGER.warning(
"Config already imported. Please delete all your %s related config from configuration.yaml",
DOMAIN,
)
return True
# Removed.
# Have not been used for a long time
#
# async def async_setup(hass: HomeAssistant, config: dict):
# """
# Set up the plant component
#
# Configuration.yaml is no longer used.
# This function only tries to migrate the legacy config.
# """
# if config.get(DOMAIN):
# # Only import if we haven't before.
# config_entry = _async_find_matching_config_entry(hass)
# if not config_entry:
# _LOGGER.debug("Old setup - with config: %s", config[DOMAIN])
# for plant in config[DOMAIN]:
# if plant != DOMAIN_PLANTBOOK:
# _LOGGER.info("Migrating plant: %s", plant)
# await async_migrate_plant(hass, plant, config[DOMAIN][plant])
# else:
# _LOGGER.warning(
# "Config already imported. Please delete all your %s related config from configuration.yaml",
# DOMAIN,
# )
# return True


@callback
Expand Down

0 comments on commit 36a46e3

Please sign in to comment.