From de3e056840dd3c34503517f6da6f2058ee026614 Mon Sep 17 00:00:00 2001 From: iloveicedgreentea <31193909+iloveicedgreentea@users.noreply.github.com> Date: Fri, 19 Apr 2024 11:07:23 -0400 Subject: [PATCH] fix command sync --- custom_components/jvc_projectors/manifest.json | 2 +- custom_components/jvc_projectors/remote.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_components/jvc_projectors/manifest.json b/custom_components/jvc_projectors/manifest.json index 48371b6..981a093 100644 --- a/custom_components/jvc_projectors/manifest.json +++ b/custom_components/jvc_projectors/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://github.com/iloveicedgreentea/jvc_homeassistant", "requirements": [ - "pyjvc==4.4.3" + "pyjvc==4.4.4" ], "ssdp": [], "zeroconf": [], diff --git a/custom_components/jvc_projectors/remote.py b/custom_components/jvc_projectors/remote.py index ba785ed..59166a0 100644 --- a/custom_components/jvc_projectors/remote.py +++ b/custom_components/jvc_projectors/remote.py @@ -208,6 +208,8 @@ async def handle_queue(self): ), timeout=5, ) + # when a command is sent it shifts the buffer by one, this seems to just be easier than figuring that out tbh + await self.jvc_client.commander.read_until_empty() except asyncio.TimeoutError: _LOGGER.debug("Timeout with command %s", command) try: @@ -277,7 +279,9 @@ async def clear_queue(self): # clear the queue _LOGGER.debug("Clearing command queue") self.command_queue = asyncio.PriorityQueue() - _LOGGER.debug("Cleared command queue which is now %s", self.command_queue.qsize()) + _LOGGER.debug( + "Cleared command queue which is now %s", self.command_queue.qsize() + ) _LOGGER.debug("Clearing attr queue") self.attribute_queue = asyncio.Queue()