Skip to content

Commit

Permalink
Fix vmb1ts and vmbtc modules (#17)
Browse files Browse the repository at this point in the history
* Fix parsing of VMB1TS module

* More fixes for old modules types

* Ignore vmb1ts module for name loading

* Black fixes, bump version
  • Loading branch information
cereal2nd authored Oct 21, 2021
1 parent 43a7d81 commit e8f9b41
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="velbus-aio",
version="2021.10.2",
version="2021.10.3",
url="https://github.com/Cereal2nd/velbus-aio",
license="MIT",
author="Maikel Punie",
Expand Down
3 changes: 2 additions & 1 deletion velbusaio/messages/module_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
0x08: "VMB4RY",
0x09: "VMB2BL",
0x0C: "VMB1TS",
0x0D: "VMB1TH",
0x0E: "VMB1TC",
0x0F: "VMB1LED",
0x14: "VMBDME",
}
Expand Down Expand Up @@ -55,7 +57,6 @@ def populate(self, priority, address, rtr, data):
"""
self.needs_low_priority(priority)
self.needs_no_rtr(rtr)
self.needs_data(data, 4)
self.set_attributes(priority, address, rtr)
self.module_type = data[0]
if data[0] not in MODULES_WITHOUT_SERIAL:
Expand Down
4 changes: 4 additions & 0 deletions velbusaio/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,10 @@ async def __load_memory(self) -> None:
self._name = None
return

if self._type == 0x0C:
self._name = None
return

for _memory_key, memory_part in self._data["Memory"].items():
if "Address" in memory_part:
for addr_int in memory_part["Address"].keys():
Expand Down
16 changes: 8 additions & 8 deletions velbusaio/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ def buffer_updated(self, nbytes: int) -> None:
Called when asyncio.BufferedProtocol detects received data from network.
"""
self._buffer_pos += nbytes
self._log.debug(
"Received {nbytes} bytes from Velbus: {data_hex}".format(
nbytes=nbytes,
data_hex=binascii.hexlify(
self._buffer[self._buffer_pos - nbytes : self._buffer_pos], " "
),
)
)
# self._log.debug(
# "Received {nbytes} bytes from Velbus: {data_hex}".format(
# nbytes=nbytes,
# data_hex=binascii.hexlify(
# self._buffer[self._buffer_pos - nbytes : self._buffer_pos], " "
# ),
# )
# )

if self._buffer_pos > MINIMUM_MESSAGE_SIZE:
# try to construct a Velbus message from the buffer
Expand Down

0 comments on commit e8f9b41

Please sign in to comment.