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

Fix Comelit device info #100587

Merged
merged 6 commits into from
Sep 24, 2023
Merged

Conversation

chemelli74
Copy link
Contributor

@chemelli74 chemelli74 commented Sep 19, 2023

Breaking change

Proposed change

Fix Comelit device info in order to create a single device as Lights and covers are connected to the bridge via proprietary bus and all peripherals ( lights, covers, etc) can be controlled only via bridge and not directly.

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

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

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:

@chemelli74 chemelli74 added this to the 2023.9.3 milestone Sep 19, 2023
@MartinHjelmare MartinHjelmare changed the title fix Comelit device info Fix Comelit device info Sep 19, 2023
@home-assistant home-assistant bot marked this pull request as draft September 19, 2023 09:33
@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.

@MartinHjelmare
Copy link
Member

Please add more explanation in the PR description. What is this fixing?

homeassistant/components/comelit/coordinator.py Outdated Show resolved Hide resolved
homeassistant/components/comelit/coordinator.py Outdated Show resolved Hide resolved
@chemelli74
Copy link
Contributor Author

Please add more explanation in the PR description. What is this fixing?

Done, let me know if is clear enough.

@chemelli74 chemelli74 marked this pull request as ready for review September 19, 2023 22:17
@home-assistant home-assistant bot requested a review from joostlek September 19, 2023 22:17
@MartinHjelmare
Copy link
Member

Is this not a case of a device with multiple endpoints that is described in the last paragraph of the following section?

https://developers.home-assistant.io/docs/device_registry_index#what-is-a-device

@chemelli74
Copy link
Contributor Author

Is this not a case of a device with multiple endpoints that is described in the last paragraph of the following section?

https://developers.home-assistant.io/docs/device_registry_index#what-is-a-device

Seems so, but as the main device has no entities, how can I refer to it with via_device ?

@MartinHjelmare
Copy link
Member

It's possible to register a device directly with DeviceRegistry.async_get_or_create.

@callback
def async_get_or_create(
self,
*,
config_entry_id: str,
configuration_url: str | URL | None | UndefinedType = UNDEFINED,
connections: set[tuple[str, str]] | None | UndefinedType = UNDEFINED,
default_manufacturer: str | None | UndefinedType = UNDEFINED,
default_model: str | None | UndefinedType = UNDEFINED,
default_name: str | None | UndefinedType = UNDEFINED,
# To disable a device if it gets created
disabled_by: DeviceEntryDisabler | None | UndefinedType = UNDEFINED,
entry_type: DeviceEntryType | None | UndefinedType = UNDEFINED,
hw_version: str | None | UndefinedType = UNDEFINED,
identifiers: set[tuple[str, str]] | None | UndefinedType = UNDEFINED,
manufacturer: str | None | UndefinedType = UNDEFINED,
model: str | None | UndefinedType = UNDEFINED,
name: str | None | UndefinedType = UNDEFINED,
suggested_area: str | None | UndefinedType = UNDEFINED,
sw_version: str | None | UndefinedType = UNDEFINED,
via_device: tuple[str, str] | None | UndefinedType = UNDEFINED,
) -> DeviceEntry:
"""Get device. Create if it doesn't exist."""

@MartinHjelmare MartinHjelmare marked this pull request as draft September 22, 2023 07:41
@chemelli74 chemelli74 marked this pull request as ready for review September 22, 2023 10:43
@chemelli74 chemelli74 force-pushed the chemelli74-comelit-fix-id branch from bf4c556 to 137ef98 Compare September 23, 2023 09:41
@frenck frenck modified the milestones: 2023.9.3, 2023.9.4 Sep 23, 2023
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @chemelli74 👍

../Frenck

@frenck frenck modified the milestones: 2023.9.4, 2023.9.3 Sep 24, 2023
@frenck frenck merged commit b19a0fb into home-assistant:dev Sep 24, 2023
frenck pushed a commit that referenced this pull request Sep 24, 2023
@frenck frenck mentioned this pull request Sep 24, 2023
@chemelli74 chemelli74 deleted the chemelli74-comelit-fix-id branch September 24, 2023 13:15
@github-actions github-actions bot locked and limited conversation to collaborators Sep 25, 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.

5 participants