INNER CODE UNIT · Python
__repr__
theyosh/TerrariumPI · hardware/button/__init__.py:78
def __repr__(self) -> str:
"""
Returns readable button name
Returns:
string: Button type and name with address
"""
return f"{self.NAME} named '{self.name}' at address '{self.address}'"
def _run(self) -> None:
self._checker["running"] = 1
while self._checker["running"]:
new_state = self._get_state()
if new_state != self._device["state"]:
self._device["state"] = new_state
if self.callback is not None:
self.callback(self.id, self.state)