Drop __eq__ dunder method from Entity (#90585)

pull/90592/head
Erik Montnemery 2023-03-31 17:03:02 +02:00 committed by GitHub
parent 469321157d
commit 149e610bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 19 deletions

View File

@ -945,25 +945,6 @@ class Entity(ABC):
self.entity_id = self.registry_entry.entity_id self.entity_id = self.registry_entry.entity_id
await self.platform.async_add_entities([self]) await self.platform.async_add_entities([self])
def __eq__(self, other: Any) -> bool:
"""Return the comparison."""
if not isinstance(other, self.__class__):
return False
# Can only decide equality if both have a unique id
if self.unique_id is None or other.unique_id is None:
return False
# Ensure they belong to the same platform
if self.platform is not None or other.platform is not None:
if self.platform is None or other.platform is None:
return False
if self.platform.platform != other.platform.platform:
return False
return self.unique_id == other.unique_id
def __repr__(self) -> str: def __repr__(self) -> str:
"""Return the representation.""" """Return the representation."""
return f"<entity {self.entity_id}={self._stringify_state(self.available)}>" return f"<entity {self.entity_id}={self._stringify_state(self.available)}>"