def on_status_update(self, channel, callback): """ Callback to execute on status of update of channel """ self._callbacks.append(callback) def get_categories(self, channel): return ['sensor'] def get_state(self, channel): """ Ignore channel """ return self._cur def get_class(self, channel): """ Ignore channel """ return 'temperature' def get_unit(self, channel): """ Ignore channel """ return '°C' velbus.register_module('VMBIRO', VMBIROModule)
def on_status_update(self, channel, callback): """ Callback to execute on status of update of channel """ self._callbacks.append(callback) def get_categories(self, channel): return ['sensor'] def get_state(self, channel): """ Ignore channel """ return self._cur def get_class(self, channel): """ Ignore channel """ return 'temperature' def get_unit(self, channel): """ Ignore channel """ return '°C' velbus.register_module('VMBMETEO', VMBMETEOModule)
""" if callback is None: def callb(): """No-op""" pass callback = callb message = velbus.SwitchRelayOffMessage(self._address) message.relay_channels = [channel] self._controller.send(message, callback) def _on_message(self, message): if isinstance(message, velbus.RelayStatusMessage): self._is_on[message.channel] = message.is_on() if message.channel in self._callbacks: for callback in self._callbacks[message.channel]: callback(message.is_on()) def on_status_update(self, channel, callback): """ Callback to execute on status of update of channel """ if not channel in self._callbacks: self._callbacks[channel] = [] self._callbacks[channel].append(callback) velbus.register_module('VMB4RYLD', VMB4RYModule) velbus.register_module('VMB4RYNO', VMB4RYModule)
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_status_update(self, channel, callback): """ Callback to execute on status of update of channel """ if not channel in self._callbacks: self._callbacks[channel] = [] self._callbacks[channel].append(callback) class VMB7INModule(VMB6INModule): """ Velbus input module with 7 channels """ def number_of_channels(self): return 8 velbus.register_module('VMB7IN', VMB7INModule) velbus.register_module('VMB6IN', VMB6INModule)
if channel in message.enabled: self._is_enabled[channel] = True else: self._is_enabled[channel] = False def on_status_update(self, channel, callback): """ Callback to execute on status of update of channel """ if not channel in self._callbacks: self._callbacks[channel] = [] self._callbacks[channel].append(callback) def get_categories(self, channel): if channel in self._is_enabled and self._is_enabled[channel]: return ['binary_sensor'] else: return [] class VMB6PBNModule(VMB2PBNModule): """ Velbus input module with 7 channels """ def number_of_channels(self): return 6 velbus.register_module('VMB2PBN', VMB2PBNModule) velbus.register_module('VMB6PBN', VMB6PBNModule)
def on_status_update(self, channel, callback): """ Callback to execute on status of update of channel """ self._callbacks.append(callback) def get_categories(self, channel): return ['sensor'] def get_state(self, channel): """ Ignore channel """ return self._cur def get_class(self, channel): """ Ignore channel """ return 'temperature' def get_unit(self, channel): """ Ignore channel """ return '°C' velbus.register_module('VMB1TS', VMB1TSModule)
""" Callback to execute on status of update of channel """ if not channel in self._callbacks: self._callbacks[channel] = [] self._callbacks[channel].append(callback) def get_categories(self, channel): return ['binary_sensor'] class VMB2BLModule(VMB1BLModule): """ Velbus input module with 7 channels """ def number_of_channels(self): return 2 class VMB1BLEModule(velbus.Module): def number_of_channels(self): return 1 class VMB2BLEModule(velbus.Module): def number_of_channels(self): return 2 velbus.register_module('VMB1BL', VMB1BLModule) velbus.register_module('VMB2BL', VMB2BLModule) velbus.register_module('VMB1BLE', VMB1BLEModule) velbus.register_module('VMB2BLE', VMB2BLEModule)
elif isinstance(message, velbus.ModuleStatusMessage2): 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 if channel in message.enabled: self._is_enabled[channel] = True else: self._is_enabled[channel] = False def on_status_update(self, channel, callback): """ Callback to execute on status of update of channel """ if not channel in self._callbacks: self._callbacks[channel] = [] self._callbacks[channel].append(callback) def get_categories(self, channel): if channel in self._is_enabled and self._is_enabled[channel]: return ['binary_sensor'] else: return [] velbus.register_module('VMBGP1', VMBGPxModule) velbus.register_module('VMBGP2', VMBGPxModule) velbus.register_module('VMBGP4', VMBGPxModule) velbus.register_module('VMBGP0', VMBGPxModule) velbus.register_module('VMBGPOD', VMBGPxModule)