bitfocus / companion-module-tplink-kasasmartplug

Controls TP-Link Kasa Smart Home devices like the HS100 wifi plug.
MIT License
3 stars 2 forks source link

Frequent Disconnects #1

Closed mikecreates86 closed 3 years ago

mikecreates86 commented 4 years ago

First of all, this is a lifesaver plugin because I was controlling my plugs via IFTTT until I just saw they are charging for that service now. Plus that traveled over the web and this is all local network so it's great overall.

However, on the latest build I'm finding that the instances disconnect frequently. I have six separate instances controlling six plugs and they all do it. Seems that especially after an on or off is triggered they go dead for a few seconds. Problem this causes is that that my Stream Deck ON and OFF buttons that control all 6 of these end up being sporadic. Sometimes they turn on all six. Other times just 2 or 3 because the remaining 2 or 3 are disconnected at the moment. Seems to just cycle disconnects as I watch my instances.

Any help or ideas here?

mikecreates86 commented 4 years ago

Ok after taking a video, it's happening at almost exactly 1 minute intervals. Not sure if that helps.

josephdadams commented 4 years ago

Thanks! Glad you like it.

In my experience, that's just what these devices do if you send them the payload. They turn on (or off) and then disconnect you.

I could rewrite the module so that it only opens a TCP connection long enough to send the payload, and then disconnect (or allow a disconnect). If you have a development environment, I can send you something to test on, or, you can wait until it's updated in the core at some point.

josephdadams commented 4 years ago

@mikecreates86 PR #2 should solve this issue for you. Test it out and let me know what you think.

mikecreates86 commented 4 years ago

So to be clear, if I update companion to the lates build I'll be able to test this for you? And with the new code, will it still be a 1 minute delay every time before the plugs will take another command? Not really an issue I guess but just curious.

josephdadams commented 4 years ago

No, it is not in the latest build, but you can set up a development environment for yourself and test it out. If it works, I'll merge it into the master branch of this module and then we can look into getting it included into the latest beta builds.

josephdadams commented 4 years ago

https://github.com/bitfocus/companion/wiki/Module-Development

mikecreates86 commented 4 years ago

Yeah unfortunately I'm not really familiar with all of this as much as I think I need to be to do that.

mikecreates86 commented 4 years ago

I'm currently running everything on Companion Pi.

josephdadams commented 4 years ago
mikecreates86 commented 4 years ago

Ok let me try

mikecreates86 commented 4 years ago

Ok currently stuck trying to cd to the Companion folder...sorry I don't know much about how Companion Pi is setup

josephdadams commented 4 years ago

Any luck?

mikecreates86 commented 4 years ago

Never figured out how to install it on Companion Pi remotely.

———— Mike Moore

Sent from my iPhone

On Oct 4, 2020, at 8:15 PM, Joseph Adams notifications@github.com wrote:

 Any luck?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

MichaelAllen commented 3 years ago

I just tested and can confirm that PR #2 fixes the disconnect issue for me. 👍

mikecreates86 commented 3 years ago

What is PR #2?

On Oct 19, 2020, at 4:21 PM, Michael Allen notifications@github.com wrote:

I just tested and can confirm that PR #2 https://github.com/bitfocus/companion-module-tplink-kasasmartplug/pull/2 fixes the disconnect issue for me. 👍

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion-module-tplink-kasasmartplug/issues/1#issuecomment-712419523, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQPE4HMLKENJ7MLZIZO2VYLSLSNUJANCNFSM4R5AAD2Q.

MichaelAllen commented 3 years ago

@mikecreates86 That was the fix Joseph mentioned testing above. Now that it has been tested, the next step is for it to be merged so it can be included in a build. After that happens, you would be able to download a new version of Companion with the fix included.

josephdadams commented 3 years ago

I'll merge it now that you've tested it. :)

josephdadams commented 3 years ago

It's in the latest beta builds now.

mikecreates86 commented 3 years ago

This is awesome. Thank you so much for updating us!

On Oct 20, 2020, at 11:04 AM, Joseph Adams notifications@github.com wrote:

It's in the latest beta builds now.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bitfocus/companion-module-tplink-kasasmartplug/issues/1#issuecomment-712919184, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQPE4HPYEOWPSIWA7BGGLPTSLWRHTANCNFSM4R5AAD2Q.