mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Flag Tradfri groups and YAML as deprecated (#65226)
This commit is contained in:
parent
2129972904
commit
473abb1793
@ -57,12 +57,18 @@ LISTENERS = "tradfri_listeners"
|
|||||||
CONFIG_SCHEMA = vol.Schema(
|
CONFIG_SCHEMA = vol.Schema(
|
||||||
{
|
{
|
||||||
DOMAIN: vol.Schema(
|
DOMAIN: vol.Schema(
|
||||||
{
|
vol.All(
|
||||||
vol.Optional(CONF_HOST): cv.string,
|
cv.deprecated(CONF_HOST),
|
||||||
vol.Optional(
|
cv.deprecated(
|
||||||
CONF_ALLOW_TRADFRI_GROUPS, default=DEFAULT_ALLOW_TRADFRI_GROUPS
|
CONF_ALLOW_TRADFRI_GROUPS,
|
||||||
): cv.boolean,
|
),
|
||||||
}
|
{
|
||||||
|
vol.Optional(CONF_HOST): cv.string,
|
||||||
|
vol.Optional(
|
||||||
|
CONF_ALLOW_TRADFRI_GROUPS, default=DEFAULT_ALLOW_TRADFRI_GROUPS
|
||||||
|
): cv.boolean,
|
||||||
|
},
|
||||||
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
extra=vol.ALLOW_EXTRA,
|
extra=vol.ALLOW_EXTRA,
|
||||||
@ -120,6 +126,7 @@ async def async_setup_entry(
|
|||||||
|
|
||||||
api = factory.request
|
api = factory.request
|
||||||
gateway = Gateway()
|
gateway = Gateway()
|
||||||
|
groups: list[Group] = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
gateway_info = await api(gateway.get_gateway_info(), timeout=TIMEOUT_API)
|
gateway_info = await api(gateway.get_gateway_info(), timeout=TIMEOUT_API)
|
||||||
@ -127,8 +134,19 @@ async def async_setup_entry(
|
|||||||
gateway.get_devices(), timeout=TIMEOUT_API
|
gateway.get_devices(), timeout=TIMEOUT_API
|
||||||
)
|
)
|
||||||
devices: list[Device] = await api(devices_commands, timeout=TIMEOUT_API)
|
devices: list[Device] = await api(devices_commands, timeout=TIMEOUT_API)
|
||||||
groups_commands: Command = await api(gateway.get_groups(), timeout=TIMEOUT_API)
|
|
||||||
groups: list[Group] = await api(groups_commands, timeout=TIMEOUT_API)
|
if entry.data[CONF_IMPORT_GROUPS]:
|
||||||
|
# Note: we should update this page when deprecating:
|
||||||
|
# https://www.home-assistant.io/integrations/tradfri/
|
||||||
|
_LOGGER.warning(
|
||||||
|
"Importing of Tradfri groups has been deprecated due to stability issues "
|
||||||
|
"and will be removed in Home Assistant core 2022.4"
|
||||||
|
)
|
||||||
|
# No need to load groups if the user hasn't requested it
|
||||||
|
groups_commands: Command = await api(
|
||||||
|
gateway.get_groups(), timeout=TIMEOUT_API
|
||||||
|
)
|
||||||
|
groups = await api(groups_commands, timeout=TIMEOUT_API)
|
||||||
|
|
||||||
except PytradfriError as exc:
|
except PytradfriError as exc:
|
||||||
await factory.shutdown()
|
await factory.shutdown()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user