@@ -359,6 +359,7 @@ def _determine_state(
359359
360360 def _determine_cover_state (
361361 self ,
362+ * ,
362363 is_lift_update : bool = False ,
363364 is_tilt_update : bool = False ,
364365 refresh : bool = False ,
@@ -425,10 +426,9 @@ def _determine_cover_state(
425426 CoverState .CLOSING ,
426427 ) and self ._lift_state in (CoverState .CLOSED , CoverState .OPEN ):
427428 self ._state = self ._tilt_state
428- return
429-
430- # Pick lift state in preference over tilt
431- self ._state = self ._lift_state or self ._tilt_state
429+ else :
430+ self ._state = self ._lift_state or self ._tilt_state
431+ self .maybe_emit_state_changed_event ()
432432
433433 def _set_lift_transition_target (self , target : int ) -> None :
434434 """Set target position for the tilt transition."""
@@ -514,7 +514,6 @@ def _clear_lift_transition(self, determine_state: bool = False) -> None:
514514 if not determine_state :
515515 return
516516 self ._determine_cover_state (refresh = True )
517- self .maybe_emit_state_changed_event ()
518517
519518 def _clear_tilt_transition (self , determine_state : bool = False ) -> None :
520519 """Clear the tilt transition."""
@@ -528,7 +527,6 @@ def _clear_tilt_transition(self, determine_state: bool = False) -> None:
528527 if not determine_state :
529528 return
530529 self ._determine_cover_state (refresh = True )
531- self .maybe_emit_state_changed_event ()
532530
533531 def handle_cluster_handler_attribute_updated (
534532 self , event : ClusterAttributeUpdatedEvent
@@ -544,7 +542,6 @@ def handle_cluster_handler_attribute_updated(
544542 elif event .attribute_id == WCAttrs .current_position_tilt_percentage .id :
545543 self ._tilt_position_history .append (self .current_cover_tilt_position )
546544 self ._determine_cover_state (is_tilt_update = True )
547- self .maybe_emit_state_changed_event ()
548545
549546 def async_update_state (self , state ):
550547 """Handle state update from HA operations below."""
@@ -660,9 +657,7 @@ async def async_stop_cover(self, **kwargs: Any) -> None: # pylint: disable=unus
660657 raise ZHAException (f"Failed to stop cover: { res [1 ]} " )
661658 self ._clear_lift_transition ()
662659 self ._clear_tilt_transition ()
663-
664660 self ._determine_cover_state (refresh = True )
665- self .maybe_emit_state_changed_event ()
666661
667662 async def async_stop_cover_tilt (self , ** kwargs : Any ) -> None :
668663 """Stop the cover tilt.
0 commit comments