コード例 #1
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.channel = 0
     self.timeout = 0
     self.status = 0
     self.position = None
     self.set_defaults(address)
コード例 #2
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.module_type = 0x00
     self.current_serial = 0
     self.module_address = 0x00
     self.new_serial = 0
     self.set_defaults(address)
コード例 #3
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.closed = []
     self.led_on = []
     self.led_slow_blinking = []
     self.led_fast_blinking = []
     self.set_defaults(address)
コード例 #4
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.closed = []
     self.enabled = []
     self.normal = []
     self.locked = []
     self.programenabled = []
コード例 #5
0
ファイル: relay_status.py プロジェクト: Cereal2nd/velbus-aio
 def __init__(self, address=None):
     Message.__init__(self)
     self.channel = 0
     self.disable_inhibit_forced = 0
     self.status = 0
     self.led_status = 0
     self.delay_time = 0
     self.set_defaults(address)
コード例 #6
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.channel = 0
     self.pulses = 0
     self.counter = 0
     self.kwh = 0
     self.delay = 0
     self.watt = 0
コード例 #7
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.module_type = 0x00
     self.sub_address_1 = 0xFF
     self.sub_address_2 = 0xFF
     self.sub_address_3 = 0xFF
     self.sub_address_4 = 0xFF
     self.set_defaults(address)
     self.serial = 0
コード例 #8
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.set_defaults(address)
     self.pallet = 31
     self.rgb = False
     self.saturation = 0
     self.red = 0
     self.green = 0
     self.blue = 0
コード例 #9
0
ファイル: module_type.py プロジェクト: Cereal2nd/velbus-aio
 def __init__(self, address=None):
     Message.__init__(self)
     self.module_type = 0x00
     self.led_on = []
     self.led_slow_blinking = []
     self.led_fast_blinking = []
     self.serial = 0
     self.memory_map_version = 0
     self.build_year = 0
     self.build_week = 0
     self.set_defaults(address)
コード例 #10
0
 def __init__(self, address=None):
     Message.__init__(self)
     # in data[0]
     self.dark: bool = False  # bit 1
     self.light: bool = False  # bit 2
     self.motion1: bool = False  # bit 3
     self.light_motion1: bool = False  # bit 4
     self.motion2: bool = False  # bit 5
     self.light_motion2: bool = False  # bit 6
     self.low_temp_alarm: bool = False  # bit 7
     self.high_temp_alarm: bool = False  # bit 8
     # in data[1] and data[2]
     self.light_value: int = 0
コード例 #11
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.local_control = 0  # 0=unlocked, 1 =locked
     self.status_mode = 0  # 0=run, 1=manual, 2=sleep timer, 3=disable
     self.status_str = "run"
     self.auto_send = 0  # 0=disabled, 1=enabled
     self.mode = 0  # 0=safe, 1=night, 2=day, 4=comfort
     self.mode_str = "safe"
     self.cool = 0  # 0=cool, 1=heat
     self.heater = 0  # 0=pff, 1=on
     self.boost = 0  # 0=off, 1 = on
     self.pump = 0  # 0=on, 1=off
     self.cool = 0  # 0=off, 1=on
     self.alarm1 = 0  # 0=off, 1=on
     self.alarm2 = 0  # 0=off, 1=on
     self.alarm3 = 0  # 0=off, 1=on
     self.alarm4 = 0  # 0=off, 1=on
     self.current_temp = None  # current temp
     self.target_temp = None  # current temp
     self.sleep_timer = None  # current sleepTimer
コード例 #12
0
 async def send(self, msg: Message) -> None:
     """
     Send a packet
     """
     await self._protocol.send_message(
         RawMessage(
             priority=msg.priority,
             address=msg.address,
             rtr=msg.rtr,
             data=msg.data_to_binary(),
         )
     )
コード例 #13
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.high_address = 0x00
     self.low_address = 0x00
     self.data = bytes([])
     self.set_defaults(address)
コード例 #14
0
 def __init__(self, address=None, sleep=0):
     Message.__init__(self)
     self.sleep = sleep
     self.set_defaults(address)
コード例 #15
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.dimmer_channels = []
     self.dimmer_state = 0
     self.dimmer_transitiontime = 0
     self.set_defaults(address)
コード例 #16
0
ファイル: set_date.py プロジェクト: Cereal2nd/velbus-aio
 def __init__(self, address=0x00):
     Message.__init__(self)
     self._day = None
     self._mon = None
     self._year = None
     self.set_defaults(address)
コード例 #17
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.temp_type = 0x00
     self.temp = 0x00
     self.set_defaults(address)
コード例 #18
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.channels = []
     self.wait_after_send = 500
     self.set_defaults(address)
コード例 #19
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.channel = 0
     self.position = 0
     self.set_defaults(address)
コード例 #20
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.closed = []
     self.opened = []
     self.closed_long = []
     self.set_defaults(address)
コード例 #21
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.relay_channels = []
     self.set_defaults(address)
コード例 #22
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.cur = 0
     self.min = 0
     self.max = 0
コード例 #23
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.leds = []
     self.set_defaults(address)
コード例 #24
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.transmit_error_counter = 0
     self.receive_error_counter = 0
     self.bus_off_counter = 0
     self.set_defaults(address)
コード例 #25
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.rain = 0
     self.light = 0
     self.wind = 0
コード例 #26
0
 def __init__(self, address=0x00):
     Message.__init__(self)
     self._wday = None
     self._hour = None
     self._min = None
     self.set_defaults(address)
コード例 #27
0
 def __init__(self, address=None):
     Message.__init__(self)
     self.channel = 0
     self.name = ""
     self.set_defaults(address)
コード例 #28
0
    async def on_message(self, message: Message) -> None:
        """
        Process received message
        """
        _channel_offset = self.calc_channel_offset(message.address)

        if isinstance(
            message,
            (
                ChannelNamePart1Message,
                ChannelNamePart1Message2,
                ChannelNamePart1Message3,
            ),
        ):
            self._process_channel_name_message(1, message)
        elif isinstance(
            message,
            (
                ChannelNamePart2Message,
                ChannelNamePart2Message2,
                ChannelNamePart2Message3,
            ),
        ):
            self._process_channel_name_message(2, message)
        elif isinstance(
            message,
            (
                ChannelNamePart3Message,
                ChannelNamePart3Message2,
                ChannelNamePart3Message3,
            ),
        ):
            self._process_channel_name_message(3, message)
        elif isinstance(message, MemoryDataMessage):
            await self._process_memory_data_message(message)
        elif isinstance(message, (RelayStatusMessage, RelayStatusMessage2)):
            await self._channels[message.channel].update(
                {
                    "on": message.is_on(),
                    "inhibit": message.is_inhibited(),
                    "forced_on": message.is_forced_on(),
                    "disabled": message.is_disabled(),
                }
            )
        elif isinstance(message, SensorTemperatureMessage):
            chan = self._translate_channel_name(self._data["TemperatureChannel"])
            await self._channels[chan].update(
                {
                    "cur": message.getCurTemp(),
                    "min": message.getMinTemp(),
                    "max": message.getMaxTemp(),
                }
            )
        elif isinstance(message, TempSensorStatusMessage):
            # update the current temp
            chan = self._translate_channel_name(self._data["TemperatureChannel"])
            if chan in self._channels:
                await self._channels[chan].update(
                    {
                        "cur": message.current_temp,
                        "target": message.target_temp,
                        "cmode": message.mode_str,
                        "cstatus": message.status_str,
                    }
                )
        elif isinstance(message, PushButtonStatusMessage):
            _update_buttons = False
            for channel_types in self._data["Channels"]:
                if keys_exists(self._data, "Channels", channel_types, "Type"):
                    if (
                        self._data["Channels"][channel_types]["Type"] == "Button"
                        or self._data["Channels"][channel_types]["Type"] == "Sensor"
                        or self._data["Channels"][channel_types]["Type"]
                        == "ButtonCounter"
                    ):
                        _update_buttons = True
                        break
            if _update_buttons:
                for channel_id in range(1, 9):
                    channel = self._translate_channel_name(channel_id + _channel_offset)
                    if channel_id in message.closed:
                        await self._channels[channel].update({"closed": True})
                    if channel_id in message.opened:
                        await self._channels[channel].update({"closed": False})
        elif isinstance(message, (ModuleStatusMessage)):
            for channel_id in range(1, 9):
                channel = self._translate_channel_name(channel_id + _channel_offset)
                if channel_id in message.closed:
                    await self._channels[channel].update({"closed": True})
                elif channel in self._channels and isinstance(
                    self._channels[channel], (Button, ButtonCounter)
                ):
                    await self._channels[channel].update({"closed": False})
        elif isinstance(message, (ModuleStatusMessage2)):
            for channel_id in range(1, 9):
                channel = self._translate_channel_name(channel_id + _channel_offset)
                if channel_id in message.closed:
                    await self._channels[channel].update({"closed": True})
                elif isinstance(self._channels[channel], (Button, ButtonCounter)):
                    await self._channels[channel].update({"closed": False})
                if channel_id in message.enabled:
                    await self._channels[channel].update({"enabled": True})
                elif channel in self._channels and isinstance(
                    self._channels[channel], (Button, ButtonCounter)
                ):
                    await self._channels[channel].update({"enabled": False})
        elif isinstance(message, CounterStatusMessage) and isinstance(
            self._channels[message.channel], ButtonCounter
        ):
            channel = self._translate_channel_name(message.channel)
            await self._channels[channel].update(
                {
                    "pulses": message.pulses,
                    "counter": message.counter,
                    "delay": message.delay,
                }
            )
        elif isinstance(message, ModuleStatusPirMessage):
            await self._channels[CHANNEL_LIGHT_VALUE].update(
                {"cur": message.light_value}
            )
            await self._channels[1].update({"closed": message.dark})
            await self._channels[2].update({"closed": message.light})
            await self._channels[3].update({"closed": message.motion1})
            await self._channels[4].update({"closed": message.light_motion1})
            await self._channels[5].update({"closed": message.motion2})
            await self._channels[6].update({"closed": message.light_motion2})
            if 7 in self._channels:
                await self._channels[7].update({"closed": message.low_temp_alarm})
            if 8 in self._channels:
                await self._channels[8].update({"closed": message.high_temp_alarm})
        elif isinstance(message, UpdateLedStatusMessage):
            for channel_id in range(1, 9):
                channel = self._translate_channel_name(channel_id + _channel_offset)
                if channel_id in message.led_slow_blinking:
                    await self._channels[channel].update({"led_state": "slow"})
                if channel_id in message.led_fast_blinking:
                    await self._channels[channel].update({"led_state": "fast"})
                if channel_id in message.led_on:
                    await self._channels[channel].update({"led_state": "on"})
                if (
                    channel_id not in message.led_slow_blinking
                    and channel_id not in message.led_fast_blinking
                    and channel_id not in message.led_on
                ):
                    await self._channels[channel].update({"led_state": "off"})
        elif isinstance(message, SetLedMessage):
            for channel_id in range(1, 9):
                channel = self._translate_channel_name(channel_id + _channel_offset)
                if channel_id in message.leds:
                    await self._channels[channel].update({"led_state": "on"})
        elif isinstance(message, ClearLedMessage):
            for channel_id in range(1, 9):
                channel = self._translate_channel_name(channel_id + _channel_offset)
                if channel_id in message.leds:
                    await self._channels[channel].update({"led_state": "off"})
        elif isinstance(message, SlowBlinkingLedMessage):
            for channel_id in range(1, 9):
                channel = self._translate_channel_name(channel_id + _channel_offset)
                if channel_id in message.leds:
                    await self._channels[channel].update({"led_state": "slow"})
        elif isinstance(message, FastBlinkingLedMessage):
            for channel_id in range(1, 9):
                channel = self._translate_channel_name(channel_id + _channel_offset)
                if channel_id in message.leds:
                    await self._channels[channel].update({"led_state": "fast"})
        elif isinstance(message, (DimmerChannelStatusMessage, DimmerStatusMessage)):
            channel = self._translate_channel_name(message.channel)
            await self._channels[channel].update({"state": message.cur_dimmer_state()})
        elif isinstance(message, SliderStatusMessage):
            channel = self._translate_channel_name(message.channel)
            await self._channels[channel].update({"state": message.cur_slider_state()})
        elif isinstance(message, BlindStatusNgMessage):
            channel = self._translate_channel_name(message.channel)
            await self._channels[channel].update(
                {"state": message.status, "position": message.position}
            )
        elif isinstance(message, BlindStatusMessage):
            channel = self._translate_channel_name(message.channel)
            await self._channels[channel].update({"state": message.status})
        elif isinstance(message, MeteoRawMessage):
            await self._channels[11].update({"cur": message.rain})
            await self._channels[12].update({"cur": message.light})
            await self._channels[13].update({"cur": message.wind})

        self._cache()
コード例 #29
0
ファイル: cover_off.py プロジェクト: Cereal2nd/velbus-aio
 def __init__(self, address=None):
     Message.__init__(self)
     self.channel = 0
     self.delay_time = 0
     self.set_defaults(address)
コード例 #30
0
 def __init__(self, address=0x00):
     Message.__init__(self)
     self._ds = None
     self.set_defaults(address)