mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Use identity checks for ESPHome Enums (#124334)
Enums are singletons and should use is to compare. The valve platform was updated but cover and lock were missed.
This commit is contained in:
parent
2533bde27a
commit
61ac4c7af7
@ -61,13 +61,13 @@ class EsphomeCover(EsphomeEntity[CoverInfo, CoverState], CoverEntity):
|
||||
@esphome_state_property
|
||||
def is_opening(self) -> bool:
|
||||
"""Return if the cover is opening or not."""
|
||||
return self._state.current_operation == CoverOperation.IS_OPENING
|
||||
return self._state.current_operation is CoverOperation.IS_OPENING
|
||||
|
||||
@property
|
||||
@esphome_state_property
|
||||
def is_closing(self) -> bool:
|
||||
"""Return if the cover is closing or not."""
|
||||
return self._state.current_operation == CoverOperation.IS_CLOSING
|
||||
return self._state.current_operation is CoverOperation.IS_CLOSING
|
||||
|
||||
@property
|
||||
@esphome_state_property
|
||||
|
@ -40,25 +40,25 @@ class EsphomeLock(EsphomeEntity[LockInfo, LockEntityState], LockEntity):
|
||||
@esphome_state_property
|
||||
def is_locked(self) -> bool | None:
|
||||
"""Return true if the lock is locked."""
|
||||
return self._state.state == LockState.LOCKED
|
||||
return self._state.state is LockState.LOCKED
|
||||
|
||||
@property
|
||||
@esphome_state_property
|
||||
def is_locking(self) -> bool | None:
|
||||
"""Return true if the lock is locking."""
|
||||
return self._state.state == LockState.LOCKING
|
||||
return self._state.state is LockState.LOCKING
|
||||
|
||||
@property
|
||||
@esphome_state_property
|
||||
def is_unlocking(self) -> bool | None:
|
||||
"""Return true if the lock is unlocking."""
|
||||
return self._state.state == LockState.UNLOCKING
|
||||
return self._state.state is LockState.UNLOCKING
|
||||
|
||||
@property
|
||||
@esphome_state_property
|
||||
def is_jammed(self) -> bool | None:
|
||||
"""Return true if the lock is jammed (incomplete locking)."""
|
||||
return self._state.state == LockState.JAMMED
|
||||
return self._state.state is LockState.JAMMED
|
||||
|
||||
@convert_api_error_ha_error
|
||||
async def async_lock(self, **kwargs: Any) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user