mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Remove ability to configure monitored conditions in IQVIA (#32223)
* Remove ability to configure monitored conditions in IQVIA * Deprecate instead of removing (until 0.108.0) * Simplify imports * Update version
This commit is contained in:
parent
5bdf450f78
commit
9329bc4ca0
@ -59,13 +59,16 @@ FETCHER_MAPPING = {
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
DOMAIN: vol.Schema(
|
||||
DOMAIN: vol.All(
|
||||
cv.deprecated(CONF_MONITORED_CONDITIONS, invalidation_version="0.114.0"),
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_ZIP_CODE): str,
|
||||
vol.Required(CONF_MONITORED_CONDITIONS, default=list(SENSORS)): vol.All(
|
||||
cv.ensure_list, [vol.In(SENSORS)]
|
||||
),
|
||||
vol.Optional(
|
||||
CONF_MONITORED_CONDITIONS, default=list(SENSORS)
|
||||
): vol.All(cv.ensure_list, [vol.In(SENSORS)]),
|
||||
}
|
||||
),
|
||||
)
|
||||
},
|
||||
extra=vol.ALLOW_EXTRA,
|
||||
@ -100,10 +103,7 @@ async def async_setup_entry(hass, config_entry):
|
||||
websession = aiohttp_client.async_get_clientsession(hass)
|
||||
|
||||
try:
|
||||
iqvia = IQVIAData(
|
||||
Client(config_entry.data[CONF_ZIP_CODE], websession),
|
||||
config_entry.data.get(CONF_MONITORED_CONDITIONS, list(SENSORS)),
|
||||
)
|
||||
iqvia = IQVIAData(Client(config_entry.data[CONF_ZIP_CODE], websession))
|
||||
await iqvia.async_update()
|
||||
except InvalidZipError:
|
||||
_LOGGER.error("Invalid ZIP code provided: %s", config_entry.data[CONF_ZIP_CODE])
|
||||
@ -143,11 +143,10 @@ async def async_unload_entry(hass, config_entry):
|
||||
class IQVIAData:
|
||||
"""Define a data object to retrieve info from IQVIA."""
|
||||
|
||||
def __init__(self, client, sensor_types):
|
||||
def __init__(self, client):
|
||||
"""Initialize."""
|
||||
self._client = client
|
||||
self.data = {}
|
||||
self.sensor_types = sensor_types
|
||||
self.zip_code = client.zip_code
|
||||
|
||||
self.fetchers = Registry()
|
||||
@ -164,7 +163,7 @@ class IQVIAData:
|
||||
tasks = {}
|
||||
|
||||
for conditions, fetcher_types in FETCHER_MAPPING.items():
|
||||
if not any(c in self.sensor_types for c in conditions):
|
||||
if not any(c in SENSORS for c in conditions):
|
||||
continue
|
||||
|
||||
for fetcher_type in fetcher_types:
|
||||
|
@ -66,7 +66,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
||||
}
|
||||
|
||||
sensors = []
|
||||
for sensor_type in iqvia.sensor_types:
|
||||
for sensor_type in SENSORS:
|
||||
klass = sensor_class_mapping[sensor_type]
|
||||
name, icon = SENSORS[sensor_type]
|
||||
sensors.append(klass(iqvia, sensor_type, name, icon, iqvia.zip_code))
|
||||
|
Loading…
x
Reference in New Issue
Block a user