def _on_message(self, message):
    if isinstance(message, velbus.PushButtonStatusMessage):
        for channel in message.closed:
            self._is_closed[channel] = True
        for channel in message.opened:
            self._is_closed[channel] = False
        for channel in message.get_channels():
            if (channel in self._callbacks):
                for callback in self._callbacks[channel]:
                    callback(self._is_closed[channel])
    elif isinstance(message, velbus.ModuleStatusMessage):
        for channel in list(range(1, (self.number_of_channels() + 1))):
            if (channel in message.closed):
                self._is_closed[channel] = True
            else:
                self._is_closed[channel] = False
def _on_message(self, message):
    if isinstance(message, velbus.PushButtonStatusMessage):
        for channel in message.closed:
            self._is_closed[channel] = True
        for channel in message.opened:
            self._is_closed[channel] = False
        for channel in message.get_channels():
            if (channel in self._callbacks):
                for callback in self._callbacks[channel]:
                    callback(self._is_closed[channel])
    elif isinstance(message, velbus.ModuleStatusMessage):
        for channel in list(range(1, (self.number_of_channels() + 1))):
            if (channel in message.closed):
                self._is_closed[channel] = True
            else:
                self._is_closed[channel] = False