INNER CODE UNIT · Python
_get_state
theyosh/TerrariumPI · hardware/button/__init__.py:98
def _get_state(self):
if isinstance(self._device["device"], terrariumIOExpander):
# IO Expander in use
state = self._device["device"].state
if state is None:
# Device in error...
return None
else:
return self.PRESSED if state else self.RELEASED
else:
return self.PRESSED if not self._device["device"].is_pressed else self.RELEASED
def load_hardware(self) -> None:
address = self._address
if terrariumUtils.is_valid_url(self.address):
# Remote button