Skip to content

Deprecate knx config_file#46874

Merged
pvizeli merged 7 commits into
home-assistant:devfrom
farmio:deprecate-config_file
Mar 1, 2021
Merged

Deprecate knx config_file#46874
pvizeli merged 7 commits into
home-assistant:devfrom
farmio:deprecate-config_file

Conversation

@farmio
Copy link
Copy Markdown
Member

@farmio farmio commented Feb 21, 2021

Breaking change

xknx.yaml config_file is deprecated.

With this PR only a deprecation message and a warning in the logs is displayed. The config_file will continue to work as before until it is removed.

Proposed change

The KNX integration currently supports 2 configuration Schemes

Having 2 different configuration Schemes is a constant source for issues and bugs.

We want to deprecate the XKNX-Schema and only support HA-Schema in the future.
To help users with the schema transition we set up an online config-converter at https://xknx.io/config-converter/ where users can paste their XKNX-Schema and get a HA-Schema to copy to configuration.yaml .

This will allow us to take complexity out of the HA-integration and xknx at the same time. Maintainability and building new features will also be easier.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link
Copy Markdown

Hey there @Julius2342, @marvin-w, mind taking a look at this pull request as its been labeled with an integration (knx) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

{
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.

Copy link
Copy Markdown
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

Please see comment above

Comment thread homeassistant/components/knx/__init__.py Outdated
Comment thread homeassistant/components/knx/__init__.py Outdated
Comment thread homeassistant/components/knx/__init__.py Outdated
@bdraco bdraco added the second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. label Feb 22, 2021
@bdraco
Copy link
Copy Markdown
Member

bdraco commented Feb 22, 2021

second opinion request is for #46874 (comment)

@elupus
Copy link
Copy Markdown
Contributor

elupus commented Feb 22, 2021

In general +1 from me.

@MartinHjelmare MartinHjelmare changed the title KNX: deprecate config_file Deprecate knx config_file Feb 22, 2021
Comment thread homeassistant/components/knx/__init__.py Outdated
Co-authored-by: Philip Allgaier <philip.allgaier@gmx.de>
Comment thread homeassistant/components/knx/__init__.py Outdated
# deprecation warning since 2021.3
if CONF_KNX_CONFIG in config[DOMAIN]:
_LOGGER.warning(
"The 'config_file' option will soon be deprecated. Please replace it with Home Assistant config schema "
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.

It is deprecated (see code above).

Suggested change
"The 'config_file' option will soon be deprecated. Please replace it with Home Assistant config schema "
"The 'config_file' option is deprecated. Please replace it with Home Assistant config schema "

Please note, that having both a cv.deprecated and a custom message, will now cause the user to have duplicate warnings (with different messages).

Is that intentional?

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 can remove cv.deprecated again if you like.

Would it be welcome if I changed cv.deprecated to accept custom messages in general?

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 can remove cv.deprecated again if you like.

I think it's better to choose one or the other. I don't think we should mailbomb a user with duplicate messages from a user experience perspective. However, I don't know if it was intentional or not, hence my question. So 🤷

Would it be welcome if I changed cv.deprecated to accept custom messages in general?

We didn't have had much need for it in general. As most are just removed after it has been automatically migrated or imported into the UI. KNX is a special case, so let's not add that for now.

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.

Well, this could be the first step to migrate knx to config_flow...
Thanks for review!

farmio and others added 2 commits February 24, 2021 00:36
@bdraco bdraco removed the second-opinion-wanted Add this label when a reviewer needs a second opinion from another member. label Feb 24, 2021
@pvizeli pvizeli merged commit dadc99d into home-assistant:dev Mar 1, 2021
@farmio
Copy link
Copy Markdown
Member Author

farmio commented Mar 1, 2021

Hi! Will this be included in 2021.3 or 2021.4?

@frenck
Copy link
Copy Markdown
Member

frenck commented Mar 1, 2021

This PR should not have been merged, that was an unresolved comment open:

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

#46874 (comment)

@farmio Please address that comment in a separate PR, so we can avoid reverting this one. Thanks 👍

@farmio
Copy link
Copy Markdown
Member Author

farmio commented Mar 1, 2021

¯_(ツ)_/¯
I'll try to do a PR tonight reverting it.

@farmio farmio mentioned this pull request Mar 1, 2021
21 tasks
@farmio
Copy link
Copy Markdown
Member Author

farmio commented Mar 1, 2021

#47238

@github-actions github-actions Bot locked and limited conversation to collaborators Mar 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants