Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move yaml configuration to integration key for command_line #92824

Merged
merged 24 commits into from May 29, 2023

Conversation

gjohansson-ST
Copy link
Member

@gjohansson-ST gjohansson-ST commented May 8, 2023

Breaking change

Proposed change

Move yaml configuration to integration key for command_line

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)
  • Deprecation (breaking change to happen in the future)
  • 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
  • I have followed the perfect PR recommendations
  • 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.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@gjohansson-ST gjohansson-ST added the deprecation Indicates a breaking change to happen in the future label May 8, 2023
@gjohansson-ST gjohansson-ST marked this pull request as ready for review May 9, 2023 15:46
Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

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

I think this looks great @gjohansson-ST 👍

One comment though, I'm not sure the configuration format you propose here is preferred over a simple list as used by for example the template integration:

  - sensor:
      ... a sensor
  - binary_sensor:
      ... a binary sensor
  - sensor:
      ...  another sensor

covers = []
if discovery_info:
devices: dict[str, Any] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not keep using "devices" here, either call the dict "entities" or "covers"

@@ -1,7 +1,7 @@
{
"domain": "command_line",
"name": "Command Line",
"codeowners": [],
"codeowners": ["@gjohansson-ST"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

@emontnemery
Copy link
Contributor

@gjohansson-ST
Copy link
Member Author

One comment though, I'm not sure the configuration format you propose here is preferred over a simple list as used by for example the template integration:

  - sensor:
      ... a sensor
  - binary_sensor:
      ... a binary sensor
  - sensor:
      ...  another sensor

I wasn't sure but for cover and switch there was also this object_id used as fallback for name and entity_id (I think) therefore using this config format.
Personally I prefer the format you suggest which is also what has been done in many other places but it would remove certain functionality on this particular "migration".
Perhaps that's ok as we should have unique_id anyway so one can change the name etc. etc. anyhow?

@emontnemery
Copy link
Contributor

emontnemery commented May 23, 2023

I opened an architecture issue to discuss documenting a preferred YAML format for entities: home-assistant/architecture#906

@emontnemery
Copy link
Contributor

emontnemery commented May 23, 2023

for cover and switch there was also this object_id used as fallback for name and entity_id

Yes, but we don't need to be 100% compatible with the old format. It's also confusing because most of the platforms ignore the dictionary key, it's not used for either name fallback or as input for entity_id as I understand it?

@gjohansson-ST
Copy link
Member Author

for cover and switch there was also this object_id used as fallback for name and entity_id

Yes, but we don't need to be 100% compatible with the old format. It's also confusing because most of the platforms ignore the dictionary key, it's not used for either name fallback or as input for entity_id as I understand it?

Agree, I think maybe it came before unique_id was added and used so it doesn't make sense anymore. Will change.

@emontnemery
Copy link
Contributor

emontnemery commented May 23, 2023

I'm setting this PR to draft, please mark it as ready for review when you've updated the schema @gjohansson-ST 👍

@emontnemery emontnemery marked this pull request as draft May 23, 2023 17:17
@gjohansson-ST gjohansson-ST marked this pull request as ready for review May 24, 2023 20:53
@emontnemery emontnemery reopened this May 25, 2023
@home-assistant home-assistant bot marked this pull request as draft May 26, 2023 06:20
@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@gjohansson-ST gjohansson-ST marked this pull request as ready for review May 26, 2023 06:32
@home-assistant home-assistant bot marked this pull request as draft May 26, 2023 12:57
@gjohansson-ST gjohansson-ST marked this pull request as ready for review May 26, 2023 13:10
@home-assistant home-assistant bot requested a review from emontnemery May 26, 2023 13:10
@emontnemery emontnemery merged commit 46e7486 into home-assistant:dev May 29, 2023
24 checks passed
@gjohansson-ST gjohansson-ST deleted the cmd_line_int_yaml branch May 29, 2023 06:32
@github-actions github-actions bot locked and limited conversation to collaborators May 30, 2023
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.

None yet

3 participants