-
Notifications
You must be signed in to change notification settings - Fork 431
Method Entity.exists doesn't work under an async method #2539
Copy link
Copy link
Open
Labels
issueSomething isn't workingSomething isn't working
Description
What happened?
Entity.exists() seems to always return True when called under an async def method. It would be great if it worked either (async or synchronous) way like ADAPI.entity_exists does.
Version
App version: 0.18.1
Installation type
Home Assistant add-on
Relevant log output
2026-02-16 14:31:16.360340 ERROR Error: AssertionError: Thinks it exists: entity delete_me_1f8b8f1a-431f-4d19-b732-cc88b5bd377aRelevant code in the app or config file that caused the issue
# test code created to show Entity.exists doesn't work under an async method
import uuid
from appdaemon import Hass
class ExistsDefect(Hass):
async def initialize(self) -> None:
entity_id = f"delete_me_{uuid.uuid4()}"
new_entity = self.get_entity(entity_id, check_existence=False)
assert await self.entity_exists(entity_id) is False, f"self.entity_exists says entity {entity_id} exists"
assert new_entity.exists() is False, f"Thinks it exists: entity {entity_id}"
self.log("All asserts passed")Anything else?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
issueSomething isn't workingSomething isn't working