Removed default implementation for "on" property
This commit is contained in:
parent
c3ec52005e
commit
668e8e78b1
1 changed files with 2 additions and 10 deletions
|
@ -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."""
|
||||
|
|
Loading…
Reference in a new issue