velbus-aio 2022.12.0__py3-none-any.whl → 2023.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of velbus-aio might be problematic. Click here for more details.
- {velbus_aio-2022.12.0.dist-info → velbus_aio-2023.5.0.dist-info}/METADATA +6 -6
- {velbus_aio-2022.12.0.dist-info → velbus_aio-2023.5.0.dist-info}/RECORD +15 -14
- {velbus_aio-2022.12.0.dist-info → velbus_aio-2023.5.0.dist-info}/WHEEL +1 -1
- {velbus_aio-2022.12.0.dist-info → velbus_aio-2023.5.0.dist-info}/top_level.txt +1 -0
- velbusaio/channels.py +39 -3
- velbusaio/handler.py +1 -1
- velbusaio/messages/__init__.py +1 -0
- velbusaio/messages/edge_set_color.py +113 -0
- velbusaio/messages/edge_set_custom_color.py +2 -2
- velbusaio/messages/restore_dimmer.py +2 -1
- velbusaio/messages/set_dimmer.py +2 -1
- velbusaio/module.py +6 -2
- velbusaio/raw_message.py +4 -4
- velbusaio/util.py +8 -5
- {velbus_aio-2022.12.0.dist-info → velbus_aio-2023.5.0.dist-info}/LICENSE +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: velbus-aio
|
|
3
|
-
Version:
|
|
4
|
-
Summary:
|
|
5
|
-
|
|
6
|
-
Author: Maikel Punie
|
|
7
|
-
Author-email: maikel.punie@gmail.com
|
|
3
|
+
Version: 2023.5.0
|
|
4
|
+
Summary: Open-source home automation platform running on Python 3.
|
|
5
|
+
Author-email: Maikel Punie <maikel.punie@gmail.com>
|
|
8
6
|
License: MIT
|
|
7
|
+
Project-URL: Source Code, https://github.com/Cereal2nd/velbus-aio
|
|
8
|
+
Project-URL: Bug Reports, https://github.com/Cereal2nd/velbus-aio/issues
|
|
9
9
|
Keywords: home,velbus,automation
|
|
10
10
|
Platform: any
|
|
11
11
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -21,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
21
21
|
Classifier: Topic :: Home Automation
|
|
22
22
|
Classifier: Topic :: Software Development :: Libraries
|
|
23
23
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
-
Requires-Python: >=3.8
|
|
24
|
+
Requires-Python: >=3.8.0
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
License-File: LICENSE
|
|
27
27
|
Requires-Dist: pyserial (>=3.5.0)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
velbusaio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
velbusaio/channels.py,sha256=
|
|
2
|
+
velbusaio/channels.py,sha256=FH1UO3IFqpQ6cxlQ2QHcEGk4uNXKdaeskPWr-k_ypNE,22129
|
|
3
3
|
velbusaio/command_registry.py,sha256=tC3Mbz_h5YzKqEP5L_rvfgVczharNHS7T-Sollb0Rgk,4430
|
|
4
4
|
velbusaio/const.py,sha256=swJuogDiNX_oKZVcIO5Lac3KYfiTNGieGMRPTHvLJV4,1548
|
|
5
5
|
velbusaio/controller.py,sha256=srmhnY3iK8qrffx_uA3IeTaQq-8NYetxEFBfGDVdm0Y,9254
|
|
6
6
|
velbusaio/discovery.py,sha256=Px6qoZl4QhF17aMz6JxstCORBpLzZGWEK9h4Vyvg57o,1649
|
|
7
7
|
velbusaio/exceptions.py,sha256=js5Pj-vl6OTGWZUoRGBguutVXbvz_fVmslkCcmT2gps,486
|
|
8
|
-
velbusaio/handler.py,sha256=
|
|
8
|
+
velbusaio/handler.py,sha256=gI0Zma9SbcVEvAzYno4IJbqwtEYQk5Cp6zxVNtmox54,8342
|
|
9
9
|
velbusaio/helpers.py,sha256=8PWyD13UA244ESk5YwPcRzvjK3OBAqmhwAwC6E9W4B4,2542
|
|
10
10
|
velbusaio/message.py,sha256=ZFy0iup_DK_so_wZsr2F-3A4AJgQGxf5C3TXjK4BMW0,5047
|
|
11
|
-
velbusaio/module.py,sha256
|
|
11
|
+
velbusaio/module.py,sha256=-Qg5_vIVpmd2vLjcGGXLfEKZKI4AE2s5FSq3bZXcREI,34889
|
|
12
12
|
velbusaio/protocol.py,sha256=sut7jf3IJiJRx59w1EJs0AX4Aa15vrPNgIWJrtQkMjc,8220
|
|
13
13
|
velbusaio/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
velbusaio/raw_message.py,sha256=
|
|
15
|
-
velbusaio/util.py,sha256=
|
|
16
|
-
velbusaio/messages/__init__.py,sha256=
|
|
14
|
+
velbusaio/raw_message.py,sha256=5604X_0Itav6Ts89tXWvXs6sdx_KWRvPvSHjtFjXlMA,4613
|
|
15
|
+
velbusaio/util.py,sha256=eCsGQJ9nuzk_B2skBlv3MsNaMaHDXo1a1qSPjObzXH4,1540
|
|
16
|
+
velbusaio/messages/__init__.py,sha256=0q0h3gIls7xJ-zzgLgV_C9G7IGkDa1Tp1vQ4CFY7gEs,5860
|
|
17
17
|
velbusaio/messages/blind_status.py,sha256=3K5JRRn34_N1oQRKNBCkNwWIwhaURYL1ZNZhQZWFnSU,3417
|
|
18
18
|
velbusaio/messages/bus_active.py,sha256=7aSGEASI4WxWZV9HI6P1b_p6wU1UvbJYmT90Hz_I8ls,748
|
|
19
19
|
velbusaio/messages/bus_error_counter_status.py,sha256=GYMAxyIHUZLzse-pzyUgegLMY75ptFLKNP5qADbuNFg,1177
|
|
@@ -35,7 +35,8 @@ velbusaio/messages/dali_device_settings_request.py,sha256=3IqaXOxqidJCJ1FxFMDofa
|
|
|
35
35
|
velbusaio/messages/dali_dim_value_status.py,sha256=V2Fs8CZNihIi9ZxQs7Bxkt9qCInFXxMZnF6vKhIUCnQ,1044
|
|
36
36
|
velbusaio/messages/dimmer_channel_status.py,sha256=nJ_83uVe0FIiwWmGt7XNXcRYu3ikNUwxOOg5nHzaOPw,2470
|
|
37
37
|
velbusaio/messages/dimmer_status.py,sha256=OWaChsyloAvRoywn-LlNz8LeuZKj3k3eNzL5mH49pM4,2927
|
|
38
|
-
velbusaio/messages/
|
|
38
|
+
velbusaio/messages/edge_set_color.py,sha256=enwPshhNrleAQQwc3RobPt5foZ1ynE_74SlBEuzd86w,3305
|
|
39
|
+
velbusaio/messages/edge_set_custom_color.py,sha256=fw4hQTrTxNBb63XLTY9iLFtPYrNh0mAAE28DCxG9h1A,1337
|
|
39
40
|
velbusaio/messages/fast_blinking_led.py,sha256=Q5scu34RQJZ43EDZCR1kJy63gULSWHN5bpKpqo_XOOc,908
|
|
40
41
|
velbusaio/messages/forced_off.py,sha256=QQiwMbVUW6wegyTLrf1daJiS8KggPXZvepGsBU9_FUo,590
|
|
41
42
|
velbusaio/messages/forced_on.py,sha256=tS7dUayO_0Grco5TfiOMWBUOc0CY44w_7FcpU-ZViJU,589
|
|
@@ -60,14 +61,14 @@ velbusaio/messages/realtime_clock_status_request.py,sha256=KEvcmWlgN4XbpHSA90fg3
|
|
|
60
61
|
velbusaio/messages/receive_buffer_full.py,sha256=dgyzmZ8VxhQk8r4vUs2uWuojut2Akj4IMazkqfDa1e4,857
|
|
61
62
|
velbusaio/messages/receive_ready.py,sha256=f1LdUVcUTG7rj71wCVHgF03zbkIx4CpJKG7zgXIERf4,686
|
|
62
63
|
velbusaio/messages/relay_status.py,sha256=BBJHM54gzbOTAoQ_N8ls3IiJoOIklKFCvBU4odntXvM,2836
|
|
63
|
-
velbusaio/messages/restore_dimmer.py,sha256=
|
|
64
|
+
velbusaio/messages/restore_dimmer.py,sha256=W2SGCAMA91cDWd4359RInhB3z4tvnfJ6vPLW2Ycu3vU,1718
|
|
64
65
|
velbusaio/messages/select_program.py,sha256=RHvOvWXC7w8wxMhco0NUDPIMK6r6Q2LCd87Kdnl7hxI,834
|
|
65
66
|
velbusaio/messages/sensor_settings_request.py,sha256=njSYjNTxhNyRKJLP7wexaWHnYiSWbrSlOm_F7myuBdw,818
|
|
66
67
|
velbusaio/messages/sensor_temp_request.py,sha256=R-VNtqqiDbgZjPNfj5nE0_bTuGLD74Zy-FUsrCcyXFI,598
|
|
67
68
|
velbusaio/messages/sensor_temperature.py,sha256=Erh7pIrbxpmurg3x9_di6A6Os_2Sgpid7T6LgHuWQyA,1557
|
|
68
69
|
velbusaio/messages/set_date.py,sha256=cHUmzLxji3WZisRQErX3m3EdnqwkdyQx3_1Ok6x6aYs,1426
|
|
69
70
|
velbusaio/messages/set_daylight_saving.py,sha256=Ihnshq7C1u7-sRN5fKKt3ZlHmOz9-Kj8lbddwQ9Ya9I,1084
|
|
70
|
-
velbusaio/messages/set_dimmer.py,sha256=
|
|
71
|
+
velbusaio/messages/set_dimmer.py,sha256=BDIOqLO9KuPWfzn0Ox56VPquRxlwyIdkmCFphrbBZho,1926
|
|
71
72
|
velbusaio/messages/set_led.py,sha256=hNmbmS2hXqTBVfXMWYhyf10-BOvd5ZwimMd74Cyj5PQ,899
|
|
72
73
|
velbusaio/messages/set_realtime_clock.py,sha256=H89tNgxDH5uotjwGbCM05qDMe0ZWhs7dRyyS3n6OLzA,1275
|
|
73
74
|
velbusaio/messages/set_temperature.py,sha256=PMs_uXWMhggIX0s2ikediwTJ4WSpvrXzahCJ0Ak_hks,958
|
|
@@ -95,8 +96,8 @@ velbusaio/messages/write_data_to_memory.py,sha256=2bC-vuv_RK3hGxvKeba1zR405ffj-C
|
|
|
95
96
|
velbusaio/messages/write_memory_block.py,sha256=5pP4hCRV7tc5xYxHO_51t-uCYgNtVHiaPic_ZGG2Y9s,1031
|
|
96
97
|
velbusaio/messages/write_module_address_and_serial_number.py,sha256=gU-yAHxICP6LPQX7BRj-WUfiVpTk0sV1CMlXeElAwl4,1596
|
|
97
98
|
velbusaio/moduleprotocol/protocol.json,sha256=zChwegR8Ic_Msw5iVMV_W3kVmSyK5DwYof46wD7l9H8,883766
|
|
98
|
-
velbus_aio-
|
|
99
|
-
velbus_aio-
|
|
100
|
-
velbus_aio-
|
|
101
|
-
velbus_aio-
|
|
102
|
-
velbus_aio-
|
|
99
|
+
velbus_aio-2023.5.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
100
|
+
velbus_aio-2023.5.0.dist-info/METADATA,sha256=KnnfurH3T9H8mUbGwaOQY7peciOj0t3zObPZ4L9PwoY,3033
|
|
101
|
+
velbus_aio-2023.5.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
102
|
+
velbus_aio-2023.5.0.dist-info/top_level.txt,sha256=W0-lSOwD23mm8FqaIe9vY20fKicBMIdUVjF-zmfxRnY,15
|
|
103
|
+
velbus_aio-2023.5.0.dist-info/RECORD,,
|
velbusaio/channels.py
CHANGED
|
@@ -18,6 +18,7 @@ from velbusaio.const import (
|
|
|
18
18
|
VOLUME_LITERS_HOUR,
|
|
19
19
|
)
|
|
20
20
|
from velbusaio.message import Message
|
|
21
|
+
from velbusaio.messages.edge_set_color import SetEdgeColorMessage, CustomColorPriority
|
|
21
22
|
from velbusaio.messages.module_status import PROGRAM_SELECTION
|
|
22
23
|
|
|
23
24
|
if TYPE_CHECKING:
|
|
@@ -275,6 +276,7 @@ class Button(Channel):
|
|
|
275
276
|
_enabled = True
|
|
276
277
|
_closed = False
|
|
277
278
|
_led_state = None
|
|
279
|
+
_long = False
|
|
278
280
|
|
|
279
281
|
def get_categories(self) -> list[str]:
|
|
280
282
|
if self._enabled:
|
|
@@ -702,8 +704,42 @@ class EdgeLit(Channel):
|
|
|
702
704
|
An EdgeLit channel
|
|
703
705
|
"""
|
|
704
706
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
+
async def reset_color(self, left=True, top=True, right=True, bottom=True):
|
|
708
|
+
msg = SetEdgeColorMessage(self._address)
|
|
709
|
+
msg.apply_background_color = True
|
|
710
|
+
msg.color_idx = 0
|
|
711
|
+
msg.apply_to_left_edge = left
|
|
712
|
+
msg.apply_to_top_edge = top
|
|
713
|
+
msg.apply_to_right_edge = right
|
|
714
|
+
msg.apply_to_bottom_edge = bottom
|
|
715
|
+
msg.apply_to_all_pages = True
|
|
716
|
+
await self._writer(msg)
|
|
717
|
+
|
|
718
|
+
async def set_color(
|
|
719
|
+
self,
|
|
720
|
+
color_idx: int,
|
|
721
|
+
left=True,
|
|
722
|
+
top=True,
|
|
723
|
+
right=True,
|
|
724
|
+
bottom=True,
|
|
725
|
+
blinking=False,
|
|
726
|
+
priority=CustomColorPriority.LOW_PRIORITY,
|
|
727
|
+
) -> None:
|
|
728
|
+
"""
|
|
729
|
+
Send the turn off message
|
|
730
|
+
"""
|
|
731
|
+
|
|
732
|
+
msg = SetEdgeColorMessage(self._address)
|
|
733
|
+
msg.apply_background_color = True
|
|
734
|
+
msg.background_blinking = blinking
|
|
735
|
+
msg.color_idx = color_idx
|
|
736
|
+
msg.apply_to_left_edge = left
|
|
737
|
+
msg.apply_to_top_edge = top
|
|
738
|
+
msg.apply_to_right_edge = right
|
|
739
|
+
msg.apply_to_bottom_edge = bottom
|
|
740
|
+
msg.apply_to_all_pages = True
|
|
741
|
+
msg.custom_color_priority = priority
|
|
742
|
+
await self._writer(msg)
|
|
707
743
|
|
|
708
744
|
|
|
709
745
|
class Memo(Channel):
|
|
@@ -739,7 +775,7 @@ class SelectedProgram(Channel):
|
|
|
739
775
|
return None
|
|
740
776
|
|
|
741
777
|
def get_options(self) -> list:
|
|
742
|
-
return PROGRAM_SELECTION.values()
|
|
778
|
+
return list(PROGRAM_SELECTION.values())
|
|
743
779
|
|
|
744
780
|
def get_selected_program(self) -> str:
|
|
745
781
|
return self._selected_program_str
|
velbusaio/handler.py
CHANGED
|
@@ -101,7 +101,7 @@ class PacketHandler:
|
|
|
101
101
|
msg.populate(priority, address, rtr, data)
|
|
102
102
|
self._log.debug(f"Received {msg}")
|
|
103
103
|
# send the message to the modules
|
|
104
|
-
await
|
|
104
|
+
await self._velbus.get_module(msg.address).on_message(msg)
|
|
105
105
|
else:
|
|
106
106
|
self._log.warning(
|
|
107
107
|
"NOT FOUND IN command_registry: addr={} cmd={} packet={}".format(
|
velbusaio/messages/__init__.py
CHANGED
|
@@ -66,6 +66,7 @@ from velbusaio.messages.receive_buffer_full import ReceiveBufferFullMessage
|
|
|
66
66
|
from velbusaio.messages.receive_ready import ReceiveReadyMessage
|
|
67
67
|
from velbusaio.messages.relay_status import RelayStatusMessage
|
|
68
68
|
from velbusaio.messages.restore_dimmer import RestoreDimmerMessage
|
|
69
|
+
from velbusaio.messages.select_program import SelectProgramMessage
|
|
69
70
|
from velbusaio.messages.sensor_temp_request import SensorTempRequest
|
|
70
71
|
from velbusaio.messages.sensor_temperature import SensorTemperatureMessage
|
|
71
72
|
from velbusaio.messages.set_date import SetDate
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from enum import IntEnum
|
|
4
|
+
from velbusaio.command_registry import register
|
|
5
|
+
from velbusaio.message import Message
|
|
6
|
+
|
|
7
|
+
COMMAND_CODE = 0xD4
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CustomColorPriority(IntEnum):
|
|
11
|
+
LOW_PRIORITY = 1
|
|
12
|
+
MID_PRIORITY = 2
|
|
13
|
+
HIGH_PRIORITY = 3
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@register(COMMAND_CODE, ["VMBEL1", "VMBEL2", "VMBEL4", "VMBELO"])
|
|
17
|
+
class SetEdgeColorMessage(Message):
|
|
18
|
+
"""
|
|
19
|
+
send by:
|
|
20
|
+
received by: VMBEL1, VMBEL2, VMBEL4, VMBELO
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
apply_background_color = False
|
|
24
|
+
apply_continuous_feedback_color = False
|
|
25
|
+
apply_slow_blinking_feedback_color = False
|
|
26
|
+
apply_fast_blinking_feedback_color = False
|
|
27
|
+
custom_color_palette = False
|
|
28
|
+
|
|
29
|
+
apply_to_left_edge = False
|
|
30
|
+
apply_to_top_edge = False
|
|
31
|
+
apply_to_right_edge = False
|
|
32
|
+
apply_to_bottom_edge = False
|
|
33
|
+
|
|
34
|
+
apply_to_page: int | None = None
|
|
35
|
+
apply_to_all_pages = False
|
|
36
|
+
|
|
37
|
+
background_blinking = False
|
|
38
|
+
custom_color_priority: CustomColorPriority | None = None
|
|
39
|
+
|
|
40
|
+
color_idx: int = 0
|
|
41
|
+
|
|
42
|
+
def populate(self, priority, address, rtr, data):
|
|
43
|
+
"""
|
|
44
|
+
:return: None
|
|
45
|
+
"""
|
|
46
|
+
self.needs_no_rtr(rtr)
|
|
47
|
+
self.set_attributes(priority, address, rtr)
|
|
48
|
+
|
|
49
|
+
self.apply_background_color = bool(data[0] & 0x01)
|
|
50
|
+
self.apply_continuous_feedback_color = bool(data[0] & 0x02)
|
|
51
|
+
self.apply_slow_blinking_feedback_color = bool(data[0] & 0x04)
|
|
52
|
+
self.apply_fast_blinking_feedback_color = bool(data[0] & 0x08)
|
|
53
|
+
self.custom_color_palette = bool(data[0] & 0x80)
|
|
54
|
+
|
|
55
|
+
self.apply_to_left_edge = bool(data[1] & 0x01)
|
|
56
|
+
self.apply_to_top_edge = bool(data[1] & 0x02)
|
|
57
|
+
self.apply_to_right_edge = bool(data[1] & 0x04)
|
|
58
|
+
self.apply_to_bottom_edge = bool(data[1] & 0x08)
|
|
59
|
+
|
|
60
|
+
page = (data[1] & 0b0111_0000) >> 4
|
|
61
|
+
if page > 0:
|
|
62
|
+
self.apply_to_page = page
|
|
63
|
+
self.apply_to_all_pages = bool(data[1] & 0x80)
|
|
64
|
+
|
|
65
|
+
self.background_blinking = bool(data[2] & 0x80)
|
|
66
|
+
|
|
67
|
+
custom_color_priority_value = data[2] & 0b0110_0000 >> 5
|
|
68
|
+
if custom_color_priority_value:
|
|
69
|
+
self.custom_color_priority = CustomColorPriority(
|
|
70
|
+
custom_color_priority_value
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
self.color_idx = data[2] & 0b0001_1111
|
|
74
|
+
|
|
75
|
+
def data_to_binary(self):
|
|
76
|
+
"""
|
|
77
|
+
:return: bytes
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
byte_2 = (
|
|
81
|
+
self.apply_background_color * 0x01
|
|
82
|
+
+ self.apply_continuous_feedback_color * 0x02
|
|
83
|
+
+ self.apply_slow_blinking_feedback_color * 0x04
|
|
84
|
+
+ self.apply_fast_blinking_feedback_color * 0x08
|
|
85
|
+
+ self.custom_color_palette * 0x80
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
byte_3 = (
|
|
89
|
+
self.apply_to_left_edge * 0x01
|
|
90
|
+
+ self.apply_to_top_edge * 0x02
|
|
91
|
+
+ self.apply_to_right_edge * 0x04
|
|
92
|
+
+ self.apply_to_bottom_edge * 0x08
|
|
93
|
+
+ (((self.apply_to_page or 0) & 0xFFF) << 4)
|
|
94
|
+
+ self.apply_to_all_pages * 0x80
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
byte_4 = (
|
|
98
|
+
(self.color_idx & 0xFFFF)
|
|
99
|
+
+ (
|
|
100
|
+
(int(self.custom_color_priority) if self.custom_color_priority else 0)
|
|
101
|
+
<< 5
|
|
102
|
+
)
|
|
103
|
+
+ self.background_blinking * 0x80
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
return bytes(
|
|
107
|
+
[
|
|
108
|
+
COMMAND_CODE,
|
|
109
|
+
byte_2,
|
|
110
|
+
byte_3,
|
|
111
|
+
byte_4,
|
|
112
|
+
]
|
|
113
|
+
)
|
|
@@ -9,11 +9,11 @@ from velbusaio.message import Message
|
|
|
9
9
|
COMMAND_CODE = 0xD4
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
@register(COMMAND_CODE)
|
|
12
|
+
@register(COMMAND_CODE, ["VMBEL1", "VMBEL2", "VMBEL4", "VMBELO"])
|
|
13
13
|
class EdgeSetCustomColor(Message):
|
|
14
14
|
"""
|
|
15
15
|
send by:
|
|
16
|
-
received by:
|
|
16
|
+
received by: VMBEL1, VMBEL2, VMBEL4, VMBELO
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
def __init__(self, address=None):
|
velbusaio/messages/set_dimmer.py
CHANGED
velbusaio/module.py
CHANGED
|
@@ -176,7 +176,7 @@ class Module:
|
|
|
176
176
|
# The solution would be that this functions knows were the temperature channels are located
|
|
177
177
|
# and/or what the max number of subaddresses are for each module.
|
|
178
178
|
if self._sub_address == {}:
|
|
179
|
-
|
|
179
|
+
raise Exception("No subaddresses defined")
|
|
180
180
|
for sub in range(1, 4):
|
|
181
181
|
if sub not in self._sub_address:
|
|
182
182
|
for i in range(((sub * 8) + 1), (((sub + 1) * 8) + 1)):
|
|
@@ -372,8 +372,12 @@ class Module:
|
|
|
372
372
|
channel = self._translate_channel_name(channel_id + _channel_offset)
|
|
373
373
|
if channel_id in message.closed:
|
|
374
374
|
await self._update_channel(channel, {"closed": True})
|
|
375
|
+
if channel_id in message.closed_long:
|
|
376
|
+
await self._update_channel(channel, {"long": True})
|
|
375
377
|
if channel_id in message.opened:
|
|
376
|
-
await self._update_channel(
|
|
378
|
+
await self._update_channel(
|
|
379
|
+
channel, {"closed": False, "long": False}
|
|
380
|
+
)
|
|
377
381
|
elif isinstance(message, (ModuleStatusMessage)):
|
|
378
382
|
for channel_id in range(1, 9):
|
|
379
383
|
channel = self._translate_channel_name(channel_id + _channel_offset)
|
velbusaio/raw_message.py
CHANGED
|
@@ -78,10 +78,10 @@ class ParseError(Exception):
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
def _parse(rawmessage: bytearray) -> Tuple[Optional[RawMessage], bytearray]:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
if len(rawmessage) < MINIMUM_MESSAGE_SIZE or len(rawmessage) > MAXIMUM_MESSAGE_SIZE:
|
|
82
|
+
raise ValueError("Received a raw message with an illegal lemgth")
|
|
83
|
+
if rawmessage[0] != START_BYTE:
|
|
84
|
+
raise ValueError("Received a raw message with the wrong startbyte")
|
|
85
85
|
|
|
86
86
|
priority = rawmessage[1]
|
|
87
87
|
if priority not in PRIORITIES:
|
velbusaio/util.py
CHANGED
|
@@ -6,8 +6,10 @@ from velbusaio.const import MAXIMUM_MESSAGE_SIZE, MINIMUM_MESSAGE_SIZE
|
|
|
6
6
|
# Copyright (c) 2017 Thomas Delaet
|
|
7
7
|
# Copied from python-velbus (https://github.com/thomasdelaet/python-velbus)
|
|
8
8
|
def checksum(data: Union[bytes, bytearray]) -> int:
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
if len(data) < MINIMUM_MESSAGE_SIZE - 2:
|
|
10
|
+
raise ValueError("The message is shorter then expected")
|
|
11
|
+
if len(data) > MAXIMUM_MESSAGE_SIZE - 2:
|
|
12
|
+
raise ValueError("The message is longer then expected")
|
|
11
13
|
__checksum = 0
|
|
12
14
|
for data_byte in data:
|
|
13
15
|
__checksum += data_byte
|
|
@@ -35,12 +37,13 @@ class BitSet:
|
|
|
35
37
|
self._value = value
|
|
36
38
|
|
|
37
39
|
def __getitem__(self, idx: int) -> bool:
|
|
38
|
-
|
|
40
|
+
if idx > 8 or idx <= 0:
|
|
41
|
+
raise ValueError("The bitSet id is not within expected range 0 < id < 8")
|
|
39
42
|
return bool((1 << idx) & self._value)
|
|
40
43
|
|
|
41
44
|
def __setitem__(self, idx: int, value: bool) -> None:
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
if idx > 8 or idx <= 0:
|
|
46
|
+
raise ValueError("The bitSet id is not within expected range 0 < id < 8")
|
|
44
47
|
mask = (0xFF ^ (1 << idx)) & self._value
|
|
45
48
|
self._value = mask & (value << idx)
|
|
46
49
|
|
|
File without changes
|