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

Connection Timing out #37

Open Foxtrottg opened 1 week ago

Foxtrottg commented 1 week ago

When attempting to connect to a smart plug, no devices show up on the scan networks dropdown. and manually inputting an IP address times out consistently.

Starting up module class: E error: Module registration failed Error: Call timed out at t.IpcWrapper.sendWithCb (C:\Program Files\Companion\resources\bundled-modules\tplink-kasasmartplug\main.js:1:64167) at C:\Program Files\Companion\resources\bundled-modules\tplink-kasasmartplug\main.js:1:56938

istnv commented 1 week ago

Which version of companion?

Foxtrottg commented 1 week ago

Which version of companion and OS? Companion 3.4.2 Windows 10

istnv commented 1 week ago

I have a PC for testing and just loaded Companion 3.4.2. The error I got was expected (because the plug IP changes), but the scan worked fine as well as changing to the correct IP. I have a plug-strip across town I can test the IP via VPN as well as several in my office.

Your error is happening before the module starts up. Try re-installing companion.

Foxtrottg commented 1 week ago

After resetting the config and reinstalling companion, the issue is still occurring.

Every once in a while, I see one of the smart plugs listed but then it will still be unable to connect.

istnv commented 1 week ago

What other modules do you have configured? Try disabling them one at a time to see if that helps. There are some modules that hog companion's attention.

Foxtrottg commented 1 week ago

I have attempted to run the Smartplug module while no other modules are in use. I also notice that the other Kasa modules seem to work, it is only the smart plug one that is presenting the issue.

istnv commented 1 week ago

Start the debug log for the module and post those results. I cannot fix what I cannot reproduce.

Foxtrottg commented 1 week ago

Starting up module class: E error: Module registration failed Error: Call timed out at t.IpcWrapper.sendWithCb (C:\Program Files\Companion\resources\bundled-modules\tplink-kasasmartplug\main.js:1:64167) at C:\Program Files\Companion\resources\bundled-modules\tplink-kasasmartplug\main.js:1:56938 Starting up module class: E error: Module registration failed Error: Call timed out at t.IpcWrapper.sendWithCb (C:\Program Files\Companion\resources\bundled-modules\tplink-kasasmartplug\main.js:1:64167) at C:\Program Files\Companion\resources\bundled-modules\tplink-kasasmartplug\main.js:1:56938 Starting up module class: E error: Module registration failed Error: Call timed out at t.IpcWrapper.sendWithCb (C:\Program Files\Companion\resources\bundled-modules\tplink-kasasmartplug\main.js:1:64167) at C:\Program Files\Companion\resources\bundled-modules\tplink-kasasmartplug\main.js:1:56938

It just repeats this.

istnv commented 1 week ago

That error is companion failing to start the module but does not say why :( I still cannot recreate the error.

Foxtrottg commented 1 week ago

log.csv

This support log may be more useful.

istnv commented 1 week ago

I downloaded to another Windows laptop, and intentionally pointed it to a non-plug device. Correct error shows up, but no crash. Have you rebooted the plug?

Foxtrottg commented 1 week ago

Yes. I have 4 smart plugs and have power cycled them all.

istnv commented 1 week ago

Other than re-downloading companion, I can't think of anything else at the moment. I have 2 for 2 successful PC install and configure.

istnv commented 1 week ago

@Foxtrottg Are you able to test a custom package? I can send zip file with sources unpacked for a better idea where the error is.

Foxtrottg commented 1 week ago

Possibly. I'm relatively new to companion, but I can probably figure it out. Go ahead and shoot it over to me.

istnv commented 1 week ago

Click on the cog in the upper right to expose the Developer modules path Point that to a directory to use for custom modules Unpack this file in there: tplink-kasasmartplug.zip

Restart companion.

Foxtrottg commented 1 week ago

Starting up module class: kasaplugInstance error: Error getting config fields: Call timed out error: Error getting config fields: Call timed out error: Module registration failed Error: Call timed out at IpcWrapper.sendWithCb (webpack://tplink-kasasmartplug/./node_modules/@companion-module/base/dist/host-api/ipc-wrapper.js?:39:30) at eval (webpack://tplink-kasasmartplug/./node_modules/@companion-module/base/dist/entrypoint.js?:111:20) error: Error getting config fields: Call timed out

istnv commented 1 week ago

Found something. Try this one: tplink-kasasmartplug2.zip

Foxtrottg commented 1 week ago

Same error message

Foxtrottg commented 1 week ago

So after doing some more testing.

I isolated a smart plug to a new separate vlan (we'll call it vlan2) from the main network (call this vlan1).

If I only connect my PC to vlan2 and only vlan2. It works normally. If I connect my PC to vlan2 and vlan1 (wifi and wired ethernet) it does not work. Even if I select the vlan2 ip address as the companion interface.

Settings for each vlan are the exact same.

istnv commented 1 week ago

I'm not sure how I can work around this. The error is happening at the Companion level and not propagating to my code where I could try again or ignore. My primary workstation (linux) has 3 addresses, and the PC's I are both attached hard-wire and wireless.

I have seen similar weirdness if there are duplicate IPs on the network.

istnv commented 1 week ago

This is a windows only issue and happening in the smarthome library, not the module itself. The same laptop that I tested from my home network via VPN fails when directly attached to the office network. I do not have a full dev kit installed on that laptop yet so this will take a couple of days to locate where I can prevent or work around the problem.