Skip to content

Add Zimi Cloud Connect Integration #129876

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

Merged
merged 263 commits into from
May 4, 2025
Merged

Add Zimi Cloud Connect Integration #129876

merged 263 commits into from
May 4, 2025

Conversation

mhannon11
Copy link
Contributor

@mhannon11 mhannon11 commented Nov 5, 2024

Proposed change

Add support for the Zimi Cloud Connect and Zimi lights in Home Assistant. This is a follow up on an old pull request here: #106449. This pull request answers a list of feedback from @emontnemery and requested changes based from that pull request, in summary those changes are:

  • Adding support for a single entity (lights) to create as small a PR as possible
  • Adding full test coverage for the config_flow
  • Adding async_unload_entry to the init.py
  • Using the ZCC MAC address for registering unique entry ids
  • Series of smaller changes

Note: This is the first of hopefully a few sequential pull requests. Further pull requests will deliver support for other Zimi devices.

Dependencies:

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

  • [ X] The code change is tested and works locally.
  • [ X] Local tests pass. Your PR cannot be merged unless tests pass
  • [ X] There is no commented out code in this PR.
  • [X ] I have followed the development checklist
  • [ X] I have followed the perfect PR recommendations
  • [ X] The code has been formatted using Ruff (ruff format homeassistant tests)
  • [ X] 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:

  • [X ] The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • [ X] New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • [X ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Member

@zweckj zweckj left a comment

Choose a reason for hiding this comment

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

some first feedback

markhannon and others added 7 commits November 7, 2024 00:52
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
Co-authored-by: Josef Zweck <24647999+zweckj@users.noreply.github.com>
@markhannon
Copy link
Contributor

Hi @zweckj
Thanks for your review - we have responded / updated to each item except for one that we are unsure of. Can you have another looks please?

@frenck
Copy link
Member

frenck commented Nov 8, 2024

I've marked this PR a draft, as changes are requested that need to be processed.
Please un-draft it once it is ready for review again by clicking the "Ready for review" button.

Thanks! 👍

../Frenck

Learn more about our pull request process.

@frenck frenck marked this pull request as draft November 8, 2024 22:08
@markhannon
Copy link
Contributor

Fixed a couple of ruff and mypi errors in latest commit

@markhannon
Copy link
Contributor

@zweckj Hi Josef, lots of cleanup since you last reviewed, can you review again please?

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

@MartinHjelmare
Copy link
Member

Are we ready to merge? If so, please press the Ready for review button.

devices: done
entity-category: todo
entity-disabled-by-default: todo
discovery:
Copy link
Member

Choose a reason for hiding this comment

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

We can’t automatically connect it, but can we not at least discover it to show it’s supported? (Might be that we already discussed this, it’s been a while 😅)

@mhannon11 mhannon11 marked this pull request as ready for review May 3, 2025 12:07
@home-assistant home-assistant bot requested a review from zweckj May 3, 2025 12:07
@markhannon
Copy link
Contributor

I saw in the last workflow run a couple of failures. The first one is this one:
image

What should I do here? Is this the setup tools that is pulled in by zcc-helper?

@markhannon
Copy link
Contributor

markhannon commented May 4, 2025

The second error in the workflow is from a code coverage run. I thought I only need test cases for the config_flow?

This seems to say I need test cases for all files in the PR??

image

https://app.codecov.io/gh/home-assistant/core/pull/129876

@zweckj zweckj dismissed joostlek’s stale review May 4, 2025 13:56

Addressed

@zweckj zweckj merged commit 0953181 into home-assistant:dev May 4, 2025
43 of 44 checks passed
@zweckj
Copy link
Member

zweckj commented May 4, 2025

Thanks - test failures were unrelated 👍 Please share your Discord users (or message me on Discord), so we can add you to the relevant channels.

@markhannon
Copy link
Contributor

Thanks - test failures were unrelated 👍 Please share your Discord users (or message me on Discord), so we can add you to the relevant channels.

I am markhannon on Discord

Copy link
Member

@joostlek joostlek left a comment

Choose a reason for hiding this comment

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

Please address the issues in a separate PR

config_entry_id=entry.entry_id,
identifiers={(DOMAIN, api.mac)},
manufacturer=api.brand,
name=f"{api.network_name}",
Copy link
Member

Choose a reason for hiding this comment

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

Why is this in an f string? if its typed str | None rather use assert, if its something else use str()

]

lights.extend(
[ZimiDimmer(device, api) for device in api.lights if device.type == "dimmer"]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[ZimiDimmer(device, api) for device in api.lights if device.type == "dimmer"]
ZimiDimmer(device, api) for device in api.lights if device.type == "dimmer"

Comment on lines +84 to +85
if self._device.type != "dimmer":
raise ValueError("ZimiDimmer needs a dimmable light")
Copy link
Member

Choose a reason for hiding this comment

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

We should not raise exceptions in a constructor

Comment on lines +15 to +18
dependency-transparency:
status: done
comment: |
https://mark_hannon@bitbucket.org/mark_hannon/zcc.git
Copy link
Member

Choose a reason for hiding this comment

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

I don't see an automated action to build and publish the dependency

Comment on lines +65 to +71
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == {
"host": INPUT_HOST,
"port": INPUT_PORT,
"mac": format_mac(INPUT_MAC),
}

Copy link
Member

Choose a reason for hiding this comment

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

We should also assert the unique id

@markhannon markhannon mentioned this pull request May 5, 2025
18 tasks
@markhannon
Copy link
Contributor

homeassistant/components/zimi/init.py

Thanks - I will gather cleanup feedback and action in #144293

@github-actions github-actions bot locked and limited conversation to collaborators May 6, 2025
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.

7 participants