Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions custom_components/tekmar_482/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ async def async_init_tha(self) -> None:
while self._inSetup is True:
if len(self._tx_queue) != 0:
try:
await self._sock.write(self._tx_queue.pop(0))
writePacket = self._tx_queue.pop(0)
_LOGGER.debug(f"Setup {writePacket}")
await self._sock.write(writePacket)
await asyncio.sleep(0.1) # writing too fast causes errors
except Exception as e:
_LOGGER.error(f"Write error: {e}")
Expand All @@ -151,6 +153,8 @@ async def async_init_tha(self) -> None:
b = p.body
tha_method = name_from_methodID[h["methodID"]]

_LOGGER.debug(f"Setup {p}")

if tha_method in ["FirmwareRevision"]:
self._tha_fw_ver = b["revision"]

Expand Down Expand Up @@ -339,7 +343,9 @@ async def run(self) -> None:
)

if len(self._tx_queue) != 0:
await self._sock.write(self._tx_queue.pop(0))
writePacket = self._tx_queue.pop(0)
_LOGGER.debug(f"Run {writePacket}")
await self._sock.write(writePacket)
await asyncio.sleep(0.1)

readCycle += 1
Expand All @@ -362,6 +368,8 @@ async def run(self) -> None:
b = p.body
tha_method = name_from_methodID[h["methodID"]]

_LOGGER.debug(f"Run {p}")

if b["address"] in self.tha_ignore_addr:
_LOGGER.debug(f"Ignored {p} from address {b['address']}")
continue
Expand Down
Loading