'Initialize the RPi binary sensor.'

def __init__(self, name, port, pull_mode, bouncetime, invert_logic):

    self._name = (name or DEVICE_DEFAULT_NAME)
    self._port = port
    self._pull_mode = pull_mode
    self._bouncetime = bouncetime
    self._invert_logic = invert_logic
    self._state = None
    rpi_gpio.setup_input(self._port, self._pull_mode)
    def read_gpio(port):
        'Read    state    from    GPIO.'
        self._state = rpi_gpio.read_input(self._port)
        self.schedule_update_ha_state()
    rpi_gpio.edge_detect(self._port, read_gpio, self._bouncetime)
