Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions homeassistant/components/accuweather/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from async_timeout import timeout

from homeassistant.const import CONF_API_KEY
from homeassistant.core import Config, HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
Expand All @@ -26,12 +25,6 @@
PLATFORMS = ["sensor", "weather"]


async def async_setup(hass: HomeAssistant, config: Config) -> bool:
"""Set up configured AccuWeather."""
hass.data.setdefault(DOMAIN, {})
return True


async def async_setup_entry(hass, config_entry) -> bool:
"""Set up AccuWeather as config entry."""
api_key = config_entry.data[CONF_API_KEY]
Expand All @@ -52,7 +45,7 @@ async def async_setup_entry(hass, config_entry) -> bool:

undo_listener = config_entry.add_update_listener(update_listener)

hass.data[DOMAIN][config_entry.entry_id] = {
hass.data.setdefault(DOMAIN, {})[config_entry.entry_id] = {
COORDINATOR: coordinator,
UNDO_UPDATE_LISTENER: undo_listener,
}
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/adguard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import ConfigType

_LOGGER = logging.getLogger(__name__)

Expand All @@ -49,11 +48,6 @@
PLATFORMS = ["sensor", "switch"]


async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the AdGuard Home components."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up AdGuard Home from a config entry."""
session = async_get_clientsession(hass, entry.data[CONF_VERIFY_SSL])
Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/airnow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
PLATFORMS = ["sensor"]


async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the AirNow component."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up AirNow from a config entry."""
api_key = entry.data[CONF_API_KEY]
Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/deconz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
)


async def async_setup(hass, config):
"""Old way of setting up deCONZ integrations."""
return True


async def async_setup_entry(hass, config_entry):
"""Set up a deCONZ bridge for a config entry.

Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/dsmr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
from .const import DATA_LISTENER, DATA_TASK, DOMAIN, PLATFORMS


async def async_setup(hass, config: dict):
"""Set up the DSMR platform."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up DSMR from a config entry."""
hass.data.setdefault(DOMAIN, {})
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/elgato/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,10 @@
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType

from .const import DATA_ELGATO_CLIENT, DOMAIN


async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Elgato Key Light components."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Elgato Key Light from a config entry."""
session = async_get_clientsession(hass)
Expand Down
7 changes: 1 addition & 6 deletions homeassistant/components/esphome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
from homeassistant.helpers.service import async_set_service_schema
from homeassistant.helpers.storage import Store
from homeassistant.helpers.template import Template
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.typing import HomeAssistantType

# Import config flow so that it's added to the registry
from .entry_data import RuntimeEntryData
Expand All @@ -56,11 +56,6 @@
CONFIG_SCHEMA = vol.Schema({}, extra=vol.ALLOW_EXTRA)


async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Stub to allow setting up this component."""
return True


async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
"""Set up the esphome component."""
hass.data.setdefault(DOMAIN, {})
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/fireservicerota/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
PLATFORMS = [SENSOR_DOMAIN, BINARYSENSOR_DOMAIN, SWITCH_DOMAIN]


async def async_setup(hass: HomeAssistant, config: dict) -> bool:
"""Set up the FireServiceRota component."""

return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up FireServiceRota from a config entry."""

Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/forked_daapd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
from .const import DOMAIN, HASS_DATA_REMOVE_LISTENERS_KEY, HASS_DATA_UPDATER_KEY


async def async_setup(hass, config):
"""Set up the forked-daapd component."""
return True


async def async_setup_entry(hass, entry):
"""Set up forked-daapd from a config entry by forwarding to platform."""
hass.async_create_task(
Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/fritzbox_callmonitor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@
_LOGGER = logging.getLogger(__name__)


async def async_setup(hass, config):
"""Set up the fritzbox_callmonitor integration."""
return True


async def async_setup_entry(hass, config_entry):
"""Set up the fritzbox_callmonitor platforms."""
fritzbox_phonebook = FritzBoxPhonebook(
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/gios/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from async_timeout import timeout
from gios import ApiError, Gios, InvalidSensorsData, NoStationError

from homeassistant.core import Config, HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
Expand All @@ -15,11 +14,6 @@
_LOGGER = logging.getLogger(__name__)


async def async_setup(hass: HomeAssistant, config: Config) -> bool:
"""Set up configured GIOS."""
return True


async def async_setup_entry(hass, config_entry):
"""Set up GIOS as config entry."""
station_id = config_entry.data[CONF_STATION_ID]
Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/gogogate2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
PLATFORMS = [COVER, SENSOR]


async def async_setup(hass: HomeAssistant, base_config: dict) -> bool:
"""Set up for Gogogate2 controllers."""
return True


async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Do setup of Gogogate2."""

Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/squeezebox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
_LOGGER = logging.getLogger(__name__)


async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Logitech Squeezebox component."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Logitech Squeezebox from a config entry."""
hass.async_create_task(
Expand Down
7 changes: 1 addition & 6 deletions homeassistant/components/starline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_SCAN_INTERVAL
from homeassistant.core import Config, HomeAssistant
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady

from .account import StarlineAccount
Expand All @@ -19,11 +19,6 @@
)


async def async_setup(hass: HomeAssistant, config: Config) -> bool:
"""Set up configured StarLine."""
return True


async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
"""Set up the StarLine device from a config entry."""
account = StarlineAccount(hass, config_entry)
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/tasmota/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
EVENT_DEVICE_REGISTRY_UPDATED,
async_entries_for_config_entry,
)
from homeassistant.helpers.typing import HomeAssistantType

from . import device_automation, discovery
from .const import (
Expand All @@ -38,11 +37,6 @@
_LOGGER = logging.getLogger(__name__)


async def async_setup(hass: HomeAssistantType, config: dict):
"""Set up the Tasmota component."""
return True


async def async_setup_entry(hass, entry):
"""Set up Tasmota from a config entry."""
websocket_api.async_register_command(hass, websocket_remove_device)
Expand Down
8 changes: 1 addition & 7 deletions homeassistant/components/upb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import upb_lib

from homeassistant.const import ATTR_COMMAND, CONF_FILE_PATH, CONF_HOST
from homeassistant.core import HomeAssistant, callback
from homeassistant.core import callback
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import ConfigType

from .const import (
ATTR_ADDRESS,
Expand All @@ -19,11 +18,6 @@
PLATFORMS = ["light", "scene"]


async def async_setup(hass: HomeAssistant, hass_config: ConfigType) -> bool:
"""Set up the UPB platform."""
return True


async def async_setup_entry(hass, config_entry):
"""Set up a new config_entry for UPB PIM."""

Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/volumio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
PLATFORMS = ["media_player"]


async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the Volumio component."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Volumio from a config entry."""

Expand Down
5 changes: 0 additions & 5 deletions homeassistant/components/wiffi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
PLATFORMS = ["sensor", "binary_sensor"]


async def async_setup(hass: HomeAssistant, config: dict):
"""Set up the wiffi component. config contains data from configuration.yaml."""
return True


async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):
"""Set up wiffi from a config entry, config_entry contains data from config entry database."""
if not config_entry.update_listeners:
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/wled/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
Expand All @@ -37,11 +36,6 @@
_LOGGER = logging.getLogger(__name__)


async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the WLED components."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up WLED from a config entry."""

Expand Down
13 changes: 8 additions & 5 deletions homeassistant/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def log_error(msg: str, link: str | None = None) -> None:
return False

if integration.disabled:
log_error(f"dependency is disabled - {integration.disabled}")
log_error(f"Dependency is disabled - {integration.disabled}")
return False

# Validate all dependencies exist and there are no circular dependencies
Expand Down Expand Up @@ -197,6 +197,8 @@ def log_error(msg: str, link: str | None = None) -> None:
SLOW_SETUP_WARNING,
)

task = None
result = True
try:
if hasattr(component, "async_setup"):
task = component.async_setup(hass, processed_config) # type: ignore
Expand All @@ -206,13 +208,14 @@ def log_error(msg: str, link: str | None = None) -> None:
task = hass.loop.run_in_executor(
None, component.setup, hass, processed_config # type: ignore
)
else:
log_error("No setup function defined.")
elif not hasattr(component, "async_setup_entry"):
log_error("No setup or config entry setup function defined.")
hass.data[DATA_SETUP_STARTED].pop(domain)
return False

async with hass.timeout.async_timeout(SLOW_SETUP_MAX_WAIT, domain):
result = await task
if task:
async with hass.timeout.async_timeout(SLOW_SETUP_MAX_WAIT, domain):
result = await task
except asyncio.TimeoutError:
_LOGGER.error(
"Setup of %s is taking longer than %s seconds."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import annotations

import asyncio
from typing import Any

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
Expand All @@ -14,11 +13,6 @@
PLATFORMS = ["light"]


async def async_setup(hass: HomeAssistant, config: dict[str, Any]) -> bool:
"""Set up the NEW_NAME component."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up NEW_NAME from a config entry."""
# TODO Store an API object for your platforms to access
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ async def test_form(hass: HomeAssistant) -> None:
"homeassistant.components.NEW_DOMAIN.config_flow.PlaceholderHub.authenticate",
return_value=True,
), patch(
"homeassistant.components.NEW_DOMAIN.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.NEW_DOMAIN.async_setup_entry",
return_value=True,
) as mock_setup_entry:
Expand All @@ -42,7 +40,6 @@ async def test_form(hass: HomeAssistant) -> None:
"username": "test-username",
"password": "test-password",
}
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1


Expand Down
Loading