INNER CODE UNIT · Python
__init__
theyosh/TerrariumPI · hardware/button/__init__.py:64
def __init__(self, button_id, _, address, name: str = "", callback=None) -> None:
"Create a new button based on type"
self._device = {"device": None, "id": None, "address": None, "name": None, "state": None}
self._checker = {"running": False, "thread": None}
self._inverse = False
self.id = button_id
self.name = name
self.callback = callback
# By setting the address, we will load the hardware.
self.address = address
def __repr__(self) -> str:
"""
Returns readable button name