Uniformize platform setup (#47101)

* A platform is not a component

* Fix dynalite

* SUPPORTED_PLATFORMS --> PLATFORMS

* In tests

* In tests 2

* Fix SmartThings

* Fix ZHA test

* Fix Z-Wave

* Revert Z-Wave

* Use PLATFORMS const in ambient_station

* Fix ihc comment
This commit is contained in:
Quentame 2021-03-02 21:43:59 +01:00 committed by GitHub
parent ca54de095d
commit 198ecb0945
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
218 changed files with 924 additions and 932 deletions

View file

@ -66,7 +66,7 @@ CAPTURE_IMAGE_SCHEMA = vol.Schema({ATTR_ENTITY_ID: cv.entity_ids})
AUTOMATION_SCHEMA = vol.Schema({ATTR_ENTITY_ID: cv.entity_ids})
ABODE_PLATFORMS = [
PLATFORMS = [
"alarm_control_panel",
"binary_sensor",
"lock",
@ -138,7 +138,7 @@ async def async_setup_entry(hass, config_entry):
hass.data[DOMAIN] = AbodeSystem(abode, polling)
for platform in ABODE_PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
@ -158,7 +158,7 @@ async def async_unload_entry(hass, config_entry):
tasks = []
for platform in ABODE_PLATFORMS:
for platform in PLATFORMS:
tasks.append(
hass.config_entries.async_forward_entry_unload(config_entry, platform)
)

View file

@ -57,9 +57,9 @@ async def async_setup_entry(hass, config_entry) -> bool:
UNDO_UPDATE_LISTENER: undo_listener,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -70,8 +70,8 @@ async def async_unload_entry(hass, config_entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -28,9 +28,9 @@ async def async_setup_entry(
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][config_entry.entry_id] = hub
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -45,8 +45,8 @@ async def async_unload_entry(
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -43,6 +43,8 @@ SERVICE_REFRESH_SCHEMA = vol.Schema(
{vol.Optional(CONF_FORCE, default=False): cv.boolean}
)
PLATFORMS = ["sensor", "switch"]
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
"""Set up the AdGuard Home components."""
@ -69,9 +71,9 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
except AdGuardHomeConnectionError as exception:
raise ConfigEntryNotReady from exception
for component in "sensor", "switch":
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
async def add_url(call) -> None:
@ -123,8 +125,8 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigType) -> bool
hass.services.async_remove(DOMAIN, SERVICE_DISABLE_URL)
hass.services.async_remove(DOMAIN, SERVICE_REFRESH)
for component in "sensor", "switch":
await hass.config_entries.async_forward_entry_unload(entry, component)
for platform in PLATFORMS:
await hass.config_entries.async_forward_entry_unload(entry, platform)
del hass.data[DOMAIN]

View file

@ -14,7 +14,7 @@ from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, Upda
from .const import ADVANTAGE_AIR_RETRY, DOMAIN
ADVANTAGE_AIR_SYNC_INTERVAL = 15
ADVANTAGE_AIR_PLATFORMS = ["climate", "cover", "binary_sensor", "sensor", "switch"]
PLATFORMS = ["climate", "cover", "binary_sensor", "sensor", "switch"]
_LOGGER = logging.getLogger(__name__)
@ -67,7 +67,7 @@ async def async_setup_entry(hass, entry):
"async_change": async_change,
}
for platform in ADVANTAGE_AIR_PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, platform)
)
@ -80,8 +80,8 @@ async def async_unload_entry(hass, entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in ADVANTAGE_AIR_PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -8,7 +8,7 @@ from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
from homeassistant.core import HomeAssistant
from .const import COMPONENTS, DOMAIN, ENTRY_NAME, ENTRY_WEATHER_COORDINATOR
from .const import DOMAIN, ENTRY_NAME, ENTRY_WEATHER_COORDINATOR, PLATFORMS
from .weather_update_coordinator import WeatherUpdateCoordinator
_LOGGER = logging.getLogger(__name__)
@ -37,9 +37,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):
ENTRY_WEATHER_COORDINATOR: weather_coordinator,
}
for component in COMPONENTS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -50,8 +50,8 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in COMPONENTS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -34,7 +34,7 @@ from homeassistant.const import (
)
ATTRIBUTION = "Powered by AEMET OpenData"
COMPONENTS = ["sensor", "weather"]
PLATFORMS = ["sensor", "weather"]
DEFAULT_NAME = "AEMET"
DOMAIN = "aemet"
ENTRY_NAME = "name"

View file

@ -79,9 +79,9 @@ async def async_setup_entry(hass, config_entry):
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][config_entry.entry_id] = coordinator
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -92,8 +92,8 @@ async def async_unload_entry(hass, config_entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -68,9 +68,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = coordinator
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -81,8 +81,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -268,9 +268,9 @@ async def async_setup_entry(hass, config_entry):
hass.data[DOMAIN][DATA_COORDINATOR][config_entry.entry_id] = coordinator
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -323,8 +323,8 @@ async def async_unload_entry(hass, config_entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -130,9 +130,9 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
await open_connection()
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -144,8 +144,8 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -5,7 +5,11 @@ from aioambient import Client
from aioambient.errors import WebsocketError
import voluptuous as vol
from homeassistant.components.binary_sensor import DEVICE_CLASS_CONNECTIVITY
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DOMAIN as BINARY_SENSOR,
)
from homeassistant.components.sensor import DOMAIN as SENSOR
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import (
ATTR_LOCATION,
@ -39,10 +43,10 @@ from .const import (
DATA_CLIENT,
DOMAIN,
LOGGER,
TYPE_BINARY_SENSOR,
TYPE_SENSOR,
)
PLATFORMS = [BINARY_SENSOR, SENSOR]
DATA_CONFIG = "config"
DEFAULT_SOCKET_MIN_RETRY = 15
@ -141,109 +145,109 @@ TYPE_WINDSPDMPH_AVG2M = "windspdmph_avg2m"
TYPE_WINDSPEEDMPH = "windspeedmph"
TYPE_YEARLYRAININ = "yearlyrainin"
SENSOR_TYPES = {
TYPE_24HOURRAININ: ("24 Hr Rain", "in", TYPE_SENSOR, None),
TYPE_BAROMABSIN: ("Abs Pressure", PRESSURE_INHG, TYPE_SENSOR, "pressure"),
TYPE_BAROMRELIN: ("Rel Pressure", PRESSURE_INHG, TYPE_SENSOR, "pressure"),
TYPE_BATT10: ("Battery 10", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT1: ("Battery 1", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT2: ("Battery 2", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT3: ("Battery 3", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT4: ("Battery 4", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT5: ("Battery 5", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT6: ("Battery 6", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT7: ("Battery 7", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT8: ("Battery 8", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATT9: ("Battery 9", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_BATTOUT: ("Battery", None, TYPE_BINARY_SENSOR, "battery"),
TYPE_CO2: ("co2", CONCENTRATION_PARTS_PER_MILLION, TYPE_SENSOR, None),
TYPE_DAILYRAININ: ("Daily Rain", "in", TYPE_SENSOR, None),
TYPE_DEWPOINT: ("Dew Point", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_EVENTRAININ: ("Event Rain", "in", TYPE_SENSOR, None),
TYPE_FEELSLIKE: ("Feels Like", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_HOURLYRAININ: ("Hourly Rain Rate", "in/hr", TYPE_SENSOR, None),
TYPE_HUMIDITY10: ("Humidity 10", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY1: ("Humidity 1", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY2: ("Humidity 2", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY3: ("Humidity 3", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY4: ("Humidity 4", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY5: ("Humidity 5", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY6: ("Humidity 6", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY7: ("Humidity 7", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY8: ("Humidity 8", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY9: ("Humidity 9", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITY: ("Humidity", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_HUMIDITYIN: ("Humidity In", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_LASTRAIN: ("Last Rain", None, TYPE_SENSOR, "timestamp"),
TYPE_MAXDAILYGUST: ("Max Gust", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_MONTHLYRAININ: ("Monthly Rain", "in", TYPE_SENSOR, None),
TYPE_RELAY10: ("Relay 10", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY1: ("Relay 1", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY2: ("Relay 2", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY3: ("Relay 3", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY4: ("Relay 4", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY5: ("Relay 5", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY6: ("Relay 6", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY7: ("Relay 7", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY8: ("Relay 8", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY9: ("Relay 9", None, TYPE_BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_SOILHUM10: ("Soil Humidity 10", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM1: ("Soil Humidity 1", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM2: ("Soil Humidity 2", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM3: ("Soil Humidity 3", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM4: ("Soil Humidity 4", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM5: ("Soil Humidity 5", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM6: ("Soil Humidity 6", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM7: ("Soil Humidity 7", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM8: ("Soil Humidity 8", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILHUM9: ("Soil Humidity 9", PERCENTAGE, TYPE_SENSOR, "humidity"),
TYPE_SOILTEMP10F: ("Soil Temp 10", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP1F: ("Soil Temp 1", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP2F: ("Soil Temp 2", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP3F: ("Soil Temp 3", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP4F: ("Soil Temp 4", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP5F: ("Soil Temp 5", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP6F: ("Soil Temp 6", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP7F: ("Soil Temp 7", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP8F: ("Soil Temp 8", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_SOILTEMP9F: ("Soil Temp 9", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_24HOURRAININ: ("24 Hr Rain", "in", SENSOR, None),
TYPE_BAROMABSIN: ("Abs Pressure", PRESSURE_INHG, SENSOR, "pressure"),
TYPE_BAROMRELIN: ("Rel Pressure", PRESSURE_INHG, SENSOR, "pressure"),
TYPE_BATT10: ("Battery 10", None, BINARY_SENSOR, "battery"),
TYPE_BATT1: ("Battery 1", None, BINARY_SENSOR, "battery"),
TYPE_BATT2: ("Battery 2", None, BINARY_SENSOR, "battery"),
TYPE_BATT3: ("Battery 3", None, BINARY_SENSOR, "battery"),
TYPE_BATT4: ("Battery 4", None, BINARY_SENSOR, "battery"),
TYPE_BATT5: ("Battery 5", None, BINARY_SENSOR, "battery"),
TYPE_BATT6: ("Battery 6", None, BINARY_SENSOR, "battery"),
TYPE_BATT7: ("Battery 7", None, BINARY_SENSOR, "battery"),
TYPE_BATT8: ("Battery 8", None, BINARY_SENSOR, "battery"),
TYPE_BATT9: ("Battery 9", None, BINARY_SENSOR, "battery"),
TYPE_BATTOUT: ("Battery", None, BINARY_SENSOR, "battery"),
TYPE_CO2: ("co2", CONCENTRATION_PARTS_PER_MILLION, SENSOR, None),
TYPE_DAILYRAININ: ("Daily Rain", "in", SENSOR, None),
TYPE_DEWPOINT: ("Dew Point", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_EVENTRAININ: ("Event Rain", "in", SENSOR, None),
TYPE_FEELSLIKE: ("Feels Like", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_HOURLYRAININ: ("Hourly Rain Rate", "in/hr", SENSOR, None),
TYPE_HUMIDITY10: ("Humidity 10", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY1: ("Humidity 1", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY2: ("Humidity 2", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY3: ("Humidity 3", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY4: ("Humidity 4", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY5: ("Humidity 5", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY6: ("Humidity 6", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY7: ("Humidity 7", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY8: ("Humidity 8", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY9: ("Humidity 9", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITY: ("Humidity", PERCENTAGE, SENSOR, "humidity"),
TYPE_HUMIDITYIN: ("Humidity In", PERCENTAGE, SENSOR, "humidity"),
TYPE_LASTRAIN: ("Last Rain", None, SENSOR, "timestamp"),
TYPE_MAXDAILYGUST: ("Max Gust", SPEED_MILES_PER_HOUR, SENSOR, None),
TYPE_MONTHLYRAININ: ("Monthly Rain", "in", SENSOR, None),
TYPE_RELAY10: ("Relay 10", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY1: ("Relay 1", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY2: ("Relay 2", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY3: ("Relay 3", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY4: ("Relay 4", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY5: ("Relay 5", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY6: ("Relay 6", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY7: ("Relay 7", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY8: ("Relay 8", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_RELAY9: ("Relay 9", None, BINARY_SENSOR, DEVICE_CLASS_CONNECTIVITY),
TYPE_SOILHUM10: ("Soil Humidity 10", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILHUM1: ("Soil Humidity 1", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILHUM2: ("Soil Humidity 2", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILHUM3: ("Soil Humidity 3", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILHUM4: ("Soil Humidity 4", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILHUM5: ("Soil Humidity 5", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILHUM6: ("Soil Humidity 6", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILHUM7: ("Soil Humidity 7", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILHUM8: ("Soil Humidity 8", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILHUM9: ("Soil Humidity 9", PERCENTAGE, SENSOR, "humidity"),
TYPE_SOILTEMP10F: ("Soil Temp 10", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOILTEMP1F: ("Soil Temp 1", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOILTEMP2F: ("Soil Temp 2", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOILTEMP3F: ("Soil Temp 3", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOILTEMP4F: ("Soil Temp 4", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOILTEMP5F: ("Soil Temp 5", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOILTEMP6F: ("Soil Temp 6", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOILTEMP7F: ("Soil Temp 7", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOILTEMP8F: ("Soil Temp 8", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOILTEMP9F: ("Soil Temp 9", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_SOLARRADIATION: (
"Solar Rad",
IRRADIATION_WATTS_PER_SQUARE_METER,
TYPE_SENSOR,
SENSOR,
None,
),
TYPE_SOLARRADIATION_LX: ("Solar Rad (lx)", LIGHT_LUX, TYPE_SENSOR, "illuminance"),
TYPE_TEMP10F: ("Temp 10", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP1F: ("Temp 1", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP2F: ("Temp 2", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP3F: ("Temp 3", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP4F: ("Temp 4", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP5F: ("Temp 5", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP6F: ("Temp 6", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP7F: ("Temp 7", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP8F: ("Temp 8", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMP9F: ("Temp 9", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMPF: ("Temp", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TEMPINF: ("Inside Temp", TEMP_FAHRENHEIT, TYPE_SENSOR, "temperature"),
TYPE_TOTALRAININ: ("Lifetime Rain", "in", TYPE_SENSOR, None),
TYPE_UV: ("uv", "Index", TYPE_SENSOR, None),
TYPE_PM25: ("PM25", CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, TYPE_SENSOR, None),
TYPE_SOLARRADIATION_LX: ("Solar Rad (lx)", LIGHT_LUX, SENSOR, "illuminance"),
TYPE_TEMP10F: ("Temp 10", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMP1F: ("Temp 1", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMP2F: ("Temp 2", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMP3F: ("Temp 3", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMP4F: ("Temp 4", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMP5F: ("Temp 5", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMP6F: ("Temp 6", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMP7F: ("Temp 7", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMP8F: ("Temp 8", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMP9F: ("Temp 9", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMPF: ("Temp", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TEMPINF: ("Inside Temp", TEMP_FAHRENHEIT, SENSOR, "temperature"),
TYPE_TOTALRAININ: ("Lifetime Rain", "in", SENSOR, None),
TYPE_UV: ("uv", "Index", SENSOR, None),
TYPE_PM25: ("PM25", CONCENTRATION_MICROGRAMS_PER_CUBIC_METER, SENSOR, None),
TYPE_PM25_24H: (
"PM25 24h Avg",
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
TYPE_SENSOR,
SENSOR,
None,
),
TYPE_WEEKLYRAININ: ("Weekly Rain", "in", TYPE_SENSOR, None),
TYPE_WINDDIR: ("Wind Dir", DEGREE, TYPE_SENSOR, None),
TYPE_WINDDIR_AVG10M: ("Wind Dir Avg 10m", DEGREE, TYPE_SENSOR, None),
TYPE_WINDDIR_AVG2M: ("Wind Dir Avg 2m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_WINDGUSTDIR: ("Gust Dir", DEGREE, TYPE_SENSOR, None),
TYPE_WINDGUSTMPH: ("Wind Gust", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_WINDSPDMPH_AVG10M: ("Wind Avg 10m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_WINDSPDMPH_AVG2M: ("Wind Avg 2m", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_WINDSPEEDMPH: ("Wind Speed", SPEED_MILES_PER_HOUR, TYPE_SENSOR, None),
TYPE_YEARLYRAININ: ("Yearly Rain", "in", TYPE_SENSOR, None),
TYPE_WEEKLYRAININ: ("Weekly Rain", "in", SENSOR, None),
TYPE_WINDDIR: ("Wind Dir", DEGREE, SENSOR, None),
TYPE_WINDDIR_AVG10M: ("Wind Dir Avg 10m", DEGREE, SENSOR, None),
TYPE_WINDDIR_AVG2M: ("Wind Dir Avg 2m", SPEED_MILES_PER_HOUR, SENSOR, None),
TYPE_WINDGUSTDIR: ("Gust Dir", DEGREE, SENSOR, None),
TYPE_WINDGUSTMPH: ("Wind Gust", SPEED_MILES_PER_HOUR, SENSOR, None),
TYPE_WINDSPDMPH_AVG10M: ("Wind Avg 10m", SPEED_MILES_PER_HOUR, SENSOR, None),
TYPE_WINDSPDMPH_AVG2M: ("Wind Avg 2m", SPEED_MILES_PER_HOUR, SENSOR, None),
TYPE_WINDSPEEDMPH: ("Wind Speed", SPEED_MILES_PER_HOUR, SENSOR, None),
TYPE_YEARLYRAININ: ("Yearly Rain", "in", SENSOR, None),
}
CONFIG_SCHEMA = vol.Schema(
@ -260,7 +264,7 @@ CONFIG_SCHEMA = vol.Schema(
async def async_setup(hass, config):
"""Set up the Ambient PWS component."""
"""Set up the Ambient PWS integration."""
hass.data[DOMAIN] = {}
hass.data[DOMAIN][DATA_CLIENT] = {}
@ -322,8 +326,8 @@ async def async_unload_entry(hass, config_entry):
hass.async_create_task(ambient.ws_disconnect())
tasks = [
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in ("binary_sensor", "sensor")
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
await asyncio.gather(*tasks)
@ -431,10 +435,10 @@ class AmbientStation:
# attempt forward setup of the config entry (because it will have
# already been done):
if not self._entry_setup_complete:
for component in ("binary_sensor", "sensor"):
for platform in PLATFORMS:
self._hass.async_create_task(
self._hass.config_entries.async_forward_entry_setup(
self._config_entry, component
self._config_entry, platform
)
)
self._entry_setup_complete = True

View file

@ -1,5 +1,8 @@
"""Support for Ambient Weather Station binary sensors."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.components.binary_sensor import (
DOMAIN as BINARY_SENSOR,
BinarySensorEntity,
)
from homeassistant.const import ATTR_NAME
from homeassistant.core import callback
@ -18,13 +21,7 @@ from . import (
TYPE_BATTOUT,
AmbientWeatherEntity,
)
from .const import (
ATTR_LAST_DATA,
ATTR_MONITORED_CONDITIONS,
DATA_CLIENT,
DOMAIN,
TYPE_BINARY_SENSOR,
)
from .const import ATTR_LAST_DATA, ATTR_MONITORED_CONDITIONS, DATA_CLIENT, DOMAIN
async def async_setup_entry(hass, entry, async_add_entities):
@ -35,7 +32,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
for mac_address, station in ambient.stations.items():
for condition in station[ATTR_MONITORED_CONDITIONS]:
name, _, kind, device_class = SENSOR_TYPES[condition]
if kind == TYPE_BINARY_SENSOR:
if kind == BINARY_SENSOR:
binary_sensor_list.append(
AmbientWeatherBinarySensor(
ambient,

View file

@ -10,6 +10,3 @@ ATTR_MONITORED_CONDITIONS = "monitored_conditions"
CONF_APP_KEY = "app_key"
DATA_CLIENT = "data_client"
TYPE_BINARY_SENSOR = "binary_sensor"
TYPE_SENSOR = "sensor"

View file

@ -1,4 +1,5 @@
"""Support for Ambient Weather Station sensors."""
from homeassistant.components.binary_sensor import DOMAIN as SENSOR
from homeassistant.const import ATTR_NAME
from homeassistant.core import callback
@ -8,13 +9,7 @@ from . import (
TYPE_SOLARRADIATION_LX,
AmbientWeatherEntity,
)
from .const import (
ATTR_LAST_DATA,
ATTR_MONITORED_CONDITIONS,
DATA_CLIENT,
DOMAIN,
TYPE_SENSOR,
)
from .const import ATTR_LAST_DATA, ATTR_MONITORED_CONDITIONS, DATA_CLIENT, DOMAIN
async def async_setup_entry(hass, entry, async_add_entities):
@ -25,7 +20,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
for mac_address, station in ambient.stations.items():
for condition in station[ATTR_MONITORED_CONDITIONS]:
name, unit, kind, device_class = SENSOR_TYPES[condition]
if kind == TYPE_SENSOR:
if kind == SENSOR:
sensor_list.append(
AmbientWeatherSensor(
ambient,

View file

@ -62,8 +62,8 @@ async def async_setup_entry(hass, entry):
"""Set up platforms and initiate connection."""
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_setup(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_setup(entry, platform)
for platform in PLATFORMS
]
)
await manager.init()

View file

@ -78,8 +78,8 @@ async def async_unload_entry(hass, entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -21,7 +21,6 @@ import homeassistant.helpers.config_validation as cv
from .activity import ActivityStream
from .const import (
AUGUST_COMPONENTS,
CONF_ACCESS_TOKEN_CACHE_FILE,
CONF_INSTALL_ID,
CONF_LOGIN_METHOD,
@ -32,6 +31,7 @@ from .const import (
DOMAIN,
LOGIN_METHODS,
MIN_TIME_BETWEEN_DETAIL_UPDATES,
PLATFORMS,
VERIFICATION_CODE_KEY,
)
from .exceptions import CannotConnect, InvalidAuth, RequireValidation
@ -137,9 +137,9 @@ async def async_setup_august(hass, config_entry, august_gateway):
await hass.data[DOMAIN][entry_id][DATA_AUGUST].async_setup()
for component in AUGUST_COMPONENTS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -209,8 +209,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in AUGUST_COMPONENTS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -43,4 +43,4 @@ ACTIVITY_UPDATE_INTERVAL = timedelta(seconds=10)
LOGIN_METHODS = ["phone", "email"]
AUGUST_COMPONENTS = ["camera", "binary_sensor", "lock", "sensor"]
PLATFORMS = ["camera", "binary_sensor", "lock", "sensor"]

View file

@ -79,9 +79,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
AURORA_API: api,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -92,8 +92,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -48,9 +48,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
domain_entry = domain.setdefault(entry.entry_id, {})
product = domain_entry.setdefault(PRODUCT, product)
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True

View file

@ -86,9 +86,9 @@ async def async_setup_entry(hass, entry):
if not hass.data[DOMAIN][entry.entry_id].available:
raise ConfigEntryNotReady
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
def blink_refresh(event_time=None):
@ -133,8 +133,8 @@ async def async_unload_entry(hass, entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -18,7 +18,7 @@ from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
BLOOMSKY_TYPE = ["camera", "binary_sensor", "sensor"]
PLATFORMS = ["camera", "binary_sensor", "sensor"]
DOMAIN = "bloomsky"
@ -32,7 +32,7 @@ CONFIG_SCHEMA = vol.Schema(
def setup(hass, config):
"""Set up the BloomSky component."""
"""Set up the BloomSky integration."""
api_key = config[DOMAIN][CONF_API_KEY]
try:
@ -42,8 +42,8 @@ def setup(hass, config):
hass.data[DOMAIN] = bloomsky
for component in BLOOMSKY_TYPE:
discovery.load_platform(hass, component, DOMAIN, {}, config)
for platform in PLATFORMS:
discovery.load_platform(hass, platform, DOMAIN, {}, config)
return True

View file

@ -59,7 +59,7 @@ DEFAULT_OPTIONS = {
CONF_USE_LOCATION: False,
}
BMW_PLATFORMS = ["binary_sensor", "device_tracker", "lock", "notify", "sensor"]
PLATFORMS = ["binary_sensor", "device_tracker", "lock", "notify", "sensor"]
UPDATE_INTERVAL = 5 # in minutes
SERVICE_UPDATE_STATE = "update_state"
@ -138,13 +138,13 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
await _async_update_all()
for platform in BMW_PLATFORMS:
for platform in PLATFORMS:
if platform != NOTIFY_DOMAIN:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, platform)
)
# set up notify platform, no entry support for notify component yet,
# set up notify platform, no entry support for notify platform yet,
# have to use discovery to load platform.
hass.async_create_task(
discovery.async_load_platform(
@ -164,9 +164,9 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in BMW_PLATFORMS
if component != NOTIFY_DOMAIN
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
if platform != NOTIFY_DOMAIN
]
)
)

View file

@ -65,9 +65,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
_async_remove_old_device_identifiers(config_entry_id, device_registry, hub)
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -78,8 +78,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -28,9 +28,9 @@ async def async_setup_entry(hass, config_entry):
UNDO_UPDATE_LISTENER: undo_listener,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -41,8 +41,8 @@ async def async_unload_entry(hass, config_entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -46,9 +46,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
hass.data[DOMAIN][DATA_CONFIG_ENTRY][entry.entry_id] = coordinator
hass.data[DOMAIN][SNMP] = snmp_engine
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -59,8 +59,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -107,9 +107,9 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool
DATA_UNDO_UPDATE_LISTENER: undo_listener,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -120,8 +120,8 @@ async def async_unload_entry(hass: HomeAssistantType, entry: ConfigEntry) -> boo
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -117,9 +117,9 @@ async def async_setup_entry(hass: HomeAssistantType, config_entry: ConfigEntry)
hass.data[DOMAIN][config_entry.entry_id] = coordinator
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -132,8 +132,8 @@ async def async_unload_entry(
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -115,9 +115,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
entry_data[CONF_CONFIG_LISTENER] = entry.add_update_listener(update_listener)
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -134,8 +134,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -44,9 +44,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
if not entry.unique_id:
hass.config_entries.async_update_entry(entry, unique_id=entry.data["country"])
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -57,8 +57,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -25,7 +25,7 @@ DOMAIN = "daikin"
PARALLEL_UPDATES = 0
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
COMPONENT_TYPES = ["climate", "sensor", "switch"]
PLATFORMS = ["climate", "sensor", "switch"]
CONFIG_SCHEMA = vol.Schema(
vol.All(
@ -83,9 +83,9 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
if not daikin_api:
return False
hass.data.setdefault(DOMAIN, {}).update({entry.entry_id: daikin_api})
for component in COMPONENT_TYPES:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -94,8 +94,8 @@ async def async_unload_entry(hass, config_entry):
"""Unload a config entry."""
await asyncio.wait(
[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in COMPONENT_TYPES
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
hass.data[DOMAIN].pop(config_entry.entry_id)

View file

@ -13,7 +13,7 @@ from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__)
DANFOSS_AIR_PLATFORMS = ["sensor", "binary_sensor", "switch"]
PLATFORMS = ["sensor", "binary_sensor", "switch"]
DOMAIN = "danfoss_air"
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
@ -29,7 +29,7 @@ def setup(hass, config):
hass.data[DOMAIN] = DanfossAir(conf[CONF_HOST])
for platform in DANFOSS_AIR_PLATFORMS:
for platform in PLATFORMS:
discovery.load_platform(hass, platform, DOMAIN, {}, config)
return True

View file

@ -28,7 +28,7 @@ CONF_ALLOW_DECONZ_GROUPS = "allow_deconz_groups"
CONF_ALLOW_NEW_DEVICES = "allow_new_devices"
CONF_MASTER_GATEWAY = "master"
SUPPORTED_PLATFORMS = [
PLATFORMS = [
BINARY_SENSOR_DOMAIN,
CLIMATE_DOMAIN,
COVER_DOMAIN,

View file

@ -26,7 +26,7 @@ from .const import (
NEW_LIGHT,
NEW_SCENE,
NEW_SENSOR,
SUPPORTED_PLATFORMS,
PLATFORMS,
)
from .deconz_event import async_setup_events, async_unload_events
from .errors import AuthenticationRequired, CannotConnect
@ -184,10 +184,10 @@ class DeconzGateway:
)
return False
for component in SUPPORTED_PLATFORMS:
for platform in PLATFORMS:
self.hass.async_create_task(
self.hass.config_entries.async_forward_entry_setup(
self.config_entry, component
self.config_entry, platform
)
)
@ -259,9 +259,9 @@ class DeconzGateway:
self.api.async_connection_status_callback = None
self.api.close()
for component in SUPPORTED_PLATFORMS:
for platform in PLATFORMS:
await self.hass.config_entries.async_forward_entry_unload(
self.config_entry, component
self.config_entry, platform
)
for unsub_dispatcher in self.listeners:

View file

@ -50,9 +50,9 @@ async def async_setup(hass, config):
)
# Set up demo platforms
for component in COMPONENTS_WITH_DEMO_PLATFORM:
for platform in COMPONENTS_WITH_DEMO_PLATFORM:
hass.async_create_task(
hass.helpers.discovery.async_load_platform(component, DOMAIN, {}, config)
hass.helpers.discovery.async_load_platform(platform, DOMAIN, {}, config)
)
config.setdefault(ha.DOMAIN, {})
@ -146,9 +146,9 @@ async def async_setup(hass, config):
async def async_setup_entry(hass, config_entry):
"""Set the config entry up."""
# Set up demo platforms with config entry
for component in COMPONENTS_WITH_CONFIG_ENTRY_DEMO_PLATFORM:
for platform in COMPONENTS_WITH_CONFIG_ENTRY_DEMO_PLATFORM:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True

View file

@ -70,9 +70,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
await hass.data[DOMAIN][entry.entry_id][COORDINATOR].async_refresh()
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -83,8 +83,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -45,9 +45,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.data[DOMAIN][entry.entry_id] = dtv
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -58,8 +58,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -168,9 +168,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
UNDO_UPDATE_LISTENER: undo_listener,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -188,8 +188,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -44,8 +44,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -24,9 +24,9 @@ async def async_setup_entry(hass, config_entry):
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][config_entry.entry_id] = player
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -37,8 +37,8 @@ async def async_unload_entry(hass, config_entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -47,8 +47,8 @@ from .const import (
DEFAULT_PORT,
DEFAULT_TEMPLATES,
DOMAIN,
ENTITY_PLATFORMS,
LOGGER,
PLATFORMS,
SERVICE_REQUEST_AREA_PRESET,
SERVICE_REQUEST_CHANNEL_LEVEL,
)
@ -267,14 +267,17 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
# need to do it before the listener
hass.data[DOMAIN][entry.entry_id] = bridge
entry.add_update_listener(async_entry_changed)
if not await bridge.async_setup():
LOGGER.error("Could not set up bridge for entry %s", entry.data)
hass.data[DOMAIN][entry.entry_id] = None
raise ConfigEntryNotReady
for platform in ENTITY_PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -284,7 +287,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.data[DOMAIN].pop(entry.entry_id)
tasks = [
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in ENTITY_PLATFORMS
for platform in PLATFORMS
]
results = await asyncio.gather(*tasks)
return False not in results

View file

@ -16,14 +16,7 @@ from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_send
from .const import (
ATTR_AREA,
ATTR_HOST,
ATTR_PACKET,
ATTR_PRESET,
ENTITY_PLATFORMS,
LOGGER,
)
from .const import ATTR_AREA, ATTR_HOST, ATTR_PACKET, ATTR_PRESET, LOGGER, PLATFORMS
from .convert_config import convert_config
@ -107,7 +100,7 @@ class DynaliteBridge:
def add_devices_when_registered(self, devices: List[DynaliteBaseDevice]) -> None:
"""Add the devices to HA if the add devices callback was registered, otherwise queue until it is."""
for platform in ENTITY_PLATFORMS:
for platform in PLATFORMS:
platform_devices = [
device for device in devices if device.category == platform
]

View file

@ -6,7 +6,7 @@ from homeassistant.const import CONF_ROOM
LOGGER = logging.getLogger(__package__)
DOMAIN = "dynalite"
ENTITY_PLATFORMS = ["light", "switch", "cover"]
PLATFORMS = ["light", "switch", "cover"]
CONF_ACTIVE = "active"

View file

@ -17,7 +17,7 @@ CONF_RETRY = "retry"
DEFAULT_TIMEOUT = 5
DEFAULT_RETRY = 10
DYSON_DEVICES = "dyson_devices"
DYSON_PLATFORMS = ["sensor", "fan", "vacuum", "climate", "air_quality"]
PLATFORMS = ["sensor", "fan", "vacuum", "climate", "air_quality"]
DOMAIN = "dyson"
@ -105,7 +105,7 @@ def setup(hass, config):
# Start fan/sensors components
if hass.data[DYSON_DEVICES]:
_LOGGER.debug("Starting sensor/fan components")
for platform in DYSON_PLATFORMS:
for platform in PLATFORMS:
discovery.load_platform(hass, platform, DOMAIN, {}, config)
return True

View file

@ -10,13 +10,7 @@ from homeassistant.const import CONF_API_KEY
from homeassistant.helpers import config_validation as cv
from homeassistant.util import Throttle
from .const import (
_LOGGER,
CONF_REFRESH_TOKEN,
DATA_ECOBEE_CONFIG,
DOMAIN,
ECOBEE_PLATFORMS,
)
from .const import _LOGGER, CONF_REFRESH_TOKEN, DATA_ECOBEE_CONFIG, DOMAIN, PLATFORMS
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=180)
@ -32,7 +26,7 @@ async def async_setup(hass, config):
But, an "ecobee:" entry in configuration.yaml will trigger an import flow
if a config entry doesn't already exist. If ecobee.conf exists, the import
flow will attempt to import it and create a config entry, to assist users
migrating from the old ecobee component. Otherwise, the user will have to
migrating from the old ecobee integration. Otherwise, the user will have to
continue setting up the integration via the config flow.
"""
hass.data[DATA_ECOBEE_CONFIG] = config.get(DOMAIN, {})
@ -66,9 +60,9 @@ async def async_setup_entry(hass, entry):
hass.data[DOMAIN] = data
for component in ECOBEE_PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -120,7 +114,7 @@ async def async_unload_entry(hass, config_entry):
hass.data.pop(DOMAIN)
tasks = []
for platform in ECOBEE_PLATFORMS:
for platform in PLATFORMS:
tasks.append(
hass.config_entries.async_forward_entry_unload(config_entry, platform)
)

View file

@ -37,7 +37,7 @@ ECOBEE_MODEL_TO_NAME = {
"vulcanSmart": "ecobee4 Smart",
}
ECOBEE_PLATFORMS = ["binary_sensor", "climate", "sensor", "weather"]
PLATFORMS = ["binary_sensor", "climate", "sensor", "weather"]
MANUFACTURER = "ecobee"

View file

@ -60,9 +60,9 @@ async def async_setup_entry(hass, config_entry):
hass.data[DOMAIN][API_CLIENT][config_entry.entry_id] = api
hass.data[DOMAIN][EQUIPMENT][config_entry.entry_id] = equipment
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
api.subscribe()
@ -92,8 +92,8 @@ async def async_setup_entry(hass, config_entry):
async def async_unload_entry(hass, entry):
"""Unload a EcoNet config entry."""
tasks = [
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
await asyncio.gather(*tasks)

View file

@ -52,7 +52,7 @@ SYNC_TIMEOUT = 120
_LOGGER = logging.getLogger(__name__)
SUPPORTED_DOMAINS = [
PLATFORMS = [
"alarm_control_panel",
"climate",
"light",
@ -262,9 +262,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"keypads": {},
}
for component in SUPPORTED_DOMAINS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -289,8 +289,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in SUPPORTED_DOMAINS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -48,9 +48,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
_LOGGER.warning("Cannot connect to projector %s", entry.data[CONF_HOST])
return False
hass.data[DOMAIN][entry.entry_id] = projector
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -60,8 +60,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -39,9 +39,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
hass.data[DOMAIN][entry.entry_id] = coordinator
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -52,8 +52,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -37,7 +37,7 @@ CONF_RESET_COLOR = "reset_color"
DOMAIN = "fibaro"
FIBARO_CONTROLLERS = "fibaro_controllers"
FIBARO_DEVICES = "fibaro_devices"
FIBARO_COMPONENTS = [
PLATFORMS = [
"binary_sensor",
"climate",
"cover",
@ -365,21 +365,21 @@ def setup(hass, base_config):
controller.disable_state_handler()
hass.data[FIBARO_DEVICES] = {}
for component in FIBARO_COMPONENTS:
hass.data[FIBARO_DEVICES][component] = []
for platform in PLATFORMS:
hass.data[FIBARO_DEVICES][platform] = []
for gateway in gateways:
controller = FibaroController(gateway)
if controller.connect():
hass.data[FIBARO_CONTROLLERS][controller.hub_serial] = controller
for component in FIBARO_COMPONENTS:
hass.data[FIBARO_DEVICES][component].extend(
controller.fibaro_devices[component]
for platform in PLATFORMS:
hass.data[FIBARO_DEVICES][platform].extend(
controller.fibaro_devices[platform]
)
if hass.data[FIBARO_CONTROLLERS]:
for component in FIBARO_COMPONENTS:
discovery.load_platform(hass, component, DOMAIN, {}, base_config)
for platform in PLATFORMS:
discovery.load_platform(hass, platform, DOMAIN, {}, base_config)
for controller in hass.data[FIBARO_CONTROLLERS].values():
controller.enable_state_handler()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_fibaro)

View file

@ -26,7 +26,7 @@ MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=60)
_LOGGER = logging.getLogger(__name__)
SUPPORTED_PLATFORMS = {SENSOR_DOMAIN, BINARYSENSOR_DOMAIN, SWITCH_DOMAIN}
PLATFORMS = [SENSOR_DOMAIN, BINARYSENSOR_DOMAIN, SWITCH_DOMAIN]
async def async_setup(hass: HomeAssistant, config: dict) -> bool:
@ -64,7 +64,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
DATA_COORDINATOR: coordinator,
}
for platform in SUPPORTED_PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, platform)
)
@ -83,7 +83,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in SUPPORTED_PLATFORMS
for platform in PLATFORMS
]
)
)

View file

@ -49,9 +49,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
tasks = [device.async_refresh() for device in devices]
await asyncio.gather(*tasks)
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -62,8 +62,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -79,9 +79,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
FLUME_HTTP_SESSION: http_session,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -92,8 +92,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -67,9 +67,9 @@ async def async_setup_entry(hass, config_entry):
await asyncio.gather(*data_init_tasks)
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -80,8 +80,8 @@ async def async_unload_entry(hass, config_entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -22,9 +22,9 @@ async def async_setup(hass: HomeAssistant, config: dict):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up foscam from a config entry."""
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
hass.data[DOMAIN][entry.entry_id] = entry.data
@ -37,8 +37,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -93,9 +93,9 @@ async def async_setup_entry(hass, entry):
hass.data.setdefault(DOMAIN, {CONF_CONNECTIONS: {}, CONF_DEVICES: set()})
hass.data[DOMAIN][CONF_CONNECTIONS][entry.entry_id] = fritz
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
def logout_fritzbox(event):
@ -115,8 +115,8 @@ async def async_unload_entry(hass, entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -59,9 +59,9 @@ async def async_setup_entry(hass, config_entry):
UNDO_UPDATE_LISTENER: undo_listener,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -73,8 +73,8 @@ async def async_unload_entry(hass, config_entry):
unload_ok = all(
await gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -57,9 +57,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
garmin_data = GarminConnectData(hass, garmin_client)
hass.data[DOMAIN][entry.entry_id] = garmin_data
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -70,8 +70,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -76,8 +76,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -104,9 +104,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
].async_add_listener(async_process_paired_sensor_uids)
# Set up all of the Guardian entity platforms:
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -117,8 +117,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -148,9 +148,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
)
data[config_entry.entry_id] = api
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
if not hass.services.has_service(DOMAIN, SERVICE_API_CALL):
@ -166,8 +166,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -48,9 +48,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
entry.add_update_listener(_update_listener)
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -108,8 +108,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -71,9 +71,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await update_all_devices(hass, entry)
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -84,8 +84,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -16,7 +16,7 @@ _LOGGER = logging.getLogger(".")
DOMAIN = "homematicip_cloud"
COMPONENTS = [
PLATFORMS = [
ALARM_CONTROL_PANEL_DOMAIN,
BINARY_SENSOR_DOMAIN,
CLIMATE_DOMAIN,

View file

@ -13,7 +13,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import HomeAssistantType
from .const import COMPONENTS, HMIPC_AUTHTOKEN, HMIPC_HAPID, HMIPC_NAME, HMIPC_PIN
from .const import HMIPC_AUTHTOKEN, HMIPC_HAPID, HMIPC_NAME, HMIPC_PIN, PLATFORMS
from .errors import HmipcConnectionError
_LOGGER = logging.getLogger(__name__)
@ -102,10 +102,10 @@ class HomematicipHAP:
"Connected to HomematicIP with HAP %s", self.config_entry.unique_id
)
for component in COMPONENTS:
for platform in PLATFORMS:
self.hass.async_create_task(
self.hass.config_entries.async_forward_entry_setup(
self.config_entry, component
self.config_entry, platform
)
)
return True
@ -215,9 +215,9 @@ class HomematicipHAP:
self._retry_task.cancel()
await self.home.disable_events()
_LOGGER.info("Closed connection to HomematicIP cloud server")
for component in COMPONENTS:
for platform in PLATFORMS:
await self.hass.config_entries.async_forward_entry_unload(
self.config_entry, component
self.config_entry, platform
)
self.hmip_device_by_entity_id = {}
return True

View file

@ -132,9 +132,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
DEVICE_INFO: device_info,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -180,8 +180,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -32,9 +32,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
hass.data.setdefault(DOMAIN, {})
hass.data[DOMAIN][entry.entry_id] = hub
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -45,8 +45,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -281,8 +281,8 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
async def setup_then_listen() -> None:
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_setup(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_setup(config_entry, platform)
for platform in PLATFORMS
]
)
assert hyperion_client
@ -310,8 +310,8 @@ async def async_unload_entry(
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -55,7 +55,7 @@ DOMAIN = "ihc"
IHC_CONTROLLER = "controller"
IHC_INFO = "info"
IHC_PLATFORMS = ("binary_sensor", "light", "sensor", "switch")
PLATFORMS = ("binary_sensor", "light", "sensor", "switch")
def validate_name(config):
@ -219,7 +219,7 @@ PULSE_SCHEMA = vol.Schema(
def setup(hass, config):
"""Set up the IHC platform."""
"""Set up the IHC integration."""
conf = config.get(DOMAIN)
for index, controller_conf in enumerate(conf):
if not ihc_setup(hass, config, controller_conf, index):
@ -229,7 +229,7 @@ def setup(hass, config):
def ihc_setup(hass, config, conf, controller_id):
"""Set up the IHC component."""
"""Set up the IHC integration."""
url = conf[CONF_URL]
username = conf[CONF_USERNAME]
password = conf[CONF_PASSWORD]
@ -256,11 +256,11 @@ def ihc_setup(hass, config, conf, controller_id):
def get_manual_configuration(hass, config, conf, ihc_controller, controller_id):
"""Get manual configuration for IHC devices."""
for component in IHC_PLATFORMS:
for platform in PLATFORMS:
discovery_info = {}
if component in conf:
component_setup = conf.get(component)
for sensor_cfg in component_setup:
if platform in conf:
platform_setup = conf.get(platform)
for sensor_cfg in platform_setup:
name = sensor_cfg[CONF_NAME]
device = {
"ihc_id": sensor_cfg[CONF_ID],
@ -281,7 +281,7 @@ def get_manual_configuration(hass, config, conf, ihc_controller, controller_id):
}
discovery_info[name] = device
if discovery_info:
discovery.load_platform(hass, component, DOMAIN, discovery_info, config)
discovery.load_platform(hass, platform, DOMAIN, discovery_info, config)
def autosetup_ihc_products(
@ -304,21 +304,23 @@ def autosetup_ihc_products(
except vol.Invalid as exception:
_LOGGER.error("Invalid IHC auto setup data: %s", exception)
return False
groups = project.findall(".//group")
for component in IHC_PLATFORMS:
component_setup = auto_setup_conf[component]
discovery_info = get_discovery_info(component_setup, groups, controller_id)
for platform in PLATFORMS:
platform_setup = auto_setup_conf[platform]
discovery_info = get_discovery_info(platform_setup, groups, controller_id)
if discovery_info:
discovery.load_platform(hass, component, DOMAIN, discovery_info, config)
discovery.load_platform(hass, platform, DOMAIN, discovery_info, config)
return True
def get_discovery_info(component_setup, groups, controller_id):
"""Get discovery info for specified IHC component."""
def get_discovery_info(platform_setup, groups, controller_id):
"""Get discovery info for specified IHC platform."""
discovery_data = {}
for group in groups:
groupname = group.attrib["name"]
for product_cfg in component_setup:
for product_cfg in platform_setup:
products = group.findall(product_cfg[CONF_XPATH])
for product in products:
nodes = product.findall(product_cfg[CONF_NODE])

View file

@ -17,7 +17,7 @@ from .const import (
CONF_UNITCODE,
CONF_X10,
DOMAIN,
INSTEON_COMPONENTS,
INSTEON_PLATFORMS,
ON_OFF_EVENTS,
)
from .schemas import convert_yaml_to_config_flow
@ -138,9 +138,9 @@ async def async_setup_entry(hass, entry):
)
device = devices.add_x10_device(housecode, unitcode, x10_type, steps)
for component in INSTEON_COMPONENTS:
for platform in INSTEON_PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
for address in devices:

View file

@ -34,7 +34,7 @@ from pyinsteon.groups import (
DOMAIN = "insteon"
INSTEON_COMPONENTS = [
INSTEON_PLATFORMS = [
"binary_sensor",
"climate",
"cover",

View file

@ -66,9 +66,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if not coordinator.last_update_success:
raise ConfigEntryNotReady
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -79,8 +79,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -84,9 +84,9 @@ async def async_setup_entry(hass, entry):
await asyncio.gather(*init_data_update_tasks)
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -97,8 +97,8 @@ async def async_unload_entry(hass, entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -31,7 +31,7 @@ from .const import (
ISY994_PROGRAMS,
ISY994_VARIABLES,
MANUFACTURER,
SUPPORTED_PLATFORMS,
PLATFORMS,
SUPPORTED_PROGRAM_PLATFORMS,
UNDO_UPDATE_LISTENER,
)
@ -111,7 +111,7 @@ async def async_setup_entry(
hass_isy_data = hass.data[DOMAIN][entry.entry_id]
hass_isy_data[ISY994_NODES] = {}
for platform in SUPPORTED_PLATFORMS:
for platform in PLATFORMS:
hass_isy_data[ISY994_NODES][platform] = []
hass_isy_data[ISY994_PROGRAMS] = {}
@ -176,7 +176,7 @@ async def async_setup_entry(
await _async_get_or_create_isy_device_in_registry(hass, entry, isy)
# Load platforms for the devices in the ISY controller that we support.
for platform in SUPPORTED_PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, platform)
)
@ -248,7 +248,7 @@ async def async_unload_entry(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in SUPPORTED_PLATFORMS
for platform in PLATFORMS
]
)
)

View file

@ -129,7 +129,7 @@ DEFAULT_VAR_SENSOR_STRING = "HA."
KEY_ACTIONS = "actions"
KEY_STATUS = "status"
SUPPORTED_PLATFORMS = [BINARY_SENSOR, SENSOR, LOCK, FAN, COVER, LIGHT, SWITCH, CLIMATE]
PLATFORMS = [BINARY_SENSOR, SENSOR, LOCK, FAN, COVER, LIGHT, SWITCH, CLIMATE]
SUPPORTED_PROGRAM_PLATFORMS = [BINARY_SENSOR, LOCK, FAN, COVER, SWITCH]
SUPPORTED_BIN_SENS_CLASSES = ["moisture", "opening", "motion", "climate"]

View file

@ -38,12 +38,12 @@ from .const import (
KEY_ACTIONS,
KEY_STATUS,
NODE_FILTERS,
PLATFORMS,
SUBNODE_CLIMATE_COOL,
SUBNODE_CLIMATE_HEAT,
SUBNODE_EZIO2X4_SENSORS,
SUBNODE_FANLINC_LIGHT,
SUBNODE_IOLINC_RELAY,
SUPPORTED_PLATFORMS,
SUPPORTED_PROGRAM_PLATFORMS,
TYPE_CATEGORY_SENSOR_ACTUATORS,
TYPE_EZIO2X4,
@ -69,7 +69,7 @@ def _check_for_node_def(
node_def_id = node.node_def_id
platforms = SUPPORTED_PLATFORMS if not single_platform else [single_platform]
platforms = PLATFORMS if not single_platform else [single_platform]
for platform in platforms:
if node_def_id in NODE_FILTERS[platform][FILTER_NODE_DEF_ID]:
hass_isy_data[ISY994_NODES][platform].append(node)
@ -94,7 +94,7 @@ def _check_for_insteon_type(
return False
device_type = node.type
platforms = SUPPORTED_PLATFORMS if not single_platform else [single_platform]
platforms = PLATFORMS if not single_platform else [single_platform]
for platform in platforms:
if any(
device_type.startswith(t)
@ -159,7 +159,7 @@ def _check_for_zwave_cat(
return False
device_type = node.zwave_props.category
platforms = SUPPORTED_PLATFORMS if not single_platform else [single_platform]
platforms = PLATFORMS if not single_platform else [single_platform]
for platform in platforms:
if any(
device_type.startswith(t)
@ -198,7 +198,7 @@ def _check_for_uom_id(
return True
return False
platforms = SUPPORTED_PLATFORMS if not single_platform else [single_platform]
platforms = PLATFORMS if not single_platform else [single_platform]
for platform in platforms:
if node_uom in NODE_FILTERS[platform][FILTER_UOM]:
hass_isy_data[ISY994_NODES][platform].append(node)
@ -235,7 +235,7 @@ def _check_for_states_in_uom(
return True
return False
platforms = SUPPORTED_PLATFORMS if not single_platform else [single_platform]
platforms = PLATFORMS if not single_platform else [single_platform]
for platform in platforms:
if node_uom == set(NODE_FILTERS[platform][FILTER_STATES]):
hass_isy_data[ISY994_NODES][platform].append(node)

View file

@ -27,7 +27,7 @@ from .const import (
ISY994_NODES,
ISY994_PROGRAMS,
ISY994_VARIABLES,
SUPPORTED_PLATFORMS,
PLATFORMS,
SUPPORTED_PROGRAM_PLATFORMS,
)
@ -279,7 +279,7 @@ def async_setup_services(hass: HomeAssistantType):
hass_isy_data = hass.data[DOMAIN][config_entry_id]
uuid = hass_isy_data[ISY994_ISY].configuration["uuid"]
for platform in SUPPORTED_PLATFORMS:
for platform in PLATFORMS:
for node in hass_isy_data[ISY994_NODES][platform]:
if hasattr(node, "address"):
current_unique_ids.append(f"{uuid}_{node.address}")

View file

@ -91,9 +91,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
await coordinator.async_refresh()
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -104,8 +104,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -25,7 +25,7 @@ from .const import (
DEFAULT_PREFERRED_UNIT,
DEFAULT_SCAN_INTERVAL,
DOMAIN,
KAITERRA_COMPONENTS,
PLATFORMS,
)
KAITERRA_DEVICE_SCHEMA = vol.Schema(
@ -54,7 +54,7 @@ CONFIG_SCHEMA = vol.Schema({DOMAIN: KAITERRA_SCHEMA}, extra=vol.ALLOW_EXTRA)
async def async_setup(hass, config):
"""Set up the Kaiterra components."""
"""Set up the Kaiterra integration."""
conf = config[DOMAIN]
scan_interval = conf[CONF_SCAN_INTERVAL]
@ -76,11 +76,11 @@ async def async_setup(hass, config):
device.get(CONF_NAME) or device[CONF_TYPE],
device[CONF_DEVICE_ID],
)
for component in KAITERRA_COMPONENTS:
for platform in PLATFORMS:
hass.async_create_task(
async_load_platform(
hass,
component,
platform,
DOMAIN,
{CONF_NAME: device_name, CONF_DEVICE_ID: device_id},
config,

View file

@ -71,4 +71,4 @@ DEFAULT_AQI_STANDARD = "us"
DEFAULT_PREFERRED_UNIT = []
DEFAULT_SCAN_INTERVAL = timedelta(seconds=30)
KAITERRA_COMPONENTS = ["sensor", "air_quality"]
PLATFORMS = ["sensor", "air_quality"]

View file

@ -44,9 +44,9 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
UNDO_UPDATE_LISTENER: undo_listener,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -56,8 +56,8 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
"""Unload a config entry."""
hass.data[DOMAIN][config_entry.entry_id][UNDO_UPDATE_LISTENER]()
for component in PLATFORMS:
await hass.config_entries.async_forward_entry_unload(config_entry, component)
for platform in PLATFORMS:
await hass.config_entries.async_forward_entry_unload(config_entry, platform)
router: KeeneticRouter = hass.data[DOMAIN][config_entry.entry_id][ROUTER]

View file

@ -80,9 +80,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
DATA_COORDINATOR: coordinator,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -93,8 +93,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -72,9 +72,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
DATA_REMOVE_LISTENER: remove_stop_listener,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -85,8 +85,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -261,9 +261,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
# async_connect will handle retries until it establishes a connection
await client.async_connect()
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
# config entry specific data to enable unload
@ -278,8 +278,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -16,9 +16,9 @@ async def async_setup(hass: HomeAssistant, config: dict):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up Kuler Sky from a config entry."""
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -29,8 +29,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -59,9 +59,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.data[DOMAIN] = system
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -73,8 +73,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -30,9 +30,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
except LitterRobotException as ex:
raise ConfigEntryNotReady from ex
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -43,8 +43,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -47,6 +47,8 @@ SERVICE_LIVESTREAM_RECORD = "livestream_record"
ATTR_VALUE = "value"
ATTR_DURATION = "duration"
PLATFORMS = ["camera", "sensor"]
SENSOR_SCHEMA = vol.Schema(
{
vol.Optional(CONF_MONITORED_CONDITIONS, default=list(LOGI_SENSORS)): vol.All(
@ -171,9 +173,9 @@ async def async_setup_entry(hass, entry):
hass.data[DATA_LOGI] = logi_circle
for component in "camera", "sensor":
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
async def service_handler(service):
@ -219,8 +221,8 @@ async def async_setup_entry(hass, entry):
async def async_unload_entry(hass, entry):
"""Unload a config entry."""
for component in "camera", "sensor":
await hass.config_entries.async_forward_entry_unload(entry, component)
for platform in PLATFORMS:
await hass.config_entries.async_forward_entry_unload(entry, platform)
logi_circle = hass.data.pop(DATA_LOGI)

View file

@ -12,6 +12,8 @@ from homeassistant.util import slugify
DOMAIN = "lutron"
PLATFORMS = ["light", "cover", "switch", "scene", "binary_sensor"]
_LOGGER = logging.getLogger(__name__)
LUTRON_BUTTONS = "lutron_buttons"
@ -37,7 +39,7 @@ CONFIG_SCHEMA = vol.Schema(
def setup(hass, base_config):
"""Set up the Lutron component."""
"""Set up the Lutron integration."""
hass.data[LUTRON_BUTTONS] = []
hass.data[LUTRON_CONTROLLER] = None
hass.data[LUTRON_DEVICES] = {
@ -92,8 +94,8 @@ def setup(hass, base_config):
(area.name, area.occupancy_group)
)
for component in ("light", "cover", "switch", "scene", "binary_sensor"):
discovery.load_platform(hass, component, DOMAIN, {}, base_config)
for platform in PLATFORMS:
discovery.load_platform(hass, platform, DOMAIN, {}, base_config)
return True

View file

@ -62,7 +62,7 @@ CONFIG_SCHEMA = vol.Schema(
extra=vol.ALLOW_EXTRA,
)
LUTRON_CASETA_COMPONENTS = ["light", "switch", "cover", "scene", "fan", "binary_sensor"]
PLATFORMS = ["light", "switch", "cover", "scene", "fan", "binary_sensor"]
async def async_setup(hass, base_config):
@ -125,7 +125,7 @@ async def async_setup_entry(hass, config_entry):
bridge_device = devices[BRIDGE_DEVICE_ID]
await _async_register_bridge_device(hass, config_entry.entry_id, bridge_device)
# Store this bridge (keyed by entry_id) so it can be retrieved by the
# components we're setting up.
# platforms we're setting up.
hass.data[DOMAIN][config_entry.entry_id] = {
BRIDGE_LEAP: bridge,
BRIDGE_DEVICE: bridge_device,
@ -139,9 +139,9 @@ async def async_setup_entry(hass, config_entry):
# pico remotes to control other devices.
await async_setup_lip(hass, config_entry, bridge.lip_devices)
for component in LUTRON_CASETA_COMPONENTS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(config_entry, component)
hass.config_entries.async_forward_entry_setup(config_entry, platform)
)
return True
@ -289,8 +289,8 @@ async def async_unload_entry(hass, config_entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in LUTRON_CASETA_COMPONENTS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -113,9 +113,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if not coordinator.last_update_success:
raise ConfigEntryNotReady
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -126,8 +126,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -121,9 +121,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
raise ConfigEntryNotReady
# Setup components
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -134,8 +134,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -61,9 +61,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
if metoffice_data.now is None:
raise ConfigEntryNotReady()
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -74,8 +74,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -104,8 +104,8 @@ async def async_unload_entry(hass, entry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -54,9 +54,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
FIRST_RUN: first_run,
}
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -67,8 +67,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -18,7 +18,7 @@ from .const import (
KEY_GATEWAY,
KEY_MULTICAST_LISTENER,
MANUFACTURER,
MOTION_PLATFORMS,
PLATFORMS,
)
from .gateway import ConnectMotionGateway
@ -107,9 +107,9 @@ async def async_setup_entry(
sw_version=motion_gateway.protocol,
)
for component in MOTION_PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -122,8 +122,8 @@ async def async_unload_entry(
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(config_entry, component)
for component in MOTION_PLATFORMS
hass.config_entries.async_forward_entry_unload(config_entry, platform)
for platform in PLATFORMS
]
)
)

View file

@ -3,7 +3,7 @@ DOMAIN = "motion_blinds"
MANUFACTURER = "Motion Blinds, Coulisse B.V."
DEFAULT_GATEWAY_NAME = "Motion Blinds Gateway"
MOTION_PLATFORMS = ["cover", "sensor"]
PLATFORMS = ["cover", "sensor"]
KEY_GATEWAY = "gateway"
KEY_COORDINATOR = "coordinator"

View file

@ -43,9 +43,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: dict):
hass.data[DOMAIN] = coordinator
for component in PLATFORMS:
for platform in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
hass.config_entries.async_forward_entry_setup(entry, platform)
)
return True
@ -56,8 +56,8 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry):
unload_ok = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, component)
for component in PLATFORMS
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
]
)
)

Some files were not shown because too many files have changed in this diff Show more