Skip to content

Commit 429759b

Browse files
committed
Update to work with fw 1.064
Signed-off-by: Benjamin Davis <[email protected]>
1 parent b788ad6 commit 429759b

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

custom_components/intellicenter/pyintellicenter/controller.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ async def start(self):
327327
query.append(items)
328328
numAttributes += len(items["keys"])
329329
# a query too large can choke the protocol...
330-
# we split them in maximum of 250 attributes (arbitrary but seems to work)
330+
# we split them in maximum of 50 attributes (arbitrary but seems to work)
331331
if numAttributes >= 50:
332332
res = await self.sendCmd("RequestParamList", {"objectList": query})
333333
self._applyUpdates(res["objectList"])

custom_components/intellicenter/pyintellicenter/protocol.py

-24
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ def __init__(self, controller):
4141
self._out_pending = 0
4242
self._out_queue = SimpleQueue()
4343

44-
# the coroutine for sending regular 'ping' to IntelliCenter
45-
self._heartbeat = None
4644
# and the number of unacknowledgged ping issued
4745
self._num_unacked_pings = 0
4846

@@ -52,19 +50,12 @@ def connection_made(self, transport):
5250
self._transport = transport
5351
self._msgID = 1
5452

55-
# start a task to send 'ping' every 30s
56-
self._heartbeat = asyncio.create_task(self.heartbeat())
57-
5853
# and notify our controller that we are ready!
5954
self._controller.connection_made(self, transport)
6055

6156
def connection_lost(self, exc):
6257
"""Handle the callback for connection lost."""
6358

64-
if self._heartbeat:
65-
self._heartbeat.cancel()
66-
self._heartbeat = None
67-
6859
self._controller.connection_lost(exc)
6960

7061
def data_received(self, data) -> None:
@@ -181,18 +172,3 @@ def processMessage(self, message: str) -> None:
181172

182173
except Exception as err:
183174
_LOGGER.error(f"PROTOCOL: exception while receiving message {err}")
184-
185-
async def heartbeat(self):
186-
"""Send a ping every 10s to keep and check that the connection is alive."""
187-
188-
while self._num_unacked_pings < 2:
189-
# we sleep first as there is no need for an immediate ping upon connection
190-
await asyncio.sleep(10)
191-
_LOGGER.debug("PROTOCOL: sending ping")
192-
self.sendRequest("ping")
193-
self._num_unacked_pings += 1
194-
195-
# if we already have sent 2 pings without a pong
196-
# we assume the connection went dead and abort
197-
_LOGGER.error("PROTOCOL: heartbeat missed, closing connection")
198-
self._transport.close()

0 commit comments

Comments
 (0)