mash-server/src-new/mash/entities/entity.py

32 lines
790 B
Python

class Entity:
def __init__(
self, *, id: str, name: str, room: str, device_type: str, groups: list[str] = []
) -> None:
self._id = id
self._name = name
self._room = room
self._device_type = device_type
self._groups = set(groups)
@property
def id(self) -> str:
return self._id
@property
def name(self) -> str:
return self._name
@property
def room(self) -> str:
return self._room
@property
def device_type(self) -> str:
return self._device_type
@property
def groups(self) -> set[str]:
return self._groups
def __str__(self) -> str:
return f"{self.name} [{self.id}, type {self.device_type}, room {self.room}, in {len(self.groups)} groups]"