예제 #1
0
        self._controller.send(message, callback)

    def _on_message(self, message):
        if isinstance(message, DimmerStatusMessage):
            self._dimmer_state[message.channel] = message.cur_dimmer_state()
            if message.channel in self._callbacks:
                for callback in self._callbacks[message.channel]:
                    callback(message.cur_dimmer_state())
        if isinstance(message, SliderStatusMessage):
            self._dimmer_state[message.channel] = message.cur_slider_state()
            if message.channel in self._callbacks:
                for callback in self._callbacks[message.channel]:
                    callback(message.cur_slider_state())

    def on_status_update(self, channel, callback):
        """
        Callback to execute on status of update of channel
        """
        if channel not in self._callbacks:
            self._callbacks[channel] = []
        self._callbacks[channel].append(callback)

    def get_categories(self, channel):
        return ["light"]

    def light_is_buttonled(self, channel):
        return False


register_module("VMBDME", VMBDMEModule)
예제 #2
0
    """
    def number_of_channels(self):
        return 8


class VMB8PBModule(VMB2PBNModule):
    """
    Velbus input module with 8 channels
    """
    def number_of_channels(self):
        return 8


class VMB8PBModule(VMB2PBNModule):
    """
    Velbus input module with 8 channels
    """
    def __init__(self, module_type, module_name, module_address, controller):
        super().__init__(module_type, module_name, module_address, controller)
        for channel in list(range(1, self.number_of_channels() + 1)):
            self._is_enabled[channel] = True

    def number_of_channels(self):
        return 8


register_module("VMB2PBN", VMB2PBNModule)
register_module("VMB6PBN", VMB6PBNModule)
register_module("VMB8PBU", VMB8PBUModule)
register_module("VMB8PB", VMB8PBModule)
예제 #3
0
    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"


register_module("VMBMETEO", VMBMETEOModule)
예제 #4
0
    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"


register_module("VMBIRO", VMBIROModule)
예제 #5
0
    def number_of_channels(self):
        return 4

    def _on_message(self, message):
        if isinstance(message, RelayStatusMessage):
            self._is_on[message.channel] = message.channel_is_on()
            if message.channel in self._callbacks:
                for callback in self._callbacks[message.channel]:
                    callback(message.channel_is_on())


class VMB1RY(VMB4RYModule):
    def number_of_channels(self):
        return 1

    def _on_message(self, message):
        if isinstance(message, RelayStatusMessage):
            self._is_on[message.channel] = message.channel_is_on()
            if message.channel in self._callbacks:
                for callback in self._callbacks[message.channel]:
                    callback(message.channel_is_on())


register_module("VMB4RYLD", VMB4RYModule)
register_module("VMB4RYNO", VMB4RYModule)
register_module("VMB1RYNO", VMB4RYModule)
register_module("VMB1RYNOS", VMB4RYModule)
register_module("VMB1RY", VMB1RY)
register_module("VMB4RY", VMB4RY)
register_module("VMB1RYS", VMB1RY)
예제 #6
0
        message = CoverUpMessage(self._address)
        message.channel = channel
        self._controller.send(message)

    def close(self, channel):
        message = CoverDownMessage(self._address)
        message.channel = channel
        self._controller.send(message)

    def stop(self, channel):
        message = CoverOffMessage(self._address)
        message.channel = channel
        self._controller.send(message)

    def set(self, channel, position):
        message = CoverPosMessage(self._address)
        message.channel = channel
        message.position = position
        self._controller.send(message)


class VMB2BLEModule(VMB1BLEModule):
    def number_of_channels(self):
        return 2


register_module("VMB1BL", VMB1BLModule)
register_module("VMB2BL", VMB2BLModule)
register_module("VMB1BLE", VMB1BLEModule)
register_module("VMB2BLE", VMB2BLEModule)
예제 #7
0
            channel not in self._delay
            or channel not in self._unit
            or self._delay[channel] == 0xFFFF
        ):
            return round(0, 2)
        if self._unit[channel] == VOLUME_LITERS_HOUR:
            val = (1000 * 3600) / (self._delay[channel] * self._pulses[channel])
        elif self._unit[channel] == VOLUME_CUBIC_METER_HOUR:
            val = (1000 * 3600) / (self._delay[channel] * self._pulses[channel])
        elif self._unit[channel] == ENERGY_WATT_HOUR:
            val = (1000 * 1000 * 3600) / (self._delay[channel] * self._pulses[channel])
        else:
            val = 0
        return round(val, 2)

    def get_class(self, channel):
        """
        Ignore channel
        """
        return "counter"

    def get_unit(self, channel):
        if channel in self._unit:
            return self._unit[channel]
        else:
            return None


register_module("VMB7IN", VMB7INModule)
register_module("VMB6IN", VMB6INModule)
예제 #8
0
        self._controller.send(message, callback)

    def _on_message(self, message):
        if isinstance(message, DimmerChannelStatusMessage):
            self._dimmer_state[message.channel] = message.cur_dimmer_state()
            if message.channel in self._callbacks:
                for callback in self._callbacks[message.channel]:
                    callback(message.cur_dimmer_state())
        if isinstance(message, SliderStatusMessage):
            self._dimmer_state[message.channel] = message.cur_slider_state()
            if message.channel in self._callbacks:
                for callback in self._callbacks[message.channel]:
                    callback(message.cur_slider_state())

    def on_status_update(self, channel, callback):
        """
        Callback to execute on status of update of channel
        """
        if channel not in self._callbacks:
            self._callbacks[channel] = []
        self._callbacks[channel].append(callback)

    def get_categories(self, channel):
        return ["light"]

    def light_is_buttonled(self, channel):
        return False


register_module("VMB4DC", VMB4DCModule)
예제 #9
0
    def _on_message(self, message):
        if isinstance(message, DimmerChannelStatusMessage):
            self._dimmer_state[message.channel] = message.cur_dimmer_state()
            if message.channel in self._callbacks:
                for callback in self._callbacks[message.channel]:
                    callback(message.cur_dimmer_state())
        if isinstance(message, SliderStatusMessage):
            self._dimmer_state[message.channel] = message.cur_slider_state()
            if message.channel in self._callbacks:
                for callback in self._callbacks[message.channel]:
                    callback(message.cur_slider_state())

    def on_status_update(self, channel, callback):
        """
        Callback to execute on status of update of channel
        """
        if channel not in self._callbacks:
            self._callbacks[channel] = []
        self._callbacks[channel].append(callback)

    def get_categories(self, channel):
        return ["light"]

    def light_is_buttonled(self, channel):
        return False


register_module("VMBDMI", VMBDMIModule)
register_module("VMBDMI-R", VMBDMIModule)
예제 #10
0
        # 6 = Motion
        # 7 = light dependant motion
        # 8 = absence
        # 9 = temperature
        return 9

    def get_categories(self, channel):
        if channel == 9:
            return ["sensor"]
        elif channel in self._is_enabled and self._is_enabled[channel]:
            return ["binary_sensor"]
        else:
            return []


register_module("VMBGP1", VMBGP124Module)
register_module("VMBGP1-2", VMBGP124Module)
register_module("VMBEL1", VMBGP124Module)
register_module("VMBGP2", VMBGP124Module)
register_module("VMBGP2-2", VMBGP124Module)
register_module("VMBEL2", VMBGP124Module)
register_module("VMBGP4", VMBGP124Module)
register_module("VMBGP4-2", VMBGP124Module)
register_module("VMBEL4", VMBGP124Module)
register_module("VMBGPO", VMBGPxModule)
register_module("SUB_VMBGPO", VMBGPxSubModule)
register_module("VMBELO", VMBGPxDModule)
register_module("SUB_VMBELO", VMBGPxSubModule)
register_module("VMBGPOD", VMBGPxDModule)
register_module("SUB_VMBGPOD", VMBGPxSubModule)
register_module("VMBGP4PIR", VMBGPPirModule)