pszafer / epson_projector

MIT License
25 stars 18 forks source link

Please do a release with serial & tcp support #11

Open markbergsma opened 3 years ago

markbergsma commented 3 years ago

I'd be grateful if you could do a release with the Serial & TCP support that appears to have been present in the code for some time. :) Are there any remaining issues with it? Can I help test it?

I was looking into adding support for it to the Home Assistant integration, but then found that the version 0.4.2 release doesn't have it yet. My older projector (EH-TW3200) doesn't yet have a LAN port.

markbergsma commented 3 years ago

Just found (closed) issue #1 which didn't see a lot of activity. I assume this was closed for lack of testing?

pszafer commented 3 years ago

there are 2 protocols tested by me and some users: HTTP and TCP. As I found out most new projectors (if not all) doesn't support control over TCP, but support controlling via HTTP... About serial control, nobody tested it so I don't know if it is working. It was 3 years ago, so I might forgot about something. For sure now I need to retrieve serial number of projector before adding it to HA, I don't know if it's possible via serial.

markbergsma commented 3 years ago

there are 2 protocols tested by me and some users: HTTP and TCP. As I found out most new projectors (if not all) doesn't support control over TCP, but support controlling via HTTP... About serial control, nobody tested it so I don't know if it is working. It was 3 years ago, so I might forgot about something.

I just cloned the repository, and after a few trivial fixes (e.g. loop parameter still there) I got test_serial.py working, and it turned on my projector.

For sure now I need to retrieve serial number of projector before adding it to HA, I don't know if it's possible via serial.

I'm not sure either. I just tried a modified version of the get_serial() method from ProjectorTCP, and that doesn't work so far. But I can experiment a bit more soon, and will let you know.

In case it turns out impossible to retrieve the serial number from the projector, perhaps we can use something else to set the entity unique_id - e.g. based on the serial device file path may just be sufficient.

pszafer commented 3 years ago

Try to find out if it's possible to retrieve serial number or anything which makes device unique. As before all my attempts to make user provide serial number or model number were rejected by HA Core devs as uniqueness of entity id shouldn't rely on user input.

markbergsma commented 3 years ago

The "SNO?" command appears to work - even when the projector is not turned on.

I implemented the following method in ProjectorSerial:

    async def get_serial(self):
        """Send request for serial to Epson."""
        if not self._serial:
            response = await self.send_request(timeout=DEFAULT_TIMEOUT, command=SERIALNO_COMMAND+CR)
            try:
                self._serial = response.split("=", maxsplit=1)[1]
            except:
                _LOGGER.error(f"Error parsing serial number from response {response}")
        return self._serial

Sample output from my projector: "NPCF210216L"

I'll experiment a bit more and send a PR your way once I'm confident enough it works reliably.

pszafer commented 3 years ago

sounds good! When I got this PR I will prepare custom_component of epson for you, so you can test it thoroughly and then I can create PR in HA Core.

markbergsma commented 3 years ago

sounds good! When I got this PR I will prepare custom_component of epson for you, so you can test it thoroughly and then I can create PR in HA Core.

Thanks! I've tested the code for a couple of days in practice, and just submitted a PR: #12

I had already extended the HA component with support to be able to test it in my HA instance, and I'd be happy to send a PR for that as well once we're happy with it. See https://github.com/markbergsma/home-assistant-core/tree/epson-serial and let me know what you think.

pszafer commented 3 years ago

ok, I will check this. For now you can wait with PR to HA as I have to remove configuration.yaml. option in first place as it's should be removed in 2021.9 version.

pszafer commented 3 years ago

Can you test if polling would work for serial connection for your projector? In TCP it sends IMEVENT message as far as I remember

markbergsma commented 3 years ago

Can you test if polling would work for serial connection for your projector? In TCP it sends IMEVENT message as far as I remember

I'm... not sure what you mean by polling here?

pszafer commented 3 years ago

sorry, no polling, but I meant subscription to events sent by projector

markbergsma commented 3 years ago

I'm not aware of any support for push updates over the serial connection/protocol, so I think it's down to polling for now.

The serial code as well as my updated HA component appears to have been working well for the past few weeks here.

martimarkov commented 2 years ago

@markbergsma hey, is there a plan to merge your branch changes to HA?

pszafer commented 2 years ago

@martimarkov PR is merged, just HA component needs to be adapted to work with it. In December I can create some custom component for tests, but I'd need someone help as I don't own projector with serial support.

martimarkov commented 2 years ago

I have a serial projector but interestingly enough it doesn’t seem to work with the current library.

If I run the code on my Mac - everything is fine. As soon as I try to run it on hass - can’t seem to connect reliably to the projector. I’m not very familiar with serial connectors but maybe it’s the lack of signal strength as hass is running on a mini pc and the cable is over 10m long. But it does work on the Mac with identical config.

I’ve ordered a new cable so let’s see what will happen

— MM

On 22 Nov 2021, at 21:26, Pawel @.***> wrote:

 @martimarkov PR is merged, just HA component needs to be adapted to work with it. In December I can create some custom component for tests, but I'd need someone help as I don't own projector with serial support.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

markbergsma commented 2 years ago

@markbergsma hey, is there a plan to merge your branch changes to HA?

Yes, I can try to update my custom HA component with the latest HA code soon, now this library code is published.

Unfortunately, I have less need for this code since I wrote it, as my old projector (EH-TW3200) has died in the mean time. But my new one (EH-TW9400) still has a serial port alongside LAN, so I suppose I can test it with that.

daza67 commented 2 years ago

I'm fairly new to HA after coming over from years of using openhab. I have an older Epson serial projector that I was using successfully in openhab via a Tasmota Serial-to-TCP-Bridge. I've been struggling to get this working in HA and I stumbled upon this. It appears the Epson integration will only attempt to talk ESC/VP.net and not ESC/VP when using TCP which of course my serial only projector fails to respond to. Is there any way this code could be adapted to use a TCP bridge like in my case ?

pszafer commented 2 years ago

@daza67 are you able to write code in python? I'm missing somebody who can test and fix issues for serial connected device.

daza67 commented 2 years ago

I'm a novice with python but have written code before in other languages, willing to give it a crack. The projector I have is connected via a tasmota serial tcp bridge.

On Fri, May 6, 2022 at 4:36 PM Pawel @.***> wrote:

@daza67 https://github.com/daza67 are you able to write code in python? I'm missing somebody who can test and fix issues for serial connected device.

— Reply to this email directly, view it on GitHub https://github.com/pszafer/epson_projector/issues/11#issuecomment-1119303497, or unsubscribe https://github.com/notifications/unsubscribe-auth/AINWQYBBSSFGWMMUKP4DO4DVIS4W7ANCNFSM5BK72E6Q . You are receiving this because you were mentioned.Message ID: @.***>

amosyuen commented 1 year ago

I wrote a serial home assistant integration on HACS for my Epson Home Cinema https://github.com/amosyuen/ha-epson-projector-link. Feel free to refer to it if it's helpful.

s0129 commented 3 months ago

I also have a Epson projector with only a serial port. Been using it with openhab using ser2net, now migrating to home assistant and trying to find a solution. Happy to test anything you have, I am familiar with python.

s0129 commented 2 months ago

I have tested this library and it works great with my projector via serial. Are there still plans to extend the home assistant integration to have a serial option?

pszafer commented 2 months ago

If somebody would make PR to this lib and HA component I'd be happy to merge it. I don't have such device so I won't do it myself.

s0129 commented 2 months ago

If somebody would make PR to this lib and HA component I'd be happy to merge it. I don't have such device so I won't do it myself.

I have created a PR for this. https://github.com/home-assistant/core/pull/121630

s0129 commented 1 month ago

@pszafer any chance you can have a look at the PR? I have been using it for a few weeks now without issue.

pszafer commented 1 month ago

I already told on discord that this pr looks good to me but I'm unable to test it. I added comment in PR as well

s0129 commented 1 month ago

Excellent, thanks.