Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Benq Projector] Serial Port will not connect. May be sending incorrect command #17996

Open
kamakazie2 opened this issue Dec 28, 2024 · 17 comments · May be fixed by #18009
Open

[Benq Projector] Serial Port will not connect. May be sending incorrect command #17996

kamakazie2 opened this issue Dec 28, 2024 · 17 comments · May be fixed by #18009
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@kamakazie2
Copy link

kamakazie2 commented Dec 28, 2024

Good Afternoon,

I was hooking up my BenQ Th670 projector via Rs-232 to usb to myserver

I cannot get it to register online.
I have it set to the correct COM port and set the baud rate to 9600 as per instructions.

2024-12-28 18:07:25.236 [DEBUG] [nnector.BenqProjectorSerialConnector] - Open connection to serial port 'COM2'
2024-12-28 18:07:25.391 [DEBUG] [ojector.internal.BenqProjectorDevice] - Query: 'pow=?'
2024-12-28 18:07:25.493 [DEBUG] [nternal.handler.BenqProjectorHandler] - Couldn't execute command 'power', No response received
2024-12-28 18:07:25.493 [DEBUG] [nternal.handler.BenqProjectorHandler] - Closing connection to device 'benqprojector:projector-serial:68936f4d4e'
2024-12-28 18:07:25.493 [DEBUG] [nnector.BenqProjectorSerialConnector] - Close serial out stream
2024-12-28 18:07:25.493 [DEBUG] [nnector.BenqProjectorSerialConnector] - Close serial in stream
2024-12-28 18:07:25.493 [DEBUG] [nnector.BenqProjectorSerialConnector] - Close serial port
2024-12-28 18:07:25.635 [DEBUG] [nnector.BenqProjectorSerialConnector] - Closed

When i connect via Putty to COM2 and send the command i get a response
I am sending *pow=?# in putty and get the power status from the projector.

I notice in the logs that it is sending pow=? and not *pow=?#

When i send just POW=? i get Illegal format from the terminal on the projector.

POW=?
Illegal format

*pow=?#
*POW=OFF#

@kamakazie2 kamakazie2 added the bug An unexpected problem or unintended behavior of an add-on label Dec 28, 2024
@kamakazie2
Copy link
Author

Update: I am able to send power on and power off commands from the Serial binding.

@lsiepel
Copy link
Contributor

lsiepel commented Dec 30, 2024

Could it be firmware dependent on what the power command should be ?

@kamakazie2
Copy link
Author

Based on the add on docs on the binding page is references this https://esupportdownload.benq.com/esupport/Projector/Control%20Protocols/LX9215/LX9215_RS232%20Control%20Guide_0_Windows7_Windows8_WinXP.pdf

That is what I'm using to control my th670. I don't see any other reference to the controls mentioned in the code of the binding. However i wonder if there is a different command set for usb or ip based?

All of the commands are similair but all miss the * header and # trailer

@mlobstein
Copy link
Contributor

That is what I'm using to control my th670. I don't see any other reference to the controls mentioned in the code of the binding. However i wonder if there is a different command set for usb or ip based?

All of the commands are similair but all miss the * header and # trailer

The leading and trailing characters are not seen in the debug output because they get added farther down in BenqProjectorConnector:
image

Are you sure that you have the correct serial port? In windows, a usb-to-serial port is typically a higher COM port, ie COM14?
image

Are you using the same cable in both situations (putty vs. openHAB)? As described in the BenQ PDF, a crossover (null modem) serial cable is required. A straight through cable would explain the no comm situation.

Also, what version of openHAB is being used?

@kamakazie2
Copy link
Author

Thanks for taking a look! Ok so looks like the command part is ok.
I am using the same cable, port, everything between the Serial binding and the BenQ binding. (disable one for the other to avoid port conflicts)
As for the port yes its definitely COM2. I reassigned it to COM2 thinking the higher com ports in windows may be an issue.

I changed the port speed on the projector from 115200 to 9600 as per the binding instruction and still shows offline.

The Serial Port Binding works and shows online, and i can send on commands successfully from that channel:
items.getItem('BenQ_Serial_Bridge_String_Data').sendCommand(('\r'))
items.getItem('BenQ_Serial_Bridge_String_Data').sendCommand('*pow=on#')
items.getItem('BenQ_Serial_Bridge_String_Data').sendCommand(('\r'))

I am running Openhab 4.3.0 on windows 10

image

@mlobstein
Copy link
Contributor

try running this command on the console to turn on logging of the serial port api and see if something else stands out:
log:set DEBUG org.openhab.core.io.transport.serial

@mlobstein
Copy link
Contributor

mlobstein commented Dec 31, 2024

try running this command on the console to turn on logging of the serial port api and see if something else stands out: log:set DEBUG org.openhab.core.io.transport.serial

Scratch that, it does not print any debug information. I have modified the code to print out the raw responses from the projector. Download this jar and drop it in the addons folder.
https://github.com/mlobstein/openhab-addons/releases/download/v4.3.0-snapshot/org.openhab.binding.benqprojector-4.3.0-SNAPSHOT.jar

You should see debug lines that start with response: and end with a '.'
I think your projector might be outputting its responses slightly different than what BenqProjectorConnector is expecting. This seems to be causing it to send blanks to the code that processes the responses.

@kamakazie2
Copy link
Author

I loaded the Jar file.. but dont see any responses in the log

2024-12-30 22:54:23.587 [DEBUG] [nnector.BenqProjectorSerialConnector] - Open connection to serial port 'COM2'
2024-12-30 22:54:23.742 [DEBUG] [ojector.internal.BenqProjectorDevice] - Query: 'pow=?'
2024-12-30 22:54:23.843 [DEBUG] [nternal.handler.BenqProjectorHandler] - Couldn't execute command 'power', No response received
2024-12-30 22:54:23.843 [DEBUG] [nternal.handler.BenqProjectorHandler] - Closing connection to device 'benqprojector:projector-serial:647f42ab1e'
2024-12-30 22:54:23.843 [DEBUG] [nnector.BenqProjectorSerialConnector] - Close serial out stream
2024-12-30 22:54:23.843 [DEBUG] [nnector.BenqProjectorSerialConnector] - Close serial in stream
2024-12-30 22:54:23.843 [DEBUG] [nnector.BenqProjectorSerialConnector] - Close serial port
2024-12-30 22:54:23.985 [DEBUG] [nnector.BenqProjectorSerialConnector] - Closed

image

@mlobstein
Copy link
Contributor

mlobstein commented Dec 31, 2024

Try removing the official binding first and restarting. It should be visible in the console. The message is a println rather than logger call.
image
(ignore the message in my example, I do not have a benq projector so the example is connected to an epson)

@kamakazie2
Copy link
Author

Ok im missing a step somewhere.. i removed the official binding.. then restarted.. added the jar.. created the thing.. and went into the console and am displaying the log.. i dont see any type or response

23:38:51.721 [DEBUG] [onnector.BenqProjectorSerialConnector] - Open connection to serial port 'COM2'
23:38:51.875 [DEBUG] [rojector.internal.BenqProjectorDevice] - Query: 'pow=?'
23:38:51.979 [DEBUG] [internal.handler.BenqProjectorHandler] - Couldn't execute command 'power', No response received
23:38:51.979 [DEBUG] [internal.handler.BenqProjectorHandler] - Closing connection to device 'benqprojector:projector-serial:8581f930b1'
23:38:51.979 [DEBUG] [onnector.BenqProjectorSerialConnector] - Close serial out stream
23:38:51.979 [DEBUG] [onnector.BenqProjectorSerialConnector] - Close serial in stream
23:38:51.979 [DEBUG] [onnector.BenqProjectorSerialConnector] - Close serial port
23:38:52.103 [DEBUG] [onnector.BenqProjectorSerialConnector] - Closed
23:38:54.416 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Zone6_ZoneStatus' changed from OPEN to CLOSED
23:38:54.416 [INFO ] [nhab.event.GroupItemStateChangedEvent] - Item 'MOTION' changed from OPEN to CLOSED through Zone6_ZoneStatus
23:38:55.229 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Zone6_ZoneStatus' changed from CLOSED to OPEN
23:38:55.229 [INFO ] [nhab.event.GroupItemStateChangedEvent] - Item 'MOTION' changed from CLOSED to OPEN through Zone6_ZoneStatus

openhab>

@kamakazie2
Copy link
Author

org.openhab.binding.benqprojector | DEBUG
org.openhab.binding.http | INFO
org.openhab.core.io.transport.serial | DEBUG

@mlobstein
Copy link
Contributor

Ok im missing a step somewhere.. i removed the official binding.. then restarted.. added the jar.. created the thing.. and went into the console and am displaying the log.. i dont see any type or response

If you run start.bat, the responses are visible in the console as soon as the polling runs even without viewing the logs (since they are printlns instead of logger calls):

image

@kamakazie2
Copy link
Author

Got it.. looks like it is sending the right command but i dont see the carriage return or the projector saying response or illegal format
image

@kamakazie2
Copy link
Author

kamakazie2 commented Dec 31, 2024

This is what i get as a response from the serial binding channel
*pow=?# *POW=ON#

@mlobstein
Copy link
Contributor

This is what i get as a response from the serial binding channel *pow=?# *POW=ON#

Thanks for the debug information. I think I figured out how to fix the issue for all variations of benq projectors. The response will now be processed after receipt of the second '#' character. I updated the jar link above with the new code. Try it out and see if the binding can connect now.

@kamakazie2
Copy link
Author

Installed and we are ONLINE! and it reads all the parameters.
So i did notice that my projector requires me to hit OFF 2x to shut it down. So when i want to turn off i have my rule send off 2 times.
Thank you for walking me through and for making the adjustment in the jar file!

image

@mlobstein
Copy link
Contributor

Installed and we are ONLINE! and it reads all the parameters. So i did notice that my projector requires me to hit OFF 2x to shut it down. So when i want to turn off i have my rule send off 2 times. Thank you for walking me through and for making the adjustment in the jar file!

Good to hear! I updated the jar again to make the off command repeat automatically. A PR was submitted to apply these changes to the official binding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants