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

[+] benqprojector/benqprojector.py - fixed telnet network support (te… #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yellow1234
Copy link

fixed telnet network support

i tried the home assistant integration and got "connection failed error"
than tried that module which also didnt work

so i fixed that my self and its not now working

its tested on w4000i/ht4550i

thanks

@rrooggiieerr
Copy link
Owner

THanks for getting involved! I just updated the library to be asynchronous so you might want to try the new library first. Also I don't see what you're trying to solve. '*' is part of the response message, not any whitespace or control characters. Is your model not returning any newlines or carriage return at the end of the response?

Are you using a RS232 to WiFi bridge or the network connection of your projector?

@yellow1234
Copy link
Author

yellow1234 commented Jun 30, 2024

THanks for getting involved! I just updated the library to be asynchronous so you might want to try the new library first. Also I don't see what you're trying to solve. '*' is part of the response message, not any whitespace or control characters. Is your model not returning any newlines or carriage return at the end of the response?

Are you using a RS232 to WiFi bridge or the network connection of your projector?

For sure i know "*" is part of the response

But over network projector directly there is no any response "sign" for the response like
\n
\r
>

Its only the response msg directly
So after the command is sent i just skipping to getting the reply and not waiting for whitespace or control characters

And than detecting the response with the first char of the response, which is "*" always

And yes, im not over RS232 to WiFi bridge
Its over the lan directly with ethernet

Thanks

@rrooggiieerr
Copy link
Owner

Interesting. I think you're the first one who is actually using the native network connection instead of a serial to WiFi bridge. I'd like to understand this a bit better.

If you telnet to the projector and send commands, how does it behave? Is it all just in a continuous stream or are there different lines for the command and response?

@rrooggiieerr
Copy link
Owner

rrooggiieerr commented Jun 30, 2024

Just some follow up questions:

Is the port number indeed 8000 to communicate with the projector?

It would be interesting to implement auto discovery, does the device support SSDP or Zeroconf?

Otherwise DHCP discovery would be possible, for this the projector would have to use a mac address that's linked to the manyfacturer (BenQ) or use a default hostname <something>.local.
Would you know the mac address and hostname of your device?

@rrooggiieerr
Copy link
Owner

Getting back to your solution, I think it would make more sense to trigger on the #, since that is the end of the response message, and I also think it would work on the serial connected and serial to WiFi connected devices and thus be a more generic solution, not needing any of the is_network checks.

@yellow1234
Copy link
Author

Interesting. I think you're the first one who is actually using the native network connection instead of a serial to WiFi bridge. I'd like to understand this a bit better.

If you telnet to the projector and send commands, how does it behave? Is it all just in a continuous stream or are there different lines for the command and response?

Yes exactly
Its all just in a continuous stream

nothing else

first i tried telnet via putty and saw that if i write
<<<
enter
*pow=?#
enter
<<<

its working and im getting response
than i started debug manually your project and saw where its fail

@yellow1234
Copy link
Author

Just some follow up questions:

Is the port number indeed 8000 to communicate with the projector?

It would be interesting to implement auto discovery, does the device support SSDP or Zeroconf?

Otherwise DHCP discovery would be possible, for this the projector would have to use a mac address that's linked to the manyfacturer (BenQ) or use a default hostname <something>.local. Would you know the mac address and hostname of your device?

Yes its on port 8000

About the auto discovery im not sure
I did static ip for the projector mac addr on my asus router

@yellow1234
Copy link
Author

Getting back to your solution, I think it would make more sense to trigger on the #, since that is the end of the response message, and I also think it would work on the serial connected and serial to WiFi connected devices and thus be a more generic solution, not needing any of the is_network checks.

Of course you know better than me whats working for the serial port and be more generic
I dont have serial the check how its working
I just tried to find a simple and fast solution for my issue

@rrooggiieerr
Copy link
Owner

Could you give the latest GitHub code a try?

@yellow1234
Copy link
Author

Could you give the latest GitHub code a try?

I'll try later this week
Im not near the projector for a few days

But from what I saw fastly
The new changes just moved everything to be async
No something that would make change

But i'll try yes

@rrooggiieerr
Copy link
Owner

rrooggiieerr commented Jun 30, 2024

The new changes just moved everything to be async

Actually, it also accepts # as end of response, which is what should solve your problem

END_OF_RESPONSE = b"#\n\r\x00"

and

if any(c in _response for c in END_OF_RESPONSE):

@rrooggiieerr
Copy link
Owner

@yellow1234, is the latest version working for you now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants