rrooggiieerr / benqprojector.py

Python library to control BenQ projectors over the serial (and network?) interface
Apache License 2.0
10 stars 6 forks source link

"Failed to connect" error #26

Open manwithpowers opened 1 week ago

manwithpowers commented 1 week ago

I'm trying to connect my BenQ W700 projector via this integration and keep getting a "Failed to connect" error. In the logs all I see is Failed to get projector command prompt, is your projector properly connected? (Looks like this is the source of the error Source: custom_components/benqprojector/config_flow.py:157)

I have tested using minicom and I'm able to communicate with the projector (on, off, modelname), I've made sure the baud rate is the same on the projector as I'm entering here, and I've tested with the projector both on and off already.

The one thing that sticks out to me is that it's timing out very quickly - almost immediately after clicking "Submit" when adding the projector, I get the above error.

Let me know if there's any other info I can provide to help troubleshoot this and thanks in advance for any help!

Screenshot 2024-10-27 at 18 08 29
rrooggiieerr commented 1 week ago

Can you show me a screenshot of the minicom session?

manwithpowers commented 1 week ago

Sure thing:

Screenshot 2024-10-27 at 18 49 55

I also tested using benqprojector.py directly and got this

Screenshot 2024-10-27 at 18 54 36
rrooggiieerr commented 1 week ago

Ok, minicom output looks exactly like it should

Can you add the --debug argument to the benqprojector CLI?

rrooggiieerr commented 1 week ago

Sorry, getting back to the minicom output, it actually doesn't look like it should. I'm expecting to see *POW=ON# and *MODELNAME=W700# returned on the commands

manwithpowers commented 1 week ago

Here's the debug output:

Screenshot 2024-10-27 at 19 11 42

Minicom does actually show *POW=ON# response but for whatever reason in my terminal that gets overwritten when I type a new line (here it is on it's own):

Screenshot 2024-10-27 at 19 12 16

Response to *modelname=?# is however just W700

Thanks for the quick replies!

rrooggiieerr commented 1 week ago

Is the warning message consistent when you run the benqprojector CLI command a couple of times?

manwithpowers commented 1 week ago

It's now slightly different than that first run using --debug but is now consistent:

Screenshot 2024-10-27 at 19 28 51
rrooggiieerr commented 1 week ago

Are you sure the baudrate is correct? You can find the baudrate in the on screen menu of your projector

manwithpowers commented 1 week ago

Yes, it's definitely correct IMG20241027193501

rrooggiieerr commented 1 week ago

Can you set it higher and see if that helps? Maybe there is indeed a timeout in the code that exceeds with low baud rates. I run my serial connection on 115200 baud

manwithpowers commented 1 week ago

Yeah, 115200 is what I had mine set to originally, as well. I dropped it down based on some feedback I got elsewhere when I was just testing the cable. Tested again at 115200 and at 57600 a few times and unfortunately still no dice:

Screenshot 2024-10-27 at 20 03 16
rrooggiieerr commented 1 week ago

Could you try from a different machine?

manwithpowers commented 1 week ago

Using benqprojector CLI? Yeah, I can give that a shot from my laptop tomorrow. I tested the cable and projector connection using my laptop & minicom first so I know that part works. Thanks for all the help!

manwithpowers commented 1 week ago

Unfortunately, benqprojector CLI also doesn't work from my laptop (tried a few different commands - the first two are with the projector off, the rest the projector was on). As mentioned earlier, I am able to connect to the projector using minicom or screen on this machine.

Screenshot 2024-10-28 at 12 51 29
rrooggiieerr commented 1 week ago

Ok, I think the problem here is the \x00 after the prompt which I haven't seen before in other BenQ projectors. I need to think about this.

manwithpowers commented 1 week ago

No problem. Also happy to take a stab at it sometime next month, though my python is admittedly a bit rusty. Thanks again for taking a look.

rrooggiieerr commented 1 week ago

If you'r comfortable with changing some code for testing then try the following:

In the _wait_for_prompt method in benqprojector/benqprojector.py add response = response.strip(b"\x00") after response = await self.connection.read(100), like so:

     async def _wait_for_prompt(self) -> bool:
        # Clean input buffer
        await self.connection.reset()

        if not self._has_to_wait_for_prompt:
            await self.connection.write(b"\r")
            await self.connection.read(1)
            return True

        start_time = datetime.now()
        while True:
            response = await self.connection.read(100)
            response = response.strip(b"\x00")
            if response == b"":
                await self.connection.write(b"\r")
            elif response[-1:] == b">":
                self._has_to_wait_for_prompt = False
                return True
            elif response.strip(WHITESPACE.encode()) == b"":
                pass
            elif response.strip(WHITESPACE.encode()) == b">":
                pass
            else:
                logger.warning("Unexpected response: %s", response)

            if (datetime.now() - start_time).total_seconds() > 1:
                raise PromptTimeoutError()

            await asyncio.sleep(0.05)

        return False
manwithpowers commented 1 week ago

Cheers, thanks for that. I was able to give this a try tonight (also discovered my macbook had an older version of python3, so I had only able to install an older version of benqprojector, after updating to python3.13 i was able to get the latest version - that alone however didn't fix anything). Stripping the strange characters from the projector's response definitely got somewhere, however it looks like it's also returning something unfamiliar with its modelname:

(venv) ****@**** bin % python3.13 -m benqprojector serial /dev/tty.PL2303G-USBtoUART1110 115200 status --debug
2024-10-28 18:10:03,348 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 18:10:03,348 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 18:10:03,348 INFO     benqprojector.py:307 Connecting to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 18:10:03,879 DEBUG    benqprojector.py:309 Connected to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 18:10:04,936 ERROR    benqprojector.py:349 Failed to get projector command prompt, is your projector properly connected?
2024-10-28 18:10:04,937 ERROR    __main__.py:32 Failed to connect to BenQ projector
(venv) ****@**** bin % python3.13 -m benqprojector serial /dev/tty.PL2303G-USBtoUART1110 115200 status --debug
2024-10-28 18:11:41,625 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 18:11:41,625 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 18:11:41,625 INFO     benqprojector.py:307 Connecting to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 18:11:42,164 DEBUG    benqprojector.py:309 Connected to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 18:11:42,250 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 18:11:42,252 DEBUG    benqprojector.py:723 Response: *pow=#
2024-10-28 18:11:42,252 WARNING  benqprojector.py:646 No command echo received
2024-10-28 18:11:42,252 DEBUG    benqprojector.py:774 Processed response: 
2024-10-28 18:11:42,264 DEBUG    benqprojector.py:743 command *modelname=?#
2024-10-28 18:11:42,264 DEBUG    benqprojector.py:723 Response: 
2024-10-28 18:11:42,265 DEBUG    benqprojector.py:608 Empty line
2024-10-28 18:11:42,276 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,338 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,399 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,462 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,524 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,586 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,649 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,712 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,774 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,836 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,899 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:42,962 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,024 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,088 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,151 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,213 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,275 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,338 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,401 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,463 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,524 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,587 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,649 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,712 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 18:11:43,763 DEBUG    benqprojector.py:723 Response: >*modelname=?#W700
2024-10-28 18:11:43,764 ERROR    benqprojector.py:767 Unexpected response format, response: >*modelname=?#w700
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/****/temp/venv/lib/python3.13/site-packages/benqprojector/__main__.py", line 143, in <module>
    asyncio.run(main(projector, args.action))
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 721, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/Users/****/temp/venv/lib/python3.13/site-packages/benqprojector/__main__.py", line 31, in main
    if not await projector.connect():
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/****/temp/venv/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 366, in connect
    model = await self._send_command("modelname")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/****/temp/venv/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 649, in _send_command
    return self._parse_response(command, action, _command, response)
           ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/****/temp/venv/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 768, in _parse_response
    raise InvallidResponseError(command, action, response)
benqprojector.benqprojector.InvallidResponseError: Invalid response for command 'modelname' and action '?'. response: >*modelname=?#w700

Unfortunately, I'm definitely not strong enough with regex to be able to parse what's expected and what my projector is sending that's not expected, though I suspect it's the >?

rrooggiieerr commented 1 week ago

For testing you could change the line model = await self._send_command("modelname") to model = None

rrooggiieerr commented 1 week ago

Sorry, that won't work. You can replace except IllegalFormatError as ex: for except (IllegalFormatError, InvallidResponseError) as ex: just after assert model is not None, "Failed to retrieve projector model"

manwithpowers commented 1 week ago

Thanks. That looks to have done it (at least in terms of benqprojector CLI not erroring out):

(venv) ****@**** bin % python3.13 -m benqprojector serial /dev/tty.PL2303G-USBtoUART1110 115200 status --debug
2024-10-28 20:15:58,950 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 20:15:58,950 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 20:15:58,950 INFO     benqprojector.py:307 Connecting to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 20:15:59,486 DEBUG    benqprojector.py:309 Connected to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 20:15:59,571 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 20:15:59,573 DEBUG    benqprojector.py:723 Response: *pow=?#
2024-10-28 20:15:59,573 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:15:59,584 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:15:59,646 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:15:59,709 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:15:59,771 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:15:59,834 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:15:59,896 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:15:59,959 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,021 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,083 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,146 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,209 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,271 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,334 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,397 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,459 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,522 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,584 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,646 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,709 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,771 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,834 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,896 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:00,959 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,021 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,084 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,146 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,208 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,271 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,333 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,395 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,457 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,520 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,583 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,645 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,708 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,770 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,833 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,896 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:01,958 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,021 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,084 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,146 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,209 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,272 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,335 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,397 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,460 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,523 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,585 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,648 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,711 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,773 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,836 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,899 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:02,962 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,024 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,087 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,150 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,212 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,275 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,338 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,401 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,463 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,526 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,588 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,650 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,712 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,774 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,836 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,899 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:03,962 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,024 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,087 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,150 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,212 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,275 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,337 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,399 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,462 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,525 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,582 DEBUG    benqprojector.py:723 Response: *POW=OFF#
2024-10-28 20:16:04,582 DEBUG    benqprojector.py:774 Processed response: off
2024-10-28 20:16:04,594 DEBUG    benqprojector.py:743 command *modelname=?#
2024-10-28 20:16:04,595 DEBUG    benqprojector.py:723 Response: 
2024-10-28 20:16:04,595 DEBUG    benqprojector.py:608 Empty line
2024-10-28 20:16:04,606 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,668 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,731 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,792 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,854 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,917 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:04,980 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,043 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,105 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,168 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,231 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,294 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,356 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,419 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,482 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,544 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,607 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,669 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,731 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,793 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,855 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,917 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:05,980 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:06,042 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:06,094 DEBUG    benqprojector.py:723 Response: >*modelname=?#W700
2024-10-28 20:16:06,094 WARNING  benqprojector.py:646 No command echo received
2024-10-28 20:16:06,094 ERROR    benqprojector.py:767 Unexpected response format, response: >*modelname=?#w700
2024-10-28 20:16:06,094 ERROR    benqprojector.py:371 Unable to retrieve projector model
2024-10-28 20:16:06,098 INFO     benqprojector.py:415 Device on /dev/tty.PL2303G-USBtoUART1110 available
2024-10-28 20:16:06,112 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 20:16:06,122 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:06,173 DEBUG    benqprojector.py:723 Response: *pow=?#
2024-10-28 20:16:06,173 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:16:06,173 DEBUG    benqprojector.py:723 Response: *POW=OFF#
2024-10-28 20:16:06,173 DEBUG    benqprojector.py:774 Processed response: off
2024-10-28 20:16:06,189 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 20:16:06,199 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:16:06,250 DEBUG    benqprojector.py:723 Response: *pow=?#
2024-10-28 20:16:06,251 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:16:06,251 DEBUG    benqprojector.py:723 Response: *POW=OFF#
2024-10-28 20:16:06,251 DEBUG    benqprojector.py:774 Processed response: off
2024-10-28 20:16:06,251 INFO     __main__.py:39 Model: None
2024-10-28 20:16:06,251 INFO     __main__.py:40 Position: None
2024-10-28 20:16:06,251 INFO     __main__.py:42 Power off
2024-10-28 20:16:06,251 INFO     __main__.py:46 Direct power on  : None
2024-10-28 20:16:06,251 INFO     __main__.py:52 Lamp time        : None hours
2024-10-28 20:16:06,251 INFO     __main__.py:72 Supported video sources: []
2024-10-28 20:16:06,251 INFO     __main__.py:101 Disconnecting from BenQ projector
2024-10-28 20:16:07,767 DEBUG    benqconnection.py:76 Connection closed

Running the on action however doesn't power the projector on. I can hear the projector click on when it receives the pow=on command and the fan begin to spin up but then it stops.

(venv) ****@**** bin % python3.13 -m benqprojector serial /dev/tty.PL2303G-USBtoUART1110 115200 on --debug    
2024-10-28 20:18:31,317 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 20:18:31,317 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 20:18:31,317 INFO     benqprojector.py:307 Connecting to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 20:18:31,854 DEBUG    benqprojector.py:309 Connected to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 20:18:31,939 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 20:18:31,941 DEBUG    benqprojector.py:723 Response: *pow=?#
2024-10-28 20:18:31,942 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:18:31,954 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,016 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,078 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,140 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,201 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,264 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,326 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,389 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,451 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,513 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,576 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,639 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,701 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,764 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,827 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,890 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:32,952 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,015 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,077 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,139 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,202 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,264 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,327 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,389 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,451 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,514 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,577 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,639 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,701 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,764 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,827 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,890 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:33,951 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,014 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,076 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,139 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,201 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,264 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,326 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,389 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,451 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,513 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,576 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,639 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,702 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,765 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,828 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,890 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:34,953 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,014 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,077 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,139 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,201 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,263 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,326 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,389 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,450 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,513 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,576 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,639 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,702 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,764 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,827 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,890 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:35,952 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,015 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,077 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,140 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,203 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,266 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,328 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,391 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,454 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,517 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,580 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,643 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,706 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,768 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,830 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,893 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:36,948 DEBUG    benqprojector.py:723 Response: *POW=OFF#
2024-10-28 20:18:36,949 DEBUG    benqprojector.py:774 Processed response: off
2024-10-28 20:18:36,961 DEBUG    benqprojector.py:743 command *modelname=?#
2024-10-28 20:18:36,962 DEBUG    benqprojector.py:723 Response: 
2024-10-28 20:18:36,962 DEBUG    benqprojector.py:608 Empty line
2024-10-28 20:18:36,973 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,036 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,099 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,161 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,223 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,286 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,349 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,411 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,474 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,536 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,598 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,660 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,723 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,786 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,848 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,910 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:37,974 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,036 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,098 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,161 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,224 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,287 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,348 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,410 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,462 DEBUG    benqprojector.py:723 Response: >*modelname=?#W700
2024-10-28 20:18:38,462 WARNING  benqprojector.py:646 No command echo received
2024-10-28 20:18:38,462 ERROR    benqprojector.py:767 Unexpected response format, response: >*modelname=?#w700
2024-10-28 20:18:38,462 ERROR    benqprojector.py:371 Unable to retrieve projector model
2024-10-28 20:18:38,465 INFO     benqprojector.py:415 Device on /dev/tty.PL2303G-USBtoUART1110 available
2024-10-28 20:18:38,478 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 20:18:38,491 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,542 DEBUG    benqprojector.py:723 Response: *pow=?#
2024-10-28 20:18:38,543 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:18:38,543 DEBUG    benqprojector.py:723 Response: *POW=OFF#
2024-10-28 20:18:38,543 DEBUG    benqprojector.py:774 Processed response: off
2024-10-28 20:18:38,557 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 20:18:38,567 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,619 DEBUG    benqprojector.py:723 Response: *pow=?#
2024-10-28 20:18:38,619 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:18:38,619 DEBUG    benqprojector.py:723 Response: *POW=OFF#
2024-10-28 20:18:38,619 DEBUG    benqprojector.py:774 Processed response: off
2024-10-28 20:18:38,619 INFO     benqprojector.py:1283 Turning on projector
2024-10-28 20:18:38,631 DEBUG    benqprojector.py:743 command *pow=on#
2024-10-28 20:18:38,641 DEBUG    benqprojector.py:733 Waiting for response
2024-10-28 20:18:38,693 DEBUG    benqprojector.py:723 Response: *pow=on#
2024-10-28 20:18:38,693 DEBUG    benqprojector.py:642 Command successfully sent
2024-10-28 20:18:38,693 DEBUG    benqprojector.py:723 Response: *POW=ON#
2024-10-28 20:18:38,693 DEBUG    benqprojector.py:774 Processed response: on
2024-10-28 20:18:38,693 INFO     __main__.py:101 Disconnecting from BenQ projector
2024-10-28 20:18:40,208 DEBUG    benqconnection.py:76 Connection closed

Powering off the projector works fine

(venv) ****@**** bin % python3.13 -m benqprojector serial /dev/tty.PL2303G-USBtoUART1110 115200 off --debug
2024-10-28 20:24:21,917 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 20:24:21,918 DEBUG    selector_events.py:64 Using selector: KqueueSelector
2024-10-28 20:24:21,918 INFO     benqprojector.py:307 Connecting to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 20:24:22,455 DEBUG    benqprojector.py:309 Connected to /dev/tty.PL2303G-USBtoUART1110
2024-10-28 20:24:22,539 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 20:24:22,543 DEBUG    benqprojector.py:723 Response: *pow=?#
2024-10-28 20:24:22,543 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:24:22,544 DEBUG    benqprojector.py:723 Response: *POW=ON#
2024-10-28 20:24:22,544 DEBUG    benqprojector.py:774 Processed response: on
2024-10-28 20:24:22,556 DEBUG    benqprojector.py:743 command *modelname=?#
2024-10-28 20:24:22,561 DEBUG    benqprojector.py:723 Response: *modelname=?#
2024-10-28 20:24:22,561 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:24:22,562 DEBUG    benqprojector.py:723 Response: W700
2024-10-28 20:24:22,562 ERROR    benqprojector.py:767 Unexpected response format, response: w700
2024-10-28 20:24:22,563 ERROR    benqprojector.py:371 Unable to retrieve projector model
2024-10-28 20:24:22,565 INFO     benqprojector.py:415 Device on /dev/tty.PL2303G-USBtoUART1110 available
2024-10-28 20:24:22,578 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 20:24:22,580 DEBUG    benqprojector.py:723 Response: *pow=?#
2024-10-28 20:24:22,580 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:24:22,581 DEBUG    benqprojector.py:723 Response: *POW=ON#
2024-10-28 20:24:22,581 DEBUG    benqprojector.py:774 Processed response: on
2024-10-28 20:24:22,594 DEBUG    benqprojector.py:743 command *pow=?#
2024-10-28 20:24:22,596 DEBUG    benqprojector.py:723 Response: *pow=?#
2024-10-28 20:24:22,597 DEBUG    benqprojector.py:627 Command successfully sent
2024-10-28 20:24:22,598 DEBUG    benqprojector.py:723 Response: *POW=ON#
2024-10-28 20:24:22,598 DEBUG    benqprojector.py:774 Processed response: on
2024-10-28 20:24:22,598 INFO     benqprojector.py:1328 Turning off projector
2024-10-28 20:24:22,610 DEBUG    benqprojector.py:743 command *pow=off#
2024-10-28 20:24:22,614 DEBUG    benqprojector.py:723 Response: *pow=off#
2024-10-28 20:24:22,614 DEBUG    benqprojector.py:642 Command successfully sent
2024-10-28 20:24:22,617 DEBUG    benqprojector.py:723 Response: *POW=OFF#
2024-10-28 20:24:22,617 DEBUG    benqprojector.py:774 Processed response: off
2024-10-28 20:24:22,617 INFO     __main__.py:101 Disconnecting from BenQ projector
2024-10-28 20:24:24,130 DEBUG    benqconnection.py:76 Connection closed

I'm also noticing that the modelname response is different when the projector is off vs on 😵‍💫 - not really sure why BenQ makes things so difficult!

At any rate, I have been able to get the projector to turn on using a simple command line argument with echo and have built that into a button in Home Assistant. It would be very cool to get the BenQ HA integration to work but I don't want to take any more of your time. I'll dig into it a bit more next month when I have some free time and see if I can troubleshoot.

rrooggiieerr commented 1 week ago

Yes, some projectors behave differently when they're on than when they're off and plenty of other quirks which vary between models. BenQ doesn't seem to be very consistent in following their own interface definition.