'Initialize sensor.'

def __init__(self, address, channel, name, invert_logic, device_class):

    self._address = address
    self._channel = channel
    self._name = (name or DEVICE_DEFAULT_NAME)
    self._invert_logic = invert_logic
    self._device_class = device_class
    self._state = self.I2C_HATS_MANAGER.read_di(self._address, self._channel)
    def online_callback():
        'Callback    fired    when    board    is    online.'
        self.schedule_update_ha_state()
    self.I2C_HATS_MANAGER.register_online_callback(self._address, self._channel, online_callback)
    def edge_callback(state):
        'Read    digital    input    state.'
        self._state = state
        self.schedule_update_ha_state()
    self.I2C_HATS_MANAGER.register_di_callback(self._address, self._channel, edge_callback)
