From 668e8e78b1adad00fd1bb0be6e5e9ca6d2b164ce Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Tue, 21 Jan 2025 05:03:39 +0100 Subject: [PATCH] Removed default implementation for "on" property --- src/core/entity.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/core/entity.py b/src/core/entity.py index 469da09..3565917 100644 --- a/src/core/entity.py +++ b/src/core/entity.py @@ -22,7 +22,6 @@ class Entity: self._room = room self._device_type = device_type.strip().lower() self._groups = set(groups) - self.__is_on__: bool | None = None @property def id(self) -> str: @@ -52,20 +51,13 @@ class Entity: """Implements an entity specific update operation to get the latest state.""" raise EntityOpNotSupportedError("update") - async def toggle_state(self): - """Turns entity on, if off, and vice versa, if supported.""" - if self.__is_on__ == False: # Neither True nor None - await self.turn_on() - else: - await self.turn_off() - async def turn_on(self): """Turns entity on, if action supported.""" - self.__is_on__ = True # TODO: What if action unsuccessful? + raise EntityOpNotSupportedError("turn_on") async def turn_off(self): """Turns entity on, if action supported.""" - self.__is_on__ = False # TODO: What if action unsuccessful? + raise EntityOpNotSupportedError("turn_off") async def set_brightness(self, brightness: float): """Does not turn an entity on if brightness > 0 and entity turned off."""