Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions homeassistant/components/knx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.All(
# deprecated since 2021.3
cv.deprecated(CONF_KNX_CONFIG, replacement_key=CONF_KNX_CONFIG),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'CONF_KNX_CONFIG' option is deprecated, please replace it with 'CONF_KNX_CONFIG'

This doesn't look right that the replacement_key is the same

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really break things, it will fire a warning from the cv.deprecated config validator for now.
If I don't specify a replacement_key the config validator removes the key from config and it can not be used further down. This would result in users loosing some configuration like HomeKit room assignment (afaik).

So for now I'd like to just point out the deprecation of this config and log a link to the config-converter. After a transition period is over (maybe in summer) well remove the replacement_key and the logic using the XKNX-Schema.

I was more worried about the link to an external resource (config-converter tool) being accepted.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be ok to also create a persistent_notification ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about an external link in a notification. I'll ask for a second opinion on that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is any help: xknx.io is also the only source for documentation of the deprecated XKNX-Schema - so users of this are probably familiar with this domain.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecated should not remove the key if you don't specify replacement. You have to explicitly remove it with a vol.Remove() if you want it removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we don't generally do notifications on deprecated. If we want to do that i think we should do that globally.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the deprecation config validator. It's a log normal log message and notification now. (Only when config_file is used).
Shall I remove the notification again? I think a log message can be quite invisible for users - and this change will probably render their whole installation useless (knx is usually a quite big installation). When it is deprecated there is no way to point to the converter website...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove the external domain in the notification. If this is useful, add it to the documentation that is already linked instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I'm not really sure users will be pleased and/or successful in finding that link in this 1,3k lines markdown document.

Comment thread
farmio marked this conversation as resolved.
Outdated
# deprecated since 2021.2
cv.deprecated(CONF_KNX_FIRE_EVENT),
cv.deprecated("fire_event_filter", replacement_key=CONF_KNX_EVENT_FILTER),
vol.Schema(
Expand Down Expand Up @@ -213,6 +216,14 @@ async def async_setup(hass, config):
"https://www.home-assistant.io/blog/2020/09/17/release-115/#breaking-changes"
)

if config[DOMAIN].get(CONF_KNX_CONFIG):
Comment thread
farmio marked this conversation as resolved.
Outdated
_LOGGER.warning(
"Deprecated configuration method `config_file: %s` used. Please move to Home Assistant config schema "
"https://www.home-assistant.io/integrations/knx/. A configuration converter tool is available at "
"https://xknx.io/config-converter/",
config[DOMAIN].get(CONF_KNX_CONFIG),
Comment thread
farmio marked this conversation as resolved.
Outdated
)

hass.services.async_register(
DOMAIN,
SERVICE_KNX_SEND,
Expand Down