Migrate cover platform to entity descriptions in Overkiz#141330
Conversation
7207777 to
f8fcff4
Compare
f8fcff4 to
9debd7e
Compare
|
Hi @iMicknl, |
|
@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). |
|
@iMicknl It does work when setting the value to the 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): This is the device I am using: |
|
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. |
|
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. |
|
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). |
|
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. |
…losed_state attribute
…djust current_tilt_position in snapshots
… snapshots for current_position values
There was a problem hiding this comment.
Are the changes in the snapshot expected?
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
I think you could even make this a for loop
There was a problem hiding this comment.
Let me check. The challenge here is that some if statements are nested (mainly the stop commands).
There was a problem hiding this comment.
# (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 |= featureI 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.
There was a problem hiding this comment.
Oh the nested part didn't occur to me, then the old situation is likely better


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
Additional information
rts:ExteriorVenetianBlindRTSComponent) in Overkiz #106708, fixes Somfy Smoove Uno A/M io reporting wrong status and not controllable in Overkiz #134407Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.To help with the load of incoming pull requests: