Skip to content

Migrate cover platform to entity descriptions in Overkiz#141330

Merged
joostlek merged 55 commits into
home-assistant:devfrom
iMicknl:overkiz/cover_entity_description
Apr 23, 2026
Merged

Migrate cover platform to entity descriptions in Overkiz#141330
joostlek merged 55 commits into
home-assistant:devfrom
iMicknl:overkiz/cover_entity_description

Conversation

@iMicknl
Copy link
Copy Markdown
Member

@iMicknl iMicknl commented Mar 24, 2025

Proposed change

Rewrite the current Overkiz platform to leverage entity descriptions. This will remove the additional classes and make it easier to support new covers and add exceptions.

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 Ruff (ruff format 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:

@everharder
Copy link
Copy Markdown

Hi @iMicknl,
I'm dying to get the tilt functionality for the integration.
I would love if you could merge this soon!
Thank you for your work.

@iMicknl
Copy link
Copy Markdown
Member Author

iMicknl commented May 26, 2025

@everharder have you tried this PR and does it work for you? What is your device? (Hardware name and model name in Home Assistant).

Don't expect this PR anytime soon, as it is not ready yet, and will require a lot of testing. Currently I don't have time the coming month(s).

@everharder
Copy link
Copy Markdown

@iMicknl It does work when setting the value to the cover entity via this control.

image

But, I can't add this to the dashboard. I can only add this (but it might be my fault, I'm very new to HA):

image

This is the device I am using:

PositionableExteriorVenetianBlind
by Somfy
Connected via [TaHoma Switch](http://localhost:8123/config/devices/device/abda62fad4b33e3b054144174b156510)
Firmware: 5162904A04
Hardware: io:ExteriorVenetianBlindIOComponent

@iMicknl
Copy link
Copy Markdown
Member Author

iMicknl commented May 27, 2025

Ok great! Your dashboard is another discussion (and having this PR merged won't change a thing. Best to seek support at the community forum or Discord.

Hint in the right direction; you should edit the card and enable the tilt controls there.

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes.
Thank you for your contribution!

@github-actions github-actions Bot added the stale label Jul 26, 2025
@github-actions github-actions Bot closed this Aug 2, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 3, 2025
@iMicknl iMicknl reopened this Aug 5, 2025
@home-assistant home-assistant unlocked this conversation Oct 15, 2025
@github-actions github-actions Bot removed the stale label Oct 15, 2025
@MarijnS95
Copy link
Copy Markdown

No regressions are noticed with this PR after following up on the testing request in #96665 (comment). The various inversions that I reported in #123810 and started testing this for still seem to be present and may be outside of Overkiz' control?

I've summarized them in home-assistant/frontend#25481 (comment).

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes.
Thank you for your contribution!

Copilot AI review requested due to automatic review settings April 21, 2026 07:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread homeassistant/components/overkiz/cover.py Outdated
Comment thread homeassistant/components/overkiz/cover.py
Comment thread homeassistant/components/overkiz/cover.py
@iMicknl iMicknl marked this pull request as ready for review April 21, 2026 08:38
Copilot AI review requested due to automatic review settings April 21, 2026 08:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread homeassistant/components/overkiz/cover.py Outdated
Comment thread homeassistant/components/overkiz/cover.py
Copilot AI review requested due to automatic review settings April 21, 2026 09:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread homeassistant/components/overkiz/cover.py
Comment thread homeassistant/components/overkiz/cover.py Outdated
Copilot AI review requested due to automatic review settings April 21, 2026 11:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread tests/components/overkiz/test_cover.py
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.

Are the changes in the snapshot expected?

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.

Yes!

  • DualRollerShutter now has upper and lower closure implemented (hence moving supported features value 15 -> 255) and adding tilt_position field
  • The values of -8 and -24 is an API bug, which we now handle in our integration and map to the right value.

Comment on lines +345 to +386
if self.entity_description.open_command and self.executor.has_command(
self.entity_description.open_command
):
supported_features |= CoverEntityFeature.OPEN

if self.entity_description.stop_command and self.executor.has_command(
self.entity_description.stop_command
):
supported_features |= CoverEntityFeature.STOP

if self.entity_description.close_command and self.executor.has_command(
self.entity_description.close_command
):
supported_features |= CoverEntityFeature.CLOSE

if self.entity_description.open_tilt_command and self.executor.has_command(
self.entity_description.open_tilt_command
):
supported_features |= CoverEntityFeature.OPEN_TILT

if self.entity_description.stop_tilt_command and self.executor.has_command(
self.entity_description.stop_tilt_command
):
supported_features |= CoverEntityFeature.STOP_TILT

if self.entity_description.close_tilt_command and self.executor.has_command(
self.entity_description.close_tilt_command
):
supported_features |= CoverEntityFeature.CLOSE_TILT

if (
self.entity_description.set_tilt_position_command
and self.executor.has_command(
self.entity_description.set_tilt_position_command
)
):
supported_features |= CoverEntityFeature.SET_TILT_POSITION

if self.entity_description.set_position_command and self.executor.has_command(
self.entity_description.set_position_command
):
supported_features |= CoverEntityFeature.SET_POSITION
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 think you could even make this a for loop

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.

Let me check. The challenge here is that some if statements are nested (mainly the stop commands).

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.

# (entity description attribute, feature flag, required feature or None)
_COMMAND_TO_FEATURE: list[tuple[str, CoverEntityFeature, CoverEntityFeature | None]] = [
      ("open_command", CoverEntityFeature.OPEN, None),
      ("stop_command", CoverEntityFeature.STOP, CoverEntityFeature.OPEN),
      ("close_command", CoverEntityFeature.CLOSE, None),
      ("open_tilt_command", CoverEntityFeature.OPEN_TILT, None),
      ("stop_tilt_command", CoverEntityFeature.STOP_TILT, CoverEntityFeature.OPEN_TILT),
      ("close_tilt_command", CoverEntityFeature.CLOSE_TILT, None),
      ("set_tilt_position_command", CoverEntityFeature.SET_TILT_POSITION, None),
      ("set_position_command", CoverEntityFeature.SET_POSITION, None),
  ]

  supported_features = CoverEntityFeature(0)

  for attr, feature, requires in _COMMAND_TO_FEATURE:
      if (command := getattr(self.entity_description, attr)) and self.executor.has_command(command):
          if requires is None or requires in supported_features:
              supported_features |= feature

I am not sure if I prefer a loop here, what do you think @joostlek. This makes it less readable in my opinion, but happy to change it to the loop if this is what you prefer.

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.

Oh the nested part didn't occur to me, then the old situation is likely better

@joostlek joostlek merged commit 13105bd into home-assistant:dev Apr 23, 2026
33 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.