bezmi / homeassistant_jvc_projector_remote

Custom components for homeassistant
Apache License 2.0
14 stars 11 forks source link

Detected Blocking Call to Sleep inside the Event Loop - Seeing this after upgrading to 2022.11.0 #16

Closed ziptbm closed 1 year ago

ziptbm commented 1 year ago

I'm not sure about the impact of this issue yet, but reporting what I'm seeing per the logs.

Logger: homeassistant.util.async Source: util/async.py:180 First occurred: 00:09:41 (1 occurrences) Last logged: 00:09:41

Detected blocking call to sleep inside the event loop. This is causing stability issues. Please report issue to the custom integration author for jvcprojector doing blocking calls at custom_components/jvcprojector/remote.py, line 102: self._power_state = self._jvc.power_state()

bezmi commented 1 year ago

Hi, it looks like you're on the "v1.0.2 Stable". Please use version 2.0.0 alpha 2. See this community post for info on how to install. The "detected blocking call" issue should go away after that.

ziptbm commented 1 year ago

@bezmi is the 2.0 alpha ready for use? I want to say that I did an upgrade a few months ago and found it broke all of my automation and ended up having to do an HA restore in order to get access back to the older version, so I'm super hesitant to upgrade until it's ready.

bezmi commented 1 year ago

Yes, if the current versions work for you, then 2.0a2 should work also, but as you noted, things will break due to the command format being a bit different. It's not that different though, and well documented in the README (I believe). I wrote v2.0 with much more robustness and debugging in mind and so far it has worked really well in that regard. Subsequent updates to the add-on will try to keep compatibility with the v2 format so nothing should break further.

ziptbm commented 1 year ago

@bezmi - so I upgrade to the 2.0a2 and 2022.11.1 at the same time and now I'm seeing the following. Would you like me to start a new issue?

This error originated from a custom integration.

Logger: homeassistant.helpers.entity Source: custom_components/jvcprojector/remote.py:197 Integration: jvcprojector (documentation) First occurred: 22:11:15 (2 occurrences) Last logged: 22:11:45

Update for remote.jvc_sauce fails Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 527, in async_update_ha_state await self.async_device_update() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 722, in async_device_update raise exc File "/config/custom_components/jvcprojector/remote.py", line 88, in async_update await self.async_update_state() File "/config/custom_components/jvcprojector/remote.py", line 206, in async_update_state raise e File "/config/custom_components/jvcprojector/remote.py", line 197, in async_update_state self._picture_mode_state = await self.hass.async_add_executor_job( File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 202, in command return self._send_command(getattr(Commands, commandl[0])) File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvcprojector.py", line 167, in _send_command result = command.read(jvc_sock) File "/usr/local/lib/python3.10/site-packages/jvc_projector_remote/jvccommands.py", line 212, in read return self.read_valsinv[resp] KeyError: b'0B'

bezmi commented 1 year ago

So the error is caused by an unknown picture mode. Can you tell me the model of your projector and the current picture mode that it is set to when this error appears?

bezmi commented 1 year ago

I've added an issue here: #17 to track missing commands. I believe in your case it is the 'Frame Adapt HDR' picture mode that is missing. Over my free time on the weekend I will go through the latest specifications and add these to the python library, as well as better error handling code (#18) to the homeassistant component so it doesn't poop itself when there are missing commands!

bezmi commented 1 year ago

closing this in as discussion moved to #17