Skip to content

Commit 4afffe1

Browse files
authored
Revert 'open' tilt state precedence for cover devices supporting lift & tilt (#428)
Revert change that reports a cover state of open if either lift or tilt axes are open This is an interim change to address issues with some cover 'relay' type devices which falsely report support for both lift and tilt. In reality these only support one axes or the other, with users using yaml overrides to restrict functionality in HA. Devices that genuinely support both movement axes will behave the same as they did prior to #376 A subsequent PR will be made to allow users to override the covering type in a way that allows the entity handler to be aware of the configuration, calculating the state accordingly.
1 parent 5936334 commit 4afffe1

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

tests/test_cover.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,13 @@ async def test_cover(
258258
| CoverEntityFeature.SET_TILT_POSITION
259259
)
260260

261-
# set lift to 100% (closed) and test that the state has changed from unavailable to open
262-
# the starting open tilt position overrides the closed lift state
261+
# set lift to 100% (closed) and test that the state has changed from unavailable to closed
263262
await send_attributes_report(
264263
zha_gateway, cluster, {WCAttrs.current_position_lift_percentage.id: 100}
265264
)
266-
assert entity.state["state"] == CoverState.OPEN
265+
assert entity.state["state"] == CoverState.CLOSED
267266

268-
# test that the state closes after tilting to 100% (closed)
267+
# test that the state remains after tilting to 100% (closed)
269268
await send_attributes_report(
270269
zha_gateway, cluster, {WCAttrs.current_position_tilt_percentage.id: 100}
271270
)
@@ -325,7 +324,7 @@ async def test_cover(
325324
await send_attributes_report(
326325
zha_gateway, cluster, {WCAttrs.current_position_tilt_percentage.id: 0}
327326
)
328-
assert entity.state["state"] == CoverState.OPEN
327+
assert entity.state["state"] == CoverState.CLOSED
329328

330329
await entity.async_close_cover_tilt()
331330
await zha_gateway.async_block_till_done()

zha/application/platforms/cover/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,8 @@ def _determine_cover_state(
420420
self.maybe_emit_state_changed_event()
421421
return
422422

423-
# An open or moving tilt state overrides a static lift state
423+
# A moving tilt state overrides a static lift state
424424
if self._tilt_state in (
425-
CoverState.OPEN,
426425
CoverState.OPENING,
427426
CoverState.CLOSING,
428427
) and self._lift_state in (CoverState.CLOSED, CoverState.OPEN):

0 commit comments

Comments
 (0)