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

Unable to connect to host on different subnet with 0.5.4 #545

Closed
jdlayman opened this issue Nov 12, 2023 · 1 comment · Fixed by #538
Closed

Unable to connect to host on different subnet with 0.5.4 #545

jdlayman opened this issue Nov 12, 2023 · 1 comment · Fixed by #538

Comments

@jdlayman
Copy link

jdlayman commented Nov 12, 2023

With python-kasa 0.5.4 installed (part of Home Assistant 2023.11), I'm no longer able to connect to my HS103 devices. I installed the package on my local machine, and I can reproduce the issue. I saw #543, but it seems like a different issue for me, since I am using the IP address and not hostname.

With 0.5.3, "kasa --host 192.168.40.5" finds the device and provides the device information. With 0.5.4, I receive "Got error: SmartDeviceException('Timed out getting discovery response for 192.168.40.5')".

As mentioned previously, the device is on a separate IOT subnet for me. Perhaps that is making the difference? Please let me know what I can do to help troubleshoot!

@jdlayman
Copy link
Author

jdlayman commented Nov 13, 2023

I did some more investigation tonight. The issue is I have a firewall rule that blocks all traffic from my IOT subnet to the rest of my local network except for a few ports or an established TCP connection.

In 0.5.4, the library was updated so that, even with a host specified, the library tries to use the discovery protocol to query the device before connecting (UDP to port 9999, response from Kasa on whatever random port library used). Is this necessary when a host is already supplied?

I'd prefer to keep my firewall rules pretty restricted. Since UDP is stateless and the Kasa devices respond on the random port chosen by the library, I'm unable to write a rule other than allowing all UDP traffic from the subnet to my HA device.

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 a pull request may close this issue.

1 participant