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

Connection is already closed. #126

Closed
fjramirez1987 opened this issue Jul 28, 2019 · 8 comments
Closed

Connection is already closed. #126

fjramirez1987 opened this issue Jul 28, 2019 · 8 comments
Labels
duplicate This issue or pull request already exists

Comments

@fjramirez1987
Copy link

I have problems when executing a scene with some sonoff devices. It seems that the connection is closed when several consecutive requests are made.

websocket error: Connection is already closed.

@peterbuga peterbuga added the duplicate This issue or pull request already exists label Jul 29, 2019
@peterbuga
Copy link
Owner

duplicate of #92

TLDR; quick patch try to add a delay of 1-2 seconds between the actions

@fjramirez1987
Copy link
Author

Is it possible to add that delay in the custom component? I am using scenes, the scenes do not allow delays.

@peterbuga
Copy link
Owner

you could create an automation-alias entity to turn on/off the devices used in the scenes, add the delays there and use this in the scene. i know it's a bit cumbersome but this is the best it can be done right now.

i have some solutions lined up but no time or mood to test & implement them.
(ps: the eWeLink app does the same thing when activating a scene, changes the state of a device 1 by 1 not all at once)

@mattsaxon
Copy link

All, just in case you might want to use an alternate mechanism, the LAN based Sonoff components discussed here work very well in parallel, I for example have over 20 devices controlled this way. https://community.home-assistant.io/t/new-custom-component-sonoff-lan-mode-local-with-stock-firmware/88132/27

@fjramirez1987
Copy link
Author

I had that same idea but with a script. I will try to look at the component code to try to do something. I am a programmer, but HA is new to me. Thanks for your time.

@peterbuga
Copy link
Owner

for the time being i'm going to keep the component online-only & autodiscovery(-ish) as you might soon find out that lan-mode is quite unreliable (works for some devices doesn't for others) and it does require some manual setup (and this raises a lot of doesn't-work-for-me issues)
you guys might find it trivial but if you browse through the issues around here there are persons at a level "unable to find the custom_components folder" so there's that...

@mattsaxon
Copy link

@peterbuga, agreed, its more difficult to setup, but once done so, the reliability is excellent. If someone is about to embark on some custom coding, I think the LAN mode components are a possible option and can be used in parallel with your component too. @fjramirez1987, if you'd like some assistant, I'm happy to help out with getting you started. Please post issues to my repo here https://github.com/mattsaxon/sonoff-lan-mode-homeassistant

@fjramirez1987
Copy link
Author

true @peterbuga, I have taken a look at the component that says @mattsaxon and it seems unclear to me. I prefer Peter's component, simple and functional. Thank you @mattsaxon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants