def __init__(self, port, name, invert_logic): """Initialize the pin.""" self._port = port self._name = name or DEVICE_DEFAULT_NAME self._invert_logic = invert_logic self._state = False rpi_pfio.write_output(self._port, 1 if self._invert_logic else 0)
def turn_off(self): """Turn the device off.""" rpi_pfio.write_output(self._port, 1 if self._invert_logic else 0) self._state = False self.schedule_update_ha_state()
def turn_on(self): """Turn the device on.""" rpi_pfio.write_output(self._port, 0 if self._invert_logic else 1) self._state = True self.schedule_update_ha_state()
def turn_off(self, **kwargs): """Turn the device off.""" rpi_pfio.write_output(self._port, 1 if self._invert_logic else 0) self._state = False self.schedule_update_ha_state()
def turn_on(self, **kwargs): """Turn the device on.""" rpi_pfio.write_output(self._port, 0 if self._invert_logic else 1) self._state = True self.schedule_update_ha_state()