velbus-aio 2023.2.0__tar.gz → 2023.5.0__tar.gz

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.

Files changed (116) hide show
  1. {velbus-aio-2023.2.0/velbus_aio.egg-info → velbus-aio-2023.5.0}/PKG-INFO +1 -1
  2. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/pyproject.toml +24 -2
  3. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0/velbus_aio.egg-info}/PKG-INFO +1 -1
  4. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbus_aio.egg-info/SOURCES.txt +1 -4
  5. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbus_aio.egg-info/top_level.txt +0 -1
  6. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/channels.py +38 -2
  7. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/handler.py +1 -1
  8. velbus-aio-2023.5.0/velbusaio/messages/edge_set_color.py +113 -0
  9. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/edge_set_custom_color.py +2 -2
  10. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/restore_dimmer.py +2 -1
  11. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/set_dimmer.py +2 -1
  12. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/module.py +6 -2
  13. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/raw_message.py +4 -4
  14. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/util.py +8 -5
  15. velbus-aio-2023.2.0/examples/discover.py +0 -14
  16. velbus-aio-2023.2.0/examples/load_modules.py +0 -33
  17. velbus-aio-2023.2.0/examples/read_bus.py +0 -35
  18. velbus-aio-2023.2.0/examples/read_cache.py +0 -12
  19. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/LICENSE +0 -0
  20. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/MANIFEST.in +0 -0
  21. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/README.md +0 -0
  22. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/requirements.txt +0 -0
  23. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/setup.cfg +0 -0
  24. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/setup.py +0 -0
  25. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbus_aio.egg-info/dependency_links.txt +0 -0
  26. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbus_aio.egg-info/not-zip-safe +0 -0
  27. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbus_aio.egg-info/requires.txt +0 -0
  28. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/__init__.py +0 -0
  29. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/command_registry.py +0 -0
  30. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/const.py +0 -0
  31. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/controller.py +0 -0
  32. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/discovery.py +0 -0
  33. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/exceptions.py +0 -0
  34. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/helpers.py +0 -0
  35. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/message.py +0 -0
  36. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/__init__.py +0 -0
  37. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/blind_status.py +0 -0
  38. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/bus_active.py +0 -0
  39. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/bus_error_counter_status.py +0 -0
  40. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/bus_error_counter_status_request.py +0 -0
  41. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/bus_off.py +0 -0
  42. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/channel_name_part1.py +0 -0
  43. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/channel_name_part2.py +0 -0
  44. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/channel_name_part3.py +0 -0
  45. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/channel_name_request.py +0 -0
  46. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/clear_led.py +0 -0
  47. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/counter_status.py +0 -0
  48. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/counter_status_request.py +0 -0
  49. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/cover_down.py +0 -0
  50. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/cover_off.py +0 -0
  51. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/cover_position.py +0 -0
  52. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/cover_up.py +0 -0
  53. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/dali_device_settings.py +0 -0
  54. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/dali_device_settings_request.py +0 -0
  55. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/dali_dim_value_status.py +0 -0
  56. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/dimmer_channel_status.py +0 -0
  57. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/dimmer_status.py +0 -0
  58. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/fast_blinking_led.py +0 -0
  59. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/forced_off.py +0 -0
  60. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/forced_on.py +0 -0
  61. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/interface_status_request.py +0 -0
  62. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/ir_receiver_status.py +0 -0
  63. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/kwh_status.py +0 -0
  64. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/light_value_request.py +0 -0
  65. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/memo_text.py +0 -0
  66. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/memory_data.py +0 -0
  67. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/memory_data_block.py +0 -0
  68. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/memory_dump_request.py +0 -0
  69. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/meteo_raw.py +0 -0
  70. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/module_status.py +0 -0
  71. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/module_status_request.py +0 -0
  72. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/module_subtype.py +0 -0
  73. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/module_type.py +0 -0
  74. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/module_type_request.py +0 -0
  75. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/push_button_status.py +0 -0
  76. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/read_data_block_from_memory.py +0 -0
  77. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/read_data_from_memory.py +0 -0
  78. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/realtime_clock_status_request.py +0 -0
  79. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/receive_buffer_full.py +0 -0
  80. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/receive_ready.py +0 -0
  81. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/relay_status.py +0 -0
  82. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/select_program.py +0 -0
  83. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/sensor_settings_request.py +0 -0
  84. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/sensor_temp_request.py +0 -0
  85. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/sensor_temperature.py +0 -0
  86. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/set_date.py +0 -0
  87. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/set_daylight_saving.py +0 -0
  88. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/set_led.py +0 -0
  89. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/set_realtime_clock.py +0 -0
  90. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/set_temperature.py +0 -0
  91. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/slider_status.py +0 -0
  92. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/slow_blinking_led.py +0 -0
  93. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/start_relay_blinking_timer.py +0 -0
  94. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/start_relay_timer.py +0 -0
  95. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/switch_relay_off.py +0 -0
  96. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/switch_relay_on.py +0 -0
  97. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/switch_to_comfort.py +0 -0
  98. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/switch_to_day.py +0 -0
  99. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/switch_to_night.py +0 -0
  100. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/switch_to_safe.py +0 -0
  101. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/temp_sensor_settings_part1.py +0 -0
  102. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/temp_sensor_settings_part2.py +0 -0
  103. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/temp_sensor_settings_part3.py +0 -0
  104. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/temp_sensor_settings_part4.py +0 -0
  105. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/temp_sensor_settings_request.py +0 -0
  106. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/temp_sensor_status.py +0 -0
  107. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/temp_set_cooling.py +0 -0
  108. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/temp_set_heating.py +0 -0
  109. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/update_led_status.py +0 -0
  110. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/very_fast_blinking_led.py +0 -0
  111. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/write_data_to_memory.py +0 -0
  112. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/write_memory_block.py +0 -0
  113. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/messages/write_module_address_and_serial_number.py +0 -0
  114. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/moduleprotocol/protocol.json +0 -0
  115. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/protocol.py +0 -0
  116. {velbus-aio-2023.2.0 → velbus-aio-2023.5.0}/velbusaio/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: velbus-aio
3
- Version: 2023.2.0
3
+ Version: 2023.5.0
4
4
  Summary: Open-source home automation platform running on Python 3.
5
5
  Author-email: Maikel Punie <maikel.punie@gmail.com>
6
6
  License: MIT
@@ -3,8 +3,8 @@ requires = ["setuptools", "wheel"]
3
3
 
4
4
  [project]
5
5
  name = "velbus-aio"
6
- version = "2023.2.0"
7
6
  license = {text = "MIT"}
7
+ version = "2023.5.0"
8
8
  description = "Open-source home automation platform running on Python 3."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -43,4 +43,26 @@ zip-safe = false
43
43
  include-package-data = true
44
44
 
45
45
  [tool.setuptools.packages.find]
46
- exclude = ["tests", "tests.*"]
46
+ exclude = ["tests", "tests.*", "examples"]
47
+
48
+ [tool.bumpver]
49
+ current_version = "2023.5.0"
50
+ version_pattern = "YYYY.MM.INC0"
51
+ commit_message = "bump version {old_version} -> {new_version}"
52
+ commit = true
53
+ tag = true
54
+ push = true
55
+
56
+ [tool.bumpver.file_patterns]
57
+ "pyproject.toml" = [
58
+ 'version = "{version}"',
59
+ 'current_version = "{version}"',
60
+ ]
61
+ "setup.py" = [
62
+ "{version}",
63
+ "{pep440_version}",
64
+ ]
65
+ "README.md" = [
66
+ "{version}",
67
+ "{pep440_version}",
68
+ ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: velbus-aio
3
- Version: 2023.2.0
3
+ Version: 2023.5.0
4
4
  Summary: Open-source home automation platform running on Python 3.
5
5
  Author-email: Maikel Punie <maikel.punie@gmail.com>
6
6
  License: MIT
@@ -4,10 +4,6 @@ README.md
4
4
  pyproject.toml
5
5
  requirements.txt
6
6
  setup.py
7
- examples/discover.py
8
- examples/load_modules.py
9
- examples/read_bus.py
10
- examples/read_cache.py
11
7
  velbus_aio.egg-info/PKG-INFO
12
8
  velbus_aio.egg-info/SOURCES.txt
13
9
  velbus_aio.egg-info/dependency_links.txt
@@ -51,6 +47,7 @@ velbusaio/messages/dali_device_settings_request.py
51
47
  velbusaio/messages/dali_dim_value_status.py
52
48
  velbusaio/messages/dimmer_channel_status.py
53
49
  velbusaio/messages/dimmer_status.py
50
+ velbusaio/messages/edge_set_color.py
54
51
  velbusaio/messages/edge_set_custom_color.py
55
52
  velbusaio/messages/fast_blinking_led.py
56
53
  velbusaio/messages/forced_off.py
@@ -1,3 +1,2 @@
1
1
  dist
2
- examples
3
2
  velbusaio
@@ -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
- # def get_categories(self):
706
- # return ["light"]
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):
@@ -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 (self._velbus.get_module(msg.address)).on_message(msg)
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(
@@ -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: VMB4RYLD
16
+ received by: VMBEL1, VMBEL2, VMBEL4, VMBELO
17
17
  """
18
18
 
19
19
  def __init__(self, address=None):
@@ -59,5 +59,6 @@ class RestoreDimmerMessage2(RestoreDimmerMessage):
59
59
  return [byte]
60
60
 
61
61
  def channels_to_byte(self, channels: list[int]) -> int:
62
- assert len(channels) == 1
62
+ if len(channels) != 1:
63
+ raise ValueError("We should have exact one channel")
63
64
  return channels[0]
@@ -67,5 +67,6 @@ class SetDimmerMessage2(SetDimmerMessage):
67
67
  return [byte]
68
68
 
69
69
  def channels_to_byte(self, channels) -> int:
70
- assert len(channels) == 1
70
+ if len(channels) != 1:
71
+ raise ValueError("We should have exact one channel")
71
72
  return channels[0]
@@ -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
- assert "No subaddresses defined"
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(channel, {"closed": False})
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)
@@ -78,10 +78,10 @@ class ParseError(Exception):
78
78
 
79
79
 
80
80
  def _parse(rawmessage: bytearray) -> Tuple[Optional[RawMessage], bytearray]:
81
- assert (
82
- MINIMUM_MESSAGE_SIZE <= len(rawmessage) <= MAXIMUM_MESSAGE_SIZE
83
- ), "Received a raw message with an illegal length"
84
- assert rawmessage[0] == START_BYTE
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:
@@ -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
- assert len(data) >= MINIMUM_MESSAGE_SIZE - 2
10
- assert len(data) <= MAXIMUM_MESSAGE_SIZE - 2
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
- assert 0 <= idx < 8
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
- assert 0 <= idx < 8
43
- assert isinstance(value, bool)
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
 
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env python
2
-
3
- import asyncio
4
-
5
- from velbusaio.discovery import VelbusDiscoveryProtocol
6
-
7
- loop = asyncio.get_event_loop()
8
- coro = loop.create_datagram_endpoint(
9
- lambda: VelbusDiscoveryProtocol(("192.168.1.255", 32767)),
10
- local_addr=("0.0.0.0", 1900),
11
- )
12
- loop.run_until_complete(coro)
13
- loop.run_forever()
14
- loop.close()
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env python
2
-
3
- import argparse
4
- import asyncio
5
- import logging
6
- import sys
7
-
8
- from velbusaio.controller import Velbus
9
-
10
- parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
11
- parser.add_argument("--connect", help="Connection string", default="192.168.1.254:8445")
12
- args = parser.parse_args()
13
-
14
-
15
- async def main(connect_str: str):
16
- # SET THE connection params below
17
- # example via signum:
18
- # velbus = Velbus("tls://192.168.1.9:27015")
19
- # example via plain IP
20
- # velbus = Velbus("192.168.1.9:27015")
21
- # example via serial device
22
- # velbus = Velbus("/dev/ttyAMA0")
23
- velbus = Velbus(connect_str)
24
- await velbus.connect()
25
- for mod in (velbus.get_modules()).values():
26
- print(mod)
27
- print("")
28
- await velbus.stop()
29
-
30
-
31
- logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
32
- logging.getLogger("asyncio").setLevel(logging.DEBUG)
33
- asyncio.run(main(args.connect), debug=False)
@@ -1,35 +0,0 @@
1
- #!/usr/bin/env python
2
-
3
- import argparse
4
- import asyncio
5
- import logging
6
- import sys
7
-
8
- from velbusaio.controller import Velbus
9
-
10
- parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
11
- parser.add_argument(
12
- "--connect", help="Connection string", default="tls://192.168.1.9:27015"
13
- )
14
- args = parser.parse_args()
15
-
16
-
17
- async def main(connect_str: str):
18
- # SET THE connection params below
19
- # example via signum:
20
- # velbus = Velbus("tls://192.168.1.9:27015")
21
- # example via plain IP
22
- # velbus = Velbus("192.168.1.9:27015")
23
- # example via serial device
24
- # velbus = Velbus("/dev/ttyAMA0")
25
- velbus = Velbus(connect_str)
26
- await velbus.connect()
27
- for mod in (velbus.get_modules()).values():
28
- print(mod)
29
- print("")
30
- await asyncio.sleep(6000000000)
31
-
32
-
33
- logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
34
- logging.getLogger("asyncio").setLevel(logging.DEBUG)
35
- asyncio.run(main(args.connect), debug=False)
@@ -1,12 +0,0 @@
1
- import pickle
2
- from os import listdir
3
- from os.path import isfile, join
4
-
5
- from velbusaio.const import CACHEDIR
6
- from velbusaio.helpers import get_cache_dir
7
-
8
- for fil in [f for f in listdir(get_cache_dir()) if isfile(join(get_cache_dir(), f))]:
9
- print("")
10
- print(fil)
11
- fl = open(f"{get_cache_dir()}/{fil}", "rb")
12
- print(pickle.load(fl))
File without changes
File without changes
File without changes
File without changes
File without changes