Clean up superfluous integration setup - part 6 (#49298)
This commit is contained in:
parent
af80ca6795
commit
7264c95217
38 changed files with 22 additions and 199 deletions
|
@ -22,16 +22,11 @@ from .const import CONF_TOKEN_EXPIRES_IN, CONF_TOKEN_EXPIRY, DOMAIN
|
||||||
CONF_ID_TOKEN = "id_token"
|
CONF_ID_TOKEN = "id_token"
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the Flick Electric component."""
|
|
||||||
hass.data[DOMAIN] = {}
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Flick Electric from a config entry."""
|
"""Set up Flick Electric from a config entry."""
|
||||||
auth = HassFlickAuth(hass, entry)
|
auth = HassFlickAuth(hass, entry)
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = FlickAPI(auth)
|
hass.data[DOMAIN][entry.entry_id] = FlickAPI(auth)
|
||||||
|
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
|
|
|
@ -19,15 +19,10 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
PLATFORMS = ["binary_sensor", "sensor", "switch"]
|
PLATFORMS = ["binary_sensor", "sensor", "switch"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the flo component."""
|
|
||||||
hass.data[DOMAIN] = {}
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up flo from a config entry."""
|
"""Set up flo from a config entry."""
|
||||||
session = async_get_clientsession(hass)
|
session = async_get_clientsession(hass)
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = {}
|
hass.data[DOMAIN][entry.entry_id] = {}
|
||||||
try:
|
try:
|
||||||
hass.data[DOMAIN][entry.entry_id][CLIENT] = client = await async_get_api(
|
hass.data[DOMAIN][entry.entry_id][CLIENT] = client = await async_get_api(
|
||||||
|
|
|
@ -16,13 +16,6 @@ from .data import HarmonyData
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the Logitech Harmony Hub component."""
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Logitech Harmony Hub from a config entry."""
|
"""Set up Logitech Harmony Hub from a config entry."""
|
||||||
# As there currently is no way to import options from yaml
|
# As there currently is no way to import options from yaml
|
||||||
|
@ -42,6 +35,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
if not connected_ok:
|
if not connected_ok:
|
||||||
raise ConfigEntryNotReady
|
raise ConfigEntryNotReady
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = data
|
hass.data[DOMAIN][entry.entry_id] = data
|
||||||
|
|
||||||
await _migrate_old_unique_ids(hass, entry.entry_id, data)
|
await _migrate_old_unique_ids(hass, entry.entry_id, data)
|
||||||
|
|
|
@ -63,12 +63,6 @@ PLATFORMS = ["cover", "scene", "sensor"]
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, hass_config: dict):
|
|
||||||
"""Set up the Hunter Douglas PowerView component."""
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Hunter Douglas PowerView from a config entry."""
|
"""Set up Hunter Douglas PowerView from a config entry."""
|
||||||
|
|
||||||
|
@ -122,6 +116,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
update_interval=timedelta(seconds=60),
|
update_interval=timedelta(seconds=60),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
PV_API: pv_request,
|
PV_API: pv_request,
|
||||||
PV_ROOM_DATA: room_data,
|
PV_ROOM_DATA: room_data,
|
||||||
|
|
|
@ -40,15 +40,9 @@ SCAN_INTERVAL = timedelta(seconds=60)
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
|
||||||
"""Set up the IPP component."""
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up IPP from a config entry."""
|
"""Set up IPP from a config entry."""
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
coordinator = hass.data[DOMAIN].get(entry.entry_id)
|
coordinator = hass.data[DOMAIN].get(entry.entry_id)
|
||||||
if not coordinator:
|
if not coordinator:
|
||||||
# Create IPP instance for this entry
|
# Create IPP instance for this entry
|
||||||
|
|
|
@ -13,15 +13,9 @@ from .hub import LitterRobotHub
|
||||||
PLATFORMS = ["sensor", "switch", "vacuum"]
|
PLATFORMS = ["sensor", "switch", "vacuum"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the Litter-Robot component."""
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Litter-Robot from a config entry."""
|
"""Set up Litter-Robot from a config entry."""
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hub = hass.data[DOMAIN][entry.entry_id] = LitterRobotHub(hass, entry.data)
|
hub = hass.data[DOMAIN][entry.entry_id] = LitterRobotHub(hass, entry.data)
|
||||||
try:
|
try:
|
||||||
await hub.login(load_robots=True)
|
await hub.login(load_robots=True)
|
||||||
|
|
|
@ -38,12 +38,6 @@ async def with_timeout(task, timeout_seconds=10):
|
||||||
return await task
|
return await task
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the Mazda Connected Services component."""
|
|
||||||
hass.data[DOMAIN] = {}
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Mazda Connected Services from a config entry."""
|
"""Set up Mazda Connected Services from a config entry."""
|
||||||
email = entry.data[CONF_EMAIL]
|
email = entry.data[CONF_EMAIL]
|
||||||
|
@ -111,6 +105,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
update_interval=timedelta(seconds=60),
|
update_interval=timedelta(seconds=60),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
DATA_CLIENT: mazda_client,
|
DATA_CLIENT: mazda_client,
|
||||||
DATA_COORDINATOR: coordinator,
|
DATA_COORDINATOR: coordinator,
|
||||||
|
|
|
@ -23,11 +23,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
PLATFORMS = ["sensor", "weather"]
|
PLATFORMS = ["sensor", "weather"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the Met Office weather component."""
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up a Met Office entry."""
|
"""Set up a Met Office entry."""
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,6 @@ PLATFORMS = ["binary_sensor", "sensor"]
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
|
||||||
"""Set up the Minecraft Server component."""
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry) -> bool:
|
||||||
"""Set up Minecraft Server from a config entry."""
|
"""Set up Minecraft Server from a config entry."""
|
||||||
domain_data = hass.data.setdefault(DOMAIN, {})
|
domain_data = hass.data.setdefault(DOMAIN, {})
|
||||||
|
|
|
@ -23,11 +23,6 @@ PLATFORMS = ["media_player"]
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the Monoprice 6-Zone Amplifier component."""
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Monoprice 6-Zone Amplifier from a config entry."""
|
"""Set up Monoprice 6-Zone Amplifier from a config entry."""
|
||||||
port = entry.data[CONF_PORT]
|
port = entry.data[CONF_PORT]
|
||||||
|
|
|
@ -24,14 +24,6 @@ CONFIG_SCHEMA = cv.deprecated(DOMAIN)
|
||||||
DEFAULT_UPDATE_RATE = 120
|
DEFAULT_UPDATE_RATE = 120
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
|
|
||||||
"""Set up the nexia component from YAML."""
|
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Configure the base Nexia device for Home Assistant."""
|
"""Configure the base Nexia device for Home Assistant."""
|
||||||
|
|
||||||
|
@ -75,6 +67,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
update_interval=timedelta(seconds=DEFAULT_UPDATE_RATE),
|
update_interval=timedelta(seconds=DEFAULT_UPDATE_RATE),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
NEXIA_DEVICE: nexia_home,
|
NEXIA_DEVICE: nexia_home,
|
||||||
UPDATE_COORDINATOR: coordinator,
|
UPDATE_COORDINATOR: coordinator,
|
||||||
|
|
|
@ -25,12 +25,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
|
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the NuHeat component."""
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def _get_thermostat(api, serial_number):
|
def _get_thermostat(api, serial_number):
|
||||||
"""Authenticate and create the thermostat object."""
|
"""Authenticate and create the thermostat object."""
|
||||||
api.authenticate()
|
api.authenticate()
|
||||||
|
@ -78,6 +72,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
update_interval=timedelta(minutes=5),
|
update_interval=timedelta(minutes=5),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = (thermostat, coordinator)
|
hass.data[DOMAIN][entry.entry_id] = (thermostat, coordinator)
|
||||||
|
|
||||||
for platform in PLATFORMS:
|
for platform in PLATFORMS:
|
||||||
|
|
|
@ -3,11 +3,6 @@ from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the Raspberry Pi Power Supply Checker component."""
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Raspberry Pi Power Supply Checker from a config entry."""
|
"""Set up Raspberry Pi Power Supply Checker from a config entry."""
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
|
|
|
@ -27,12 +27,6 @@ from .const import (
|
||||||
from .coordinator import RuckusUnleashedDataUpdateCoordinator
|
from .coordinator import RuckusUnleashedDataUpdateCoordinator
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|
||||||
"""Set up the Ruckus Unleashed component."""
|
|
||||||
hass.data[DOMAIN] = {}
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Ruckus Unleashed from a config entry."""
|
"""Set up Ruckus Unleashed from a config entry."""
|
||||||
try:
|
try:
|
||||||
|
@ -64,6 +58,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
sw_version=system_info[API_SYSTEM_OVERVIEW][API_VERSION],
|
sw_version=system_info[API_SYSTEM_OVERVIEW][API_VERSION],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
COORDINATOR: coordinator,
|
COORDINATOR: coordinator,
|
||||||
UNDO_UPDATE_LISTENERS: [],
|
UNDO_UPDATE_LISTENERS: [],
|
||||||
|
|
|
@ -32,12 +32,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
PLATFORMS = ["sensor"]
|
PLATFORMS = ["sensor"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the Smart Meter Texas component."""
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Smart Meter Texas from a config entry."""
|
"""Set up Smart Meter Texas from a config entry."""
|
||||||
|
|
||||||
|
@ -76,6 +70,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
DATA_COORDINATOR: coordinator,
|
DATA_COORDINATOR: coordinator,
|
||||||
DATA_SMART_METER: smart_meter_texas_data,
|
DATA_SMART_METER: smart_meter_texas_data,
|
||||||
|
|
|
@ -10,18 +10,11 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
PLATFORMS = ["binary_sensor", "climate", "light", "sensor", "switch"]
|
PLATFORMS = ["binary_sensor", "climate", "light", "sensor", "switch"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass, config):
|
|
||||||
"""Set up smarttub component."""
|
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass, entry):
|
async def async_setup_entry(hass, entry):
|
||||||
"""Set up a smarttub config entry."""
|
"""Set up a smarttub config entry."""
|
||||||
|
|
||||||
controller = SmartTubController(hass)
|
controller = SmartTubController(hass)
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
SMARTTUB_CONTROLLER: controller,
|
SMARTTUB_CONTROLLER: controller,
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,6 @@ SCAN_INTERVAL = timedelta(seconds=30)
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistantType, config: dict) -> bool:
|
|
||||||
"""Set up the Sonarr component."""
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Sonarr from a config entry."""
|
"""Set up Sonarr from a config entry."""
|
||||||
if not entry.options:
|
if not entry.options:
|
||||||
|
@ -81,6 +75,7 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
|
||||||
|
|
||||||
undo_listener = entry.add_update_listener(_async_update_listener)
|
undo_listener = entry.add_update_listener(_async_update_listener)
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
DATA_SONARR: sonarr,
|
DATA_SONARR: sonarr,
|
||||||
DATA_UNDO_UPDATE_LISTENER: undo_listener,
|
DATA_UNDO_UPDATE_LISTENER: undo_listener,
|
||||||
|
|
|
@ -39,14 +39,6 @@ SCAN_INTERVAL = timedelta(minutes=5)
|
||||||
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
|
CONFIG_SCHEMA = cv.deprecated(DOMAIN)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: dict):
|
|
||||||
"""Set up the Tado component."""
|
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Tado from a config entry."""
|
"""Set up Tado from a config entry."""
|
||||||
|
|
||||||
|
@ -86,6 +78,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
|
|
||||||
update_listener = entry.add_update_listener(_async_update_listener)
|
update_listener = entry.add_update_listener(_async_update_listener)
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = {
|
hass.data[DOMAIN][entry.entry_id] = {
|
||||||
DATA: tadoconnector,
|
DATA: tadoconnector,
|
||||||
UPDATE_TRACK: update_track,
|
UPDATE_TRACK: update_track,
|
||||||
|
|
|
@ -10,7 +10,6 @@ from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST
|
from homeassistant.const import CONF_ACCESS_TOKEN, CONF_HOST
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
|
||||||
from homeassistant.util import Throttle
|
from homeassistant.util import Throttle
|
||||||
|
|
||||||
from .const import ATTR_BOOT_TIME, ATTR_LOAD, DOMAIN, ROUTER_DEFAULT_HOST
|
from .const import ATTR_BOOT_TIME, ATTR_LOAD, DOMAIN, ROUTER_DEFAULT_HOST
|
||||||
|
@ -22,12 +21,6 @@ DEFAULT_SCAN_INTERVAL = timedelta(seconds=30)
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: HomeAssistantType, config: ConfigType):
|
|
||||||
"""Set up the Vilfo Router component."""
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Set up Vilfo Router from a config entry."""
|
"""Set up Vilfo Router from a config entry."""
|
||||||
host = entry.data[CONF_HOST]
|
host = entry.data[CONF_HOST]
|
||||||
|
@ -40,6 +33,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
if not vilfo_router.available:
|
if not vilfo_router.available:
|
||||||
raise ConfigEntryNotReady
|
raise ConfigEntryNotReady
|
||||||
|
|
||||||
|
hass.data.setdefault(DOMAIN, {})
|
||||||
hass.data[DOMAIN][entry.entry_id] = vilfo_router
|
hass.data[DOMAIN][entry.entry_id] = vilfo_router
|
||||||
|
|
||||||
for platform in PLATFORMS:
|
for platform in PLATFORMS:
|
||||||
|
|
|
@ -35,11 +35,6 @@ VACUUM_PLATFORMS = ["vacuum"]
|
||||||
AIR_MONITOR_PLATFORMS = ["air_quality", "sensor"]
|
AIR_MONITOR_PLATFORMS = ["air_quality", "sensor"]
|
||||||
|
|
||||||
|
|
||||||
async def async_setup(hass: core.HomeAssistant, config: dict):
|
|
||||||
"""Set up the Xiaomi Miio component."""
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
|
hass: core.HomeAssistant, entry: config_entries.ConfigEntry
|
||||||
):
|
):
|
||||||
|
|
|
@ -34,8 +34,6 @@ async def test_form(hass):
|
||||||
"homeassistant.components.flick_electric.config_flow.SimpleFlickAuth.async_get_access_token",
|
"homeassistant.components.flick_electric.config_flow.SimpleFlickAuth.async_get_access_token",
|
||||||
return_value="123456789abcdef",
|
return_value="123456789abcdef",
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.flick_electric.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.flick_electric.async_setup_entry",
|
"homeassistant.components.flick_electric.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -48,7 +46,6 @@ async def test_form(hass):
|
||||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
assert result2["title"] == "Flick Electric: test-username"
|
assert result2["title"] == "Flick Electric: test-username"
|
||||||
assert result2["data"] == CONF
|
assert result2["data"] == CONF
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,6 @@ async def test_form(hass, aioclient_mock_fixture):
|
||||||
assert result["errors"] == {}
|
assert result["errors"] == {}
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.flo.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.flo.async_setup_entry", return_value=True
|
"homeassistant.components.flo.async_setup_entry", return_value=True
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
|
@ -32,7 +30,6 @@ async def test_form(hass, aioclient_mock_fixture):
|
||||||
assert result2["title"] == "Home"
|
assert result2["title"] == "Home"
|
||||||
assert result2["data"] == {"username": TEST_USER_ID, "password": TEST_PASSWORD}
|
assert result2["data"] == {"username": TEST_USER_ID, "password": TEST_PASSWORD}
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,6 @@ async def test_user_form(hass):
|
||||||
"homeassistant.components.harmony.util.HarmonyAPI",
|
"homeassistant.components.harmony.util.HarmonyAPI",
|
||||||
return_value=harmonyapi,
|
return_value=harmonyapi,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.harmony.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.harmony.async_setup_entry",
|
"homeassistant.components.harmony.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -45,7 +43,6 @@ async def test_user_form(hass):
|
||||||
assert result2["type"] == "create_entry"
|
assert result2["type"] == "create_entry"
|
||||||
assert result2["title"] == "friend"
|
assert result2["title"] == "friend"
|
||||||
assert result2["data"] == {"host": "1.2.3.4", "name": "friend"}
|
assert result2["data"] == {"host": "1.2.3.4", "name": "friend"}
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,8 +80,6 @@ async def test_form_ssdp(hass):
|
||||||
"homeassistant.components.harmony.util.HarmonyAPI",
|
"homeassistant.components.harmony.util.HarmonyAPI",
|
||||||
return_value=harmonyapi,
|
return_value=harmonyapi,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.harmony.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.harmony.async_setup_entry",
|
"homeassistant.components.harmony.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -97,7 +92,6 @@ async def test_form_ssdp(hass):
|
||||||
assert result2["type"] == "create_entry"
|
assert result2["type"] == "create_entry"
|
||||||
assert result2["title"] == "Harmony Hub"
|
assert result2["title"] == "Harmony Hub"
|
||||||
assert result2["data"] == {"host": "192.168.1.12", "name": "Harmony Hub"}
|
assert result2["data"] == {"host": "192.168.1.12", "name": "Harmony Hub"}
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,6 @@ async def test_user_form(hass):
|
||||||
"homeassistant.components.hunterdouglas_powerview.UserData",
|
"homeassistant.components.hunterdouglas_powerview.UserData",
|
||||||
return_value=mock_powerview_userdata,
|
return_value=mock_powerview_userdata,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.hunterdouglas_powerview.async_setup",
|
|
||||||
return_value=True,
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.hunterdouglas_powerview.async_setup_entry",
|
"homeassistant.components.hunterdouglas_powerview.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -53,7 +50,6 @@ async def test_user_form(hass):
|
||||||
assert result2["data"] == {
|
assert result2["data"] == {
|
||||||
"host": "1.2.3.4",
|
"host": "1.2.3.4",
|
||||||
}
|
}
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
result3 = await hass.config_entries.flow.async_init(
|
result3 = await hass.config_entries.flow.async_init(
|
||||||
|
@ -103,9 +99,6 @@ async def test_form_homekit(hass):
|
||||||
"homeassistant.components.hunterdouglas_powerview.UserData",
|
"homeassistant.components.hunterdouglas_powerview.UserData",
|
||||||
return_value=mock_powerview_userdata,
|
return_value=mock_powerview_userdata,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.hunterdouglas_powerview.async_setup",
|
|
||||||
return_value=True,
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.hunterdouglas_powerview.async_setup_entry",
|
"homeassistant.components.hunterdouglas_powerview.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -117,7 +110,6 @@ async def test_form_homekit(hass):
|
||||||
assert result2["data"] == {"host": "1.2.3.4"}
|
assert result2["data"] == {"host": "1.2.3.4"}
|
||||||
assert result2["result"].unique_id == "ABC123"
|
assert result2["result"].unique_id == "ABC123"
|
||||||
|
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
result3 = await hass.config_entries.flow.async_init(
|
result3 = await hass.config_entries.flow.async_init(
|
||||||
|
|
|
@ -344,9 +344,7 @@ async def test_full_user_flow_implementation(
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
assert result["type"] == RESULT_TYPE_FORM
|
assert result["type"] == RESULT_TYPE_FORM
|
||||||
|
|
||||||
with patch(
|
with patch("homeassistant.components.ipp.async_setup_entry", return_value=True):
|
||||||
"homeassistant.components.ipp.async_setup_entry", return_value=True
|
|
||||||
), patch("homeassistant.components.ipp.async_setup", return_value=True):
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
user_input={CONF_HOST: "192.168.1.31", CONF_BASE_PATH: "/ipp/print"},
|
user_input={CONF_HOST: "192.168.1.31", CONF_BASE_PATH: "/ipp/print"},
|
||||||
|
@ -379,9 +377,7 @@ async def test_full_zeroconf_flow_implementation(
|
||||||
assert result["step_id"] == "zeroconf_confirm"
|
assert result["step_id"] == "zeroconf_confirm"
|
||||||
assert result["type"] == RESULT_TYPE_FORM
|
assert result["type"] == RESULT_TYPE_FORM
|
||||||
|
|
||||||
with patch(
|
with patch("homeassistant.components.ipp.async_setup_entry", return_value=True):
|
||||||
"homeassistant.components.ipp.async_setup_entry", return_value=True
|
|
||||||
), patch("homeassistant.components.ipp.async_setup", return_value=True):
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"], user_input={}
|
result["flow_id"], user_input={}
|
||||||
)
|
)
|
||||||
|
@ -416,9 +412,7 @@ async def test_full_zeroconf_tls_flow_implementation(
|
||||||
assert result["type"] == RESULT_TYPE_FORM
|
assert result["type"] == RESULT_TYPE_FORM
|
||||||
assert result["description_placeholders"] == {CONF_NAME: "EPSON XP-6000 Series"}
|
assert result["description_placeholders"] == {CONF_NAME: "EPSON XP-6000 Series"}
|
||||||
|
|
||||||
with patch(
|
with patch("homeassistant.components.ipp.async_setup_entry", return_value=True):
|
||||||
"homeassistant.components.ipp.async_setup_entry", return_value=True
|
|
||||||
), patch("homeassistant.components.ipp.async_setup", return_value=True):
|
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"], user_input={}
|
result["flow_id"], user_input={}
|
||||||
)
|
)
|
||||||
|
|
|
@ -24,8 +24,6 @@ async def test_form(hass, mock_account):
|
||||||
"homeassistant.components.litterrobot.hub.Account",
|
"homeassistant.components.litterrobot.hub.Account",
|
||||||
return_value=mock_account,
|
return_value=mock_account,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.litterrobot.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.litterrobot.async_setup_entry",
|
"homeassistant.components.litterrobot.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -37,7 +35,6 @@ async def test_form(hass, mock_account):
|
||||||
assert result2["type"] == "create_entry"
|
assert result2["type"] == "create_entry"
|
||||||
assert result2["title"] == CONFIG[DOMAIN][CONF_USERNAME]
|
assert result2["title"] == CONFIG[DOMAIN][CONF_USERNAME]
|
||||||
assert result2["data"] == CONFIG[DOMAIN]
|
assert result2["data"] == CONFIG[DOMAIN]
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@ async def test_form(hass):
|
||||||
"homeassistant.components.mazda.config_flow.MazdaAPI.validate_credentials",
|
"homeassistant.components.mazda.config_flow.MazdaAPI.validate_credentials",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.mazda.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.mazda.async_setup_entry",
|
"homeassistant.components.mazda.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -53,7 +51,6 @@ async def test_form(hass):
|
||||||
assert result2["type"] == "create_entry"
|
assert result2["type"] == "create_entry"
|
||||||
assert result2["title"] == FIXTURE_USER_INPUT[CONF_EMAIL]
|
assert result2["title"] == FIXTURE_USER_INPUT[CONF_EMAIL]
|
||||||
assert result2["data"] == FIXTURE_USER_INPUT
|
assert result2["data"] == FIXTURE_USER_INPUT
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,6 @@ async def test_form(hass, requests_mock):
|
||||||
assert result["errors"] == {}
|
assert result["errors"] == {}
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.metoffice.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.metoffice.async_setup_entry",
|
"homeassistant.components.metoffice.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -52,7 +50,6 @@ async def test_form(hass, requests_mock):
|
||||||
"longitude": TEST_LONGITUDE_WAVERTREE,
|
"longitude": TEST_LONGITUDE_WAVERTREE,
|
||||||
"name": TEST_SITE_NAME_WAVERTREE,
|
"name": TEST_SITE_NAME_WAVERTREE,
|
||||||
}
|
}
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,6 @@ async def test_form(hass):
|
||||||
"homeassistant.components.monoprice.config_flow.get_async_monoprice",
|
"homeassistant.components.monoprice.config_flow.get_async_monoprice",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.monoprice.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.monoprice.async_setup_entry",
|
"homeassistant.components.monoprice.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -52,7 +50,6 @@ async def test_form(hass):
|
||||||
CONF_PORT: CONFIG[CONF_PORT],
|
CONF_PORT: CONFIG[CONF_PORT],
|
||||||
CONF_SOURCES: {"1": CONFIG[CONF_SOURCE_1], "4": CONFIG[CONF_SOURCE_4]},
|
CONF_SOURCES: {"1": CONFIG[CONF_SOURCE_1], "4": CONFIG[CONF_SOURCE_4]},
|
||||||
}
|
}
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,6 @@ async def test_form(hass):
|
||||||
"homeassistant.components.nexia.config_flow.NexiaHome.login",
|
"homeassistant.components.nexia.config_flow.NexiaHome.login",
|
||||||
side_effect=MagicMock(),
|
side_effect=MagicMock(),
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.nexia.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.nexia.async_setup_entry",
|
"homeassistant.components.nexia.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -41,7 +39,6 @@ async def test_form(hass):
|
||||||
CONF_USERNAME: "username",
|
CONF_USERNAME: "username",
|
||||||
CONF_PASSWORD: "password",
|
CONF_PASSWORD: "password",
|
||||||
}
|
}
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ async def test_form_user(hass):
|
||||||
"homeassistant.components.nuheat.config_flow.nuheat.NuHeat.get_thermostat",
|
"homeassistant.components.nuheat.config_flow.nuheat.NuHeat.get_thermostat",
|
||||||
return_value=mock_thermostat,
|
return_value=mock_thermostat,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.nuheat.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.nuheat.async_setup_entry", return_value=True
|
"homeassistant.components.nuheat.async_setup_entry", return_value=True
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
|
@ -49,7 +47,6 @@ async def test_form_user(hass):
|
||||||
CONF_USERNAME: "test-username",
|
CONF_USERNAME: "test-username",
|
||||||
CONF_PASSWORD: "test-password",
|
CONF_PASSWORD: "test-password",
|
||||||
}
|
}
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ async def test_form(hass):
|
||||||
"homeassistant.components.ruckus_unleashed.Ruckus.system_info",
|
"homeassistant.components.ruckus_unleashed.Ruckus.system_info",
|
||||||
return_value=DEFAULT_SYSTEM_INFO,
|
return_value=DEFAULT_SYSTEM_INFO,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.ruckus_unleashed.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.ruckus_unleashed.async_setup_entry",
|
"homeassistant.components.ruckus_unleashed.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -44,7 +42,6 @@ async def test_form(hass):
|
||||||
assert result2["type"] == "create_entry"
|
assert result2["type"] == "create_entry"
|
||||||
assert result2["title"] == DEFAULT_TITLE
|
assert result2["title"] == DEFAULT_TITLE
|
||||||
assert result2["data"] == CONFIG
|
assert result2["data"] == CONFIG
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ async def test_form(hass):
|
||||||
assert result["errors"] == {}
|
assert result["errors"] == {}
|
||||||
|
|
||||||
with patch("smart_meter_texas.Client.authenticate", return_value=True), patch(
|
with patch("smart_meter_texas.Client.authenticate", return_value=True), patch(
|
||||||
"homeassistant.components.smart_meter_texas.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.smart_meter_texas.async_setup_entry",
|
"homeassistant.components.smart_meter_texas.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -41,7 +39,6 @@ async def test_form(hass):
|
||||||
assert result2["type"] == "create_entry"
|
assert result2["type"] == "create_entry"
|
||||||
assert result2["title"] == TEST_LOGIN[CONF_USERNAME]
|
assert result2["title"] == TEST_LOGIN[CONF_USERNAME]
|
||||||
assert result2["data"] == TEST_LOGIN
|
assert result2["data"] == TEST_LOGIN
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@ async def test_form(hass):
|
||||||
assert result["errors"] == {}
|
assert result["errors"] == {}
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.smarttub.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.smarttub.async_setup_entry",
|
"homeassistant.components.smarttub.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -33,7 +31,6 @@ async def test_form(hass):
|
||||||
"password": "test-password",
|
"password": "test-password",
|
||||||
}
|
}
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
mock_setup.assert_called_once()
|
|
||||||
mock_setup_entry.assert_called_once()
|
mock_setup_entry.assert_called_once()
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
|
|
|
@ -227,13 +227,6 @@ async def setup_integration(
|
||||||
return entry
|
return entry
|
||||||
|
|
||||||
|
|
||||||
def _patch_async_setup(return_value=True):
|
|
||||||
"""Patch the async setup of sonarr."""
|
|
||||||
return patch(
|
|
||||||
"homeassistant.components.sonarr.async_setup", return_value=return_value
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _patch_async_setup_entry(return_value=True):
|
def _patch_async_setup_entry(return_value=True):
|
||||||
"""Patch the async entry setup of sonarr."""
|
"""Patch the async entry setup of sonarr."""
|
||||||
return patch(
|
return patch(
|
||||||
|
|
|
@ -21,7 +21,6 @@ from tests.components.sonarr import (
|
||||||
HOST,
|
HOST,
|
||||||
MOCK_REAUTH_INPUT,
|
MOCK_REAUTH_INPUT,
|
||||||
MOCK_USER_INPUT,
|
MOCK_USER_INPUT,
|
||||||
_patch_async_setup,
|
|
||||||
_patch_async_setup_entry,
|
_patch_async_setup_entry,
|
||||||
mock_connection,
|
mock_connection,
|
||||||
mock_connection_error,
|
mock_connection_error,
|
||||||
|
@ -123,7 +122,7 @@ async def test_full_reauth_flow_implementation(
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
|
|
||||||
user_input = MOCK_REAUTH_INPUT.copy()
|
user_input = MOCK_REAUTH_INPUT.copy()
|
||||||
with _patch_async_setup(), _patch_async_setup_entry() as mock_setup_entry:
|
with _patch_async_setup_entry() as mock_setup_entry:
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"], user_input=user_input
|
result["flow_id"], user_input=user_input
|
||||||
)
|
)
|
||||||
|
@ -153,7 +152,7 @@ async def test_full_user_flow_implementation(
|
||||||
|
|
||||||
user_input = MOCK_USER_INPUT.copy()
|
user_input = MOCK_USER_INPUT.copy()
|
||||||
|
|
||||||
with _patch_async_setup(), _patch_async_setup_entry():
|
with _patch_async_setup_entry():
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
user_input=user_input,
|
user_input=user_input,
|
||||||
|
@ -184,7 +183,7 @@ async def test_full_user_flow_advanced_options(
|
||||||
CONF_VERIFY_SSL: True,
|
CONF_VERIFY_SSL: True,
|
||||||
}
|
}
|
||||||
|
|
||||||
with _patch_async_setup(), _patch_async_setup_entry():
|
with _patch_async_setup_entry():
|
||||||
result = await hass.config_entries.flow.async_configure(
|
result = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
user_input=user_input,
|
user_input=user_input,
|
||||||
|
@ -211,7 +210,7 @@ async def test_options_flow(hass, aioclient_mock: AiohttpClientMocker):
|
||||||
assert result["type"] == RESULT_TYPE_FORM
|
assert result["type"] == RESULT_TYPE_FORM
|
||||||
assert result["step_id"] == "init"
|
assert result["step_id"] == "init"
|
||||||
|
|
||||||
with _patch_async_setup(), _patch_async_setup_entry():
|
with _patch_async_setup_entry():
|
||||||
result = await hass.config_entries.options.async_configure(
|
result = await hass.config_entries.options.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
user_input={CONF_UPCOMING_DAYS: 2, CONF_WANTED_MAX_ITEMS: 100},
|
user_input={CONF_UPCOMING_DAYS: 2, CONF_WANTED_MAX_ITEMS: 100},
|
||||||
|
|
|
@ -34,8 +34,6 @@ async def test_form(hass):
|
||||||
"homeassistant.components.tado.config_flow.Tado",
|
"homeassistant.components.tado.config_flow.Tado",
|
||||||
return_value=mock_tado_api,
|
return_value=mock_tado_api,
|
||||||
), patch(
|
), patch(
|
||||||
"homeassistant.components.tado.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.tado.async_setup_entry",
|
"homeassistant.components.tado.async_setup_entry",
|
||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
|
@ -51,7 +49,6 @@ async def test_form(hass):
|
||||||
"username": "test-username",
|
"username": "test-username",
|
||||||
"password": "test-password",
|
"password": "test-password",
|
||||||
}
|
}
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,6 @@ async def test_form(hass):
|
||||||
with patch("vilfo.Client.ping", return_value=None), patch(
|
with patch("vilfo.Client.ping", return_value=None), patch(
|
||||||
"vilfo.Client.get_board_information", return_value=None
|
"vilfo.Client.get_board_information", return_value=None
|
||||||
), patch("vilfo.Client.resolve_mac_address", return_value=mock_mac), patch(
|
), patch("vilfo.Client.resolve_mac_address", return_value=mock_mac), patch(
|
||||||
"homeassistant.components.vilfo.async_setup", return_value=True
|
|
||||||
) as mock_setup, patch(
|
|
||||||
"homeassistant.components.vilfo.async_setup_entry"
|
"homeassistant.components.vilfo.async_setup_entry"
|
||||||
) as mock_setup_entry:
|
) as mock_setup_entry:
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
|
@ -38,7 +36,6 @@ async def test_form(hass):
|
||||||
"access_token": "test-token",
|
"access_token": "test-token",
|
||||||
}
|
}
|
||||||
|
|
||||||
assert len(mock_setup.mock_calls) == 1
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue