velbus-aio 2021.8.7__py3-none-any.whl → 2025.11.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.
Files changed (200) hide show
  1. scripts/parse_specs.py +156 -0
  2. velbus_aio-2025.11.0.dist-info/METADATA +71 -0
  3. velbus_aio-2025.11.0.dist-info/RECORD +194 -0
  4. {velbus_aio-2021.8.7.dist-info → velbus_aio-2025.11.0.dist-info}/WHEEL +1 -1
  5. velbus_aio-2025.11.0.dist-info/top_level.txt +3 -0
  6. velbusaio/channels.py +443 -109
  7. velbusaio/command_registry.py +126 -13
  8. velbusaio/const.py +36 -12
  9. velbusaio/controller.py +252 -177
  10. velbusaio/discovery.py +2 -2
  11. velbusaio/exceptions.py +22 -0
  12. velbusaio/handler.py +311 -145
  13. velbusaio/helpers.py +6 -18
  14. velbusaio/message.py +46 -132
  15. velbusaio/messages/__init__.py +12 -2
  16. velbusaio/messages/blind_status.py +16 -25
  17. velbusaio/messages/bus_active.py +3 -9
  18. velbusaio/messages/bus_error_counter_status.py +3 -4
  19. velbusaio/messages/bus_error_counter_status_request.py +3 -4
  20. velbusaio/messages/bus_off.py +3 -4
  21. velbusaio/messages/channel_name_part1.py +49 -33
  22. velbusaio/messages/channel_name_part2.py +49 -33
  23. velbusaio/messages/channel_name_part3.py +49 -33
  24. velbusaio/messages/channel_name_request.py +26 -12
  25. velbusaio/messages/clear_led.py +3 -4
  26. velbusaio/messages/counter_status.py +3 -17
  27. velbusaio/messages/counter_status_request.py +6 -6
  28. velbusaio/messages/counter_value.py +44 -0
  29. velbusaio/messages/cover_down.py +4 -29
  30. velbusaio/messages/cover_off.py +5 -29
  31. velbusaio/messages/cover_position.py +4 -19
  32. velbusaio/messages/cover_up.py +4 -27
  33. velbusaio/messages/dali_device_settings.py +178 -0
  34. velbusaio/messages/dali_device_settings_request.py +53 -0
  35. velbusaio/messages/dali_dim_value_status.py +44 -0
  36. velbusaio/messages/dimmer_channel_status.py +6 -19
  37. velbusaio/messages/dimmer_status.py +14 -31
  38. velbusaio/messages/edge_set_color.py +114 -0
  39. velbusaio/messages/edge_set_custom_color.py +56 -0
  40. velbusaio/messages/fast_blinking_led.py +3 -4
  41. velbusaio/messages/forced_off.py +3 -4
  42. velbusaio/messages/forced_on.py +3 -4
  43. velbusaio/messages/interface_status_request.py +3 -4
  44. velbusaio/messages/ir_receiver_status.py +18 -0
  45. velbusaio/messages/kwh_status.py +3 -19
  46. velbusaio/messages/light_value_request.py +3 -4
  47. velbusaio/messages/memo_text.py +3 -5
  48. velbusaio/messages/memory_data.py +3 -16
  49. velbusaio/messages/memory_data_block.py +3 -4
  50. velbusaio/messages/memory_dump_request.py +3 -4
  51. velbusaio/messages/module_status.py +107 -55
  52. velbusaio/messages/module_status_request.py +7 -6
  53. velbusaio/messages/module_subtype.py +11 -19
  54. velbusaio/messages/module_type.py +132 -21
  55. velbusaio/messages/module_type_request.py +1 -0
  56. velbusaio/messages/psu_load.py +56 -0
  57. velbusaio/messages/psu_values.py +53 -0
  58. velbusaio/messages/push_button_status.py +3 -16
  59. velbusaio/messages/raw.py +74 -0
  60. velbusaio/messages/read_data_block_from_memory.py +3 -4
  61. velbusaio/messages/read_data_from_memory.py +3 -4
  62. velbusaio/messages/realtime_clock_status_request.py +3 -4
  63. velbusaio/messages/receive_buffer_full.py +3 -4
  64. velbusaio/messages/receive_ready.py +3 -4
  65. velbusaio/messages/relay_status.py +13 -42
  66. velbusaio/messages/restore_dimmer.py +33 -24
  67. velbusaio/messages/select_program.py +35 -0
  68. velbusaio/messages/sensor_settings_request.py +3 -4
  69. velbusaio/messages/sensor_temp_request.py +3 -4
  70. velbusaio/messages/sensor_temperature.py +15 -19
  71. velbusaio/messages/set_date.py +10 -30
  72. velbusaio/messages/set_daylight_saving.py +8 -24
  73. velbusaio/messages/set_dimmer.py +43 -41
  74. velbusaio/messages/set_led.py +3 -4
  75. velbusaio/messages/set_realtime_clock.py +10 -30
  76. velbusaio/messages/set_temperature.py +3 -4
  77. velbusaio/messages/slider_status.py +16 -20
  78. velbusaio/messages/slow_blinking_led.py +3 -4
  79. velbusaio/messages/start_relay_blinking_timer.py +3 -4
  80. velbusaio/messages/start_relay_timer.py +3 -4
  81. velbusaio/messages/switch_relay_off.py +3 -16
  82. velbusaio/messages/switch_relay_on.py +3 -16
  83. velbusaio/messages/switch_to_comfort.py +4 -15
  84. velbusaio/messages/switch_to_day.py +4 -15
  85. velbusaio/messages/switch_to_night.py +4 -15
  86. velbusaio/messages/switch_to_safe.py +4 -15
  87. velbusaio/messages/temp_sensor_settings_part1.py +3 -4
  88. velbusaio/messages/temp_sensor_settings_part2.py +27 -0
  89. velbusaio/messages/temp_sensor_settings_part3.py +27 -0
  90. velbusaio/messages/temp_sensor_settings_part4.py +27 -0
  91. velbusaio/messages/temp_sensor_settings_request.py +3 -4
  92. velbusaio/messages/temp_sensor_status.py +34 -35
  93. velbusaio/messages/temp_set_cooling.py +3 -13
  94. velbusaio/messages/temp_set_heating.py +3 -13
  95. velbusaio/messages/update_led_status.py +3 -4
  96. velbusaio/messages/very_fast_blinking_led.py +3 -4
  97. velbusaio/messages/write_data_to_memory.py +3 -4
  98. velbusaio/messages/write_memory_block.py +3 -4
  99. velbusaio/messages/write_module_address_and_serial_number.py +3 -4
  100. velbusaio/module.py +680 -158
  101. velbusaio/module_spec/01.json +62 -0
  102. velbusaio/module_spec/02.json +16 -0
  103. velbusaio/module_spec/03.json +23 -0
  104. velbusaio/module_spec/04.json +283 -0
  105. velbusaio/module_spec/05.json +54 -0
  106. velbusaio/module_spec/06.json +110 -0
  107. velbusaio/module_spec/07.json +16 -0
  108. velbusaio/module_spec/08.json +38 -0
  109. velbusaio/module_spec/09.json +30 -0
  110. velbusaio/module_spec/0A.json +58 -0
  111. velbusaio/module_spec/0B.json +58 -0
  112. velbusaio/module_spec/0C.json +18 -0
  113. velbusaio/module_spec/0E.json +25 -0
  114. velbusaio/module_spec/0F.json +16 -0
  115. velbusaio/module_spec/10.json +111 -0
  116. velbusaio/module_spec/11.json +111 -0
  117. velbusaio/module_spec/12.json +73 -0
  118. velbusaio/module_spec/13.json +4 -0
  119. velbusaio/module_spec/14.json +16 -0
  120. velbusaio/module_spec/15.json +83 -0
  121. velbusaio/module_spec/16.json +129 -0
  122. velbusaio/module_spec/17.json +129 -0
  123. velbusaio/module_spec/18.json +129 -0
  124. velbusaio/module_spec/1A.json +79 -0
  125. velbusaio/module_spec/1B.json +107 -0
  126. velbusaio/module_spec/1D.json +89 -0
  127. velbusaio/module_spec/1E.json +306 -0
  128. velbusaio/module_spec/1F.json +178 -0
  129. velbusaio/module_spec/20.json +178 -0
  130. velbusaio/module_spec/21.json +326 -0
  131. velbusaio/module_spec/22.json +426 -0
  132. velbusaio/module_spec/23.json +129 -0
  133. velbusaio/module_spec/24.json +30 -0
  134. velbusaio/module_spec/25.json +3 -0
  135. velbusaio/module_spec/28.json +454 -0
  136. velbusaio/module_spec/29.json +235 -0
  137. velbusaio/module_spec/2A.json +239 -0
  138. velbusaio/module_spec/2B.json +239 -0
  139. velbusaio/module_spec/2C.json +257 -0
  140. velbusaio/module_spec/2D.json +270 -0
  141. velbusaio/module_spec/2E.json +215 -0
  142. velbusaio/module_spec/2F.json +211 -0
  143. velbusaio/module_spec/30.json +58 -0
  144. velbusaio/module_spec/31.json +465 -0
  145. velbusaio/module_spec/32.json +385 -0
  146. velbusaio/module_spec/33.json +249 -0
  147. velbusaio/module_spec/34.json +313 -0
  148. velbusaio/module_spec/35.json +313 -0
  149. velbusaio/module_spec/36.json +313 -0
  150. velbusaio/module_spec/37.json +333 -0
  151. velbusaio/module_spec/38.json +111 -0
  152. velbusaio/module_spec/39.json +4 -0
  153. velbusaio/module_spec/3A.json +306 -0
  154. velbusaio/module_spec/3B.json +306 -0
  155. velbusaio/module_spec/3C.json +306 -0
  156. velbusaio/module_spec/3D.json +454 -0
  157. velbusaio/module_spec/3E.json +302 -0
  158. velbusaio/module_spec/3F.json +4 -0
  159. velbusaio/module_spec/40.json +4 -0
  160. velbusaio/module_spec/41.json +241 -0
  161. velbusaio/module_spec/42.json +4 -0
  162. velbusaio/module_spec/43.json +23 -0
  163. velbusaio/module_spec/44.json +38 -0
  164. velbusaio/module_spec/45.json +4 -0
  165. velbusaio/module_spec/48.json +111 -0
  166. velbusaio/module_spec/49.json +111 -0
  167. velbusaio/module_spec/4A.json +89 -0
  168. velbusaio/module_spec/4B.json +138 -0
  169. velbusaio/module_spec/4C.json +129 -0
  170. velbusaio/module_spec/4D.json +108 -0
  171. velbusaio/module_spec/4E.json +787 -0
  172. velbusaio/module_spec/4F.json +114 -0
  173. velbusaio/module_spec/50.json +114 -0
  174. velbusaio/module_spec/51.json +114 -0
  175. velbusaio/module_spec/52.json +456 -0
  176. velbusaio/module_spec/54.json +270 -0
  177. velbusaio/module_spec/55.json +270 -0
  178. velbusaio/module_spec/56.json +270 -0
  179. velbusaio/module_spec/57.json +260 -0
  180. velbusaio/module_spec/5A.json +4 -0
  181. velbusaio/module_spec/5B.json +4 -0
  182. velbusaio/module_spec/5C.json +90 -0
  183. velbusaio/module_spec/5F.json +78 -0
  184. velbusaio/module_spec/60.json +4 -0
  185. velbusaio/module_spec/61.json +89 -0
  186. velbusaio/module_spec/broadcast.json +67 -0
  187. velbusaio/module_spec/ignore.json +22 -0
  188. velbusaio/protocol.py +243 -0
  189. velbusaio/py.typed +0 -0
  190. velbusaio/raw_message.py +149 -0
  191. velbusaio/util.py +55 -0
  192. velbusaio/vlp_reader.py +249 -0
  193. velbus_aio-2021.8.7.dist-info/METADATA +0 -66
  194. velbus_aio-2021.8.7.dist-info/RECORD +0 -90
  195. velbus_aio-2021.8.7.dist-info/top_level.txt +0 -1
  196. velbusaio/messages/meteo_raw.py +0 -52
  197. velbusaio/module_registry.py +0 -64
  198. velbusaio/moduleprotocol/protocol.json +0 -25540
  199. velbusaio/parser.py +0 -142
  200. {velbus_aio-2021.8.7.dist-info → velbus_aio-2025.11.0.dist-info/licenses}/LICENSE +0 -0
@@ -1,22 +1,122 @@
1
- """
1
+ """Command registry.
2
+
2
3
  :author: Maikel Punie <maikel.punie@gmail.com> and Thomas Delaet <thomas@delaet.org>
3
4
  """
5
+
4
6
  from __future__ import annotations
5
7
 
6
- from velbusaio.module_registry import MODULE_DIRECTORY
8
+ MODULE_DIRECTORY = {
9
+ 0x01: "VMB8PB",
10
+ 0x02: "VMB1RY",
11
+ 0x03: "VMB1BL",
12
+ 0x04: "VMBPSUMNGR-20",
13
+ 0x05: "VMB6IN",
14
+ 0x06: "VMB4LEDPWM-20",
15
+ 0x07: "VMB1DM",
16
+ 0x08: "VMB4RY",
17
+ 0x09: "VMB2BL",
18
+ 0x0A: "VMB8IR",
19
+ 0x0B: "VMB4PD",
20
+ 0x0C: "VMB1TS",
21
+ 0x0D: "VMB1TH",
22
+ 0x0E: "VMB1TC",
23
+ 0x0F: "VMB1LED",
24
+ 0x10: "VMB4RYLD",
25
+ 0x11: "VMB4RYNO",
26
+ 0x12: "VMB4DC",
27
+ 0x13: "VMBLCDWB",
28
+ 0x14: "VMBDME",
29
+ 0x15: "VMBDMI",
30
+ 0x16: "VMB8PBU",
31
+ 0x17: "VMB6PBN",
32
+ 0x18: "VMB2PBN",
33
+ 0x19: "VMB6PBB",
34
+ 0x1A: "VMB4RF",
35
+ 0x1B: "VMB1RYNO",
36
+ 0x1C: "VMB1BLE",
37
+ 0x1D: "VMB2BLE",
38
+ 0x1E: "VMBGP1",
39
+ 0x1F: "VMBGP2",
40
+ 0x20: "VMBGP4",
41
+ 0x21: "VMBGPO",
42
+ 0x22: "VMB7IN",
43
+ 0x23: "VMBPIRO-10",
44
+ 0x24: "VMB2DC-20",
45
+ 0x25: "VMBGPTC",
46
+ 0x26: "VMB4RYLD-20",
47
+ 0x27: "VMB4RYNO-20",
48
+ 0x28: "VMBGPOD",
49
+ 0x29: "VMB1RYNOS",
50
+ 0x2A: "VMBPIRM",
51
+ 0x2B: "VMBPIRC",
52
+ 0x2C: "VMBPIRO",
53
+ 0x2D: "VMBGP4PIR",
54
+ 0x2E: "VMB1BLS",
55
+ 0x2F: "VMBDMI-R",
56
+ 0x30: "VMBRFR8S",
57
+ 0x31: "VMBMETEO",
58
+ 0x32: "VMB4AN",
59
+ 0x33: "VMBVP01",
60
+ 0x34: "VMBEL1",
61
+ 0x35: "VMBEL2",
62
+ 0x36: "VMBEL4",
63
+ 0x37: "VMBELO",
64
+ 0x38: "VMBELPIR",
65
+ 0x39: "VMBSIG",
66
+ 0x3A: "VMBGP1-2",
67
+ 0x3B: "VMBGP2-2",
68
+ 0x3C: "VMBGP4-2",
69
+ 0x3D: "VMBGPOD-2",
70
+ 0x3E: "VMBGP4PIR-2",
71
+ 0x3F: "VMCM3",
72
+ 0x40: "VMBUSBIP",
73
+ 0x41: "VMB1RYS",
74
+ 0x42: "VMBKP",
75
+ 0x43: "VMBIN",
76
+ 0x44: "VMB4PB",
77
+ 0x45: "VMBDALI",
78
+ 0x48: "VMB4RYLD-10",
79
+ 0x49: "VMB4RYNO-10",
80
+ 0x4A: "VMB2BLE-10",
81
+ 0x4B: "VMB8DC-20",
82
+ 0x4C: "VMB6PB-20",
83
+ 0x4D: "VMBPIR-20",
84
+ 0x4E: "VMB8IN-20",
85
+ 0x4F: "VMBEL1-20",
86
+ 0x50: "VMBEL2-20",
87
+ 0x51: "VMBEL4-20",
88
+ 0x52: "VMBELO-20",
89
+ 0x54: "VMBGP1-20",
90
+ 0x55: "VMBGP2-20",
91
+ 0x56: "VMBGP4-20",
92
+ 0x57: "VMBGPO-20",
93
+ 0x59: "VMBPIRO-20",
94
+ 0x5A: "VMBDALI-20",
95
+ 0x5B: "VMBSIG-20",
96
+ 0x5C: "VMBEL4PIR-20",
97
+ 0x5F: "VMBGP4PIR-20",
98
+ 0x60: "VMBSIG-21",
99
+ 0x61: "VMB2BLE-20",
100
+ }
7
101
 
8
102
 
9
103
  class CommandRegistry:
104
+ """Command registry class."""
105
+
10
106
  def __init__(self, module_directory: dict) -> None:
107
+ """Init method."""
11
108
  self._module_directory = module_directory
12
109
  self._default_commands = {}
13
110
  self._overrides = {}
14
111
 
15
112
  def register_command(
16
- self, command_value: int, command_class: type, module_name: str = 0
113
+ self, command_value: int, command_class: type, module_name: str | None = None
17
114
  ) -> None:
18
- assert command_value >= 0 and command_value <= 255
19
- assert module_name in self._module_directory.values() or module_name == 0
115
+ """Register a command."""
116
+ if command_value < 0 or command_value > 255:
117
+ raise ValueError("Command_value should be >=0 and <=255")
118
+ if module_name and module_name not in self._module_directory.values():
119
+ raise Exception(f"Module name {module_name} not known")
20
120
  if module_name:
21
121
  module_type = next(
22
122
  (
@@ -33,20 +133,25 @@ class CommandRegistry:
33
133
  def _register_override(
34
134
  self, command_value: int, command_class: type, module_type: str
35
135
  ) -> None:
136
+ """Register and override."""
36
137
  if module_type not in self._overrides:
37
138
  self._overrides[module_type] = {}
38
139
  if command_value not in self._overrides[module_type]:
39
140
  self._overrides[module_type][command_value] = command_class
40
141
  else:
41
- raise Exception("double registration in command registry")
142
+ raise Exception(
143
+ f"double registration in command registry {command_value} {command_class}"
144
+ )
42
145
 
43
146
  def _register_default(self, command_value: int, command_class: type) -> None:
147
+ """Register a default command."""
44
148
  if command_value not in self._default_commands:
45
149
  self._default_commands[command_value] = command_class
46
150
  else:
47
151
  raise Exception("double registration in command registry")
48
152
 
49
153
  def has_command(self, command_value: int, module_type: int = 0) -> bool:
154
+ """Find a command."""
50
155
  if module_type in self._overrides:
51
156
  if command_value in self._overrides[module_type]:
52
157
  return True
@@ -55,6 +160,7 @@ class CommandRegistry:
55
160
  return False
56
161
 
57
162
  def get_command(self, command_value: int, module_type: int = 0) -> None | type:
163
+ """Search a command in the registry."""
58
164
  if module_type in self._overrides:
59
165
  if command_value in self._overrides[module_type]:
60
166
  return self._overrides[module_type][command_value]
@@ -66,10 +172,17 @@ class CommandRegistry:
66
172
  commandRegistry = CommandRegistry(MODULE_DIRECTORY)
67
173
 
68
174
 
69
- def register_command(
70
- command_value: int, command_class: type, module_type: str = 0
71
- ) -> None:
72
- """
73
- :return: None
74
- """
75
- commandRegistry.register_command(command_value, command_class, module_type)
175
+ def register(command_value: int, module_types: list[str] | None = None):
176
+ """Register decorator."""
177
+
178
+ def inner_register(command_class):
179
+ if module_types:
180
+ for module_type in module_types:
181
+ commandRegistry.register_command(
182
+ command_value, command_class, module_type
183
+ )
184
+ else:
185
+ commandRegistry.register_command(command_value, command_class)
186
+ return command_class
187
+
188
+ return inner_register
velbusaio/const.py CHANGED
@@ -1,6 +1,8 @@
1
- """
1
+ """Constant for velbusaio.
2
+
2
3
  Author: Maikel Punie <maikel.punie@gmail.com>
3
4
  """
5
+
4
6
  from __future__ import annotations
5
7
 
6
8
  from typing import Final
@@ -15,26 +17,48 @@ PRIORITIES: Final = [
15
17
  PRIORITY_LOW,
16
18
  PRIORITY_THIRDPARTY,
17
19
  ]
18
- STX: Final = 0x0F
19
- ETX: Final = 0x04
20
+
21
+
22
+ HEADER_LENGTH: Final = 4 # Header: [Start Byte, priority, address, RTR+data length]
23
+ TAIL_LENGTH: Final = 2 # Tail: [CRC, End Byte]
24
+ MAX_BODY_SIZE: Final = 8 # Maximum amount of data bytes in a packet
25
+
26
+ MINIMUM_MESSAGE_SIZE: Final = (
27
+ HEADER_LENGTH + TAIL_LENGTH
28
+ ) # Smallest possible packet: [Start Byte, priority, address, RTR+data length, CRC, End Byte]
29
+ MAXIMUM_MESSAGE_SIZE: Final = MINIMUM_MESSAGE_SIZE + MAX_BODY_SIZE
30
+
31
+ START_BYTE: Final = 0x0F
32
+ END_BYTE: Final = 0x04
33
+
34
+
20
35
  LENGTH_MASK: Final = 0x0F
21
- HEADER_LENGTH: Final = 4 # Header: [STX, priority, address, RTR+data length]
22
- MAX_DATA_AMOUNT: Final = 8 # Maximum amount of data bytes in a packet
23
- MIN_PACKET_LENGTH: Final = (
24
- 6 # Smallest possible packet: [STX, priority, address, RTR+data length, CRC, ETC]
25
- )
26
- MAX_PACKET_LENGTH: Final = MIN_PACKET_LENGTH + MAX_DATA_AMOUNT
36
+
27
37
  RTR: Final = 0x40
28
38
  NO_RTR: Final = 0x00
39
+
29
40
  CACHEDIR: Final = ".velbuscache"
30
- LOAD_TIMEOUT: Final = 600
41
+
42
+ # Module scan timeout values (in mSec)
43
+ SCAN_MODULETYPE_TIMEOUT: Final = 3000 # time to wait for ModuleTypeRequest
44
+ SCAN_MODULEINFO_TIMEOUT_INITIAL: Final = 1000 # time to wait for first info (status)
45
+ SCAN_MODULEINFO_TIMEOUT_INTERVAL: Final = (
46
+ 150 # time to wait for info interval (between next message)
47
+ )
31
48
 
32
49
  DEVICE_CLASS_ILLUMINANCE: Final = "illuminance"
33
50
  DEVICE_CLASS_TEMPERATURE: Final = "temperature"
34
51
  TEMP_CELSIUS: Final = "°C"
35
52
  ENERGY_KILO_WATT_HOUR: Final = "kWh"
36
53
  ENERGY_WATT_HOUR: Final = "Wh"
37
- VOLUME_CUBIC_METER: Final = "m3" # Not an official constant at HA yet
38
- VOLUME_CUBIC_METER_HOUR: Final = "m3/h" # Not an official constant at HA yet
54
+ VOLUME_CUBIC_METER: Final = "" # Not an official constant at HA yet
55
+ VOLUME_CUBIC_METER_HOUR: Final = "m³/h" # Not an official constant at HA yet
39
56
  VOLUME_LITERS: Final = "L"
40
57
  VOLUME_LITERS_HOUR: Final = "L/h" # Not an official constant at HA yet
58
+
59
+ CHANNEL_SELECTED_PROGRAM: Final = 96
60
+ CHANNEL_EDGE_LIT: Final = 97
61
+ CHANNEL_MEMO_TEXT: Final = 98
62
+ CHANNEL_LIGHT_VALUE: Final = 99
63
+
64
+ SLEEP_TIME = 60 / 1000