rrooggiieerr / homeassistant-benqprojector

Home Assistant integration for BenQ projectors over the serial (and network?) interface.
Apache License 2.0
22 stars 1 forks source link

Please update to newest stable release of benqprojector.py #11

Closed LaneaLucy closed 7 months ago

LaneaLucy commented 9 months ago

0.0.7 has problems with response handling for me because of echo. newest version from pip works greate outside the home assistant integration. pre-release of ha integration throws error "ModuleNotFoundError: No module named 'benqprojector.configs'" after getting model.

2023-10-26 13:35:44.624 ERROR (MainThread) [benqprojector.benqprojector] Unexpected response: b'\r' 2023-10-26 13:35:44.625 ERROR (MainThread) [benqprojector.benqprojector] Unexpected response: b'\n' 2023-10-26 13:35:44.625 DEBUG (MainThread) [benqprojector.benqprojector] command *modelname=?# 2023-10-26 13:35:44.640 DEBUG (MainThread) [benqprojector.benqprojector] Response: *modelname=?# 2023-10-26 13:35:44.640 DEBUG (MainThread) [benqprojector.benqprojector] Command successfully send 2023-10-26 13:35:44.642 DEBUG (MainThread) [benqprojector.benqprojector] Response: MODELNAME=MW519 2023-10-26 13:35:44.642 DEBUG (MainThread) [benqprojector.benqprojector] LC Response: modelname=mw519 2023-10-26 13:35:44.642 DEBUG (MainThread) [benqprojector.benqprojector] Raw response: 'modelname=mw519' 2023-10-26 13:35:44.642 DEBUG (MainThread) [benqprojector.benqprojector] Processed response: mw519 2023-10-26 13:35:44.644 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry BenQ ? /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A50285BI-if00-port0 for benqprojector Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/benqprojector/__init__.py", line 190, in async_setup_entry await projector_coordinator.connect() File "/config/custom_components/benqprojector/__init__.py", line 78, in connect if not self.projector.connect(): ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/benqprojector/benqprojector.py", line 224, in connect with importlib.resources.open_text("benqprojector.configs", "all.json") as file: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/resources/_legacy.py", line 25, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/resources/_legacy.py", line 63, in open_text return (_common.files(package) / normalize_path(resource)).open( ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/resources/_common.py", line 22, in files return from_package(get_package(package)) ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/resources/_common.py", line 53, in get_package resolved = resolve(package) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/resources/_common.py", line 44, in resolve return cand if isinstance(cand, types.ModuleType) else importlib.import_module(cand) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 1204, in _gcd_import File "<frozen importlib._bootstrap>", line 1176, in _find_and_load File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked ModuleNotFoundError: No module named 'benqprojector.configs'

rrooggiieerr commented 7 months ago

I just released a new version, let me know if it solves your problems

LaneaLucy commented 7 months ago

Command macaddr=? not supported Unexpected response: b'\r\n' Command *ltim2=?# unsupported item

That's are the error's the integration still throws

rrooggiieerr commented 7 months ago

Ok, could be that macaddr and ltim2 is indeed not supported by your projector because it doesn't have a network connection and doesn't contains a second light. But the rest of the integration is working for you? You can control the projector from within HA?

LaneaLucy commented 7 months ago

Yes, I already could with master before. But the errors are filling my logs full. When switched on even more:

Command pow=?# blocked item Command pp=?# blocked item Command ltim=?# blocked item Command ltim2=?# blocked item Command *color=?# blocked item

Command keyst=?# unsupported item Command ltim2=?# unsupported item Command autopower=?# unsupported item Command standbynet=?# unsupported item Command *standbymic=?# unsupported item

LaneaLucy commented 7 months ago

Maybe you could first ignore \r\n response and then make a function that remembers what is unsupported

LaneaLucy commented 7 months ago

And make all this errors warnings instead

rrooggiieerr commented 7 months ago

Well, actually you can submit which commands are supported by your projector to the underlying benqprojector library. Instructions are on that page

rrooggiieerr commented 7 months ago

You can also disable the corresponding entities in HA and the messages for those unsupported commands should disappear.

LaneaLucy commented 7 months ago

Well, actually you can submit which commands are supported by your projector to the underlying benqprojector library. Instructions are on that page

done

rrooggiieerr commented 7 months ago

I'm guessing the integration now works for you? So I'm closing this issue

LaneaLucy commented 7 months ago

Today I found out, that video source drop-down is missing. And other settings the benq supports are visible in benqprojector python library but not in the ha integration. And when I try to change for example contrast or brightness, everything gets unavailable for around 15-30 seconds.

Also: Command *color=?# blocked item

Too busy to send audiosour=? Too busy to send appmod=? Too busy to send ct=? Too busy to send asp=? Too busy to send lampm=? (Never tried to set them)

Unknown power status: None

Unexpected response format, response: o=# vol=10# Unexpected response format, response: lan=# blank=off# Unexpected response format, response: audoor? Unexpected response format, response: c# Unexpected response format, response: oor?

Unexpected response: b'coo=\r\n' Unexpected response: b'cn?\r\n' Unexpected response: b'>\x00' Unexpected response: b'SAP1#\n' Unexpected response: b'Illegal format\r\n'

rrooggiieerr commented 6 months ago

I also faced some issues with my own projector. There happened to be an error in the library which I now fixed and the new release seems to work fine for me. Give it a try

LaneaLucy commented 6 months ago

Unexpected response: b'>\x00'

11 occurrences

Command pow=?# blocked item Command pp=?# blocked item Command *ltim=?# blocked item

48 occurrences

Unexpected error fetching custom_components.benqprojector data: '<=' not supported between instances of 'float' and 'NoneType' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 300, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/benqprojector/init.py", line 211, in _async_update_data if not await self.hass.async_add_executor_job(self.projector.update_power): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/benqprojector/benqprojector.py", line 844, in update_power and (time.time() - self._power_timestamp) <= self._poweron_time ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: '<=' not supported between instances of 'float' and 'NoneType'

And everything just from switching on. And after switching on, everything got unavailable....

LaneaLucy commented 6 months ago

After re adding the integration, I can at least use it to control again, but there are still all the settings missing like video source....

rrooggiieerr commented 6 months ago

I don't have the model you have, so can't do any testing since it works for me. I think you have to do a bit more research yourself and try the benqprojector library to see what's going on with your projector

LaneaLucy commented 6 months ago

The library sees everything but the ha integration don't show everything. At least for the options.... The errors I need to figure later, but right now, after the last release, where there is a profile now for my device, the ha integration don't show options anymore, that the beamer supports like selecting video source or enable/disable auto video source switching