home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.38k stars 30.64k forks source link

Unable to find tplink kasa devices on network #93879

Closed keawepoo closed 8 months ago

keawepoo commented 1 year ago

The problem

Unable to find devices on network... But its on my network. I can see it and use it via my phone and router.... Could it because its on a Vlan?

What version of Home Assistant Core has the issue?

core-2023.5.4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

TP-Link Kasa Smart

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tplink/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @rytilahti, @thegardenmonkey, mind taking a look at this issue as it has been labeled with an integration (tplink) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `tplink` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tplink` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


tplink documentation tplink source (message by IssueLinks)

rytilahti commented 1 year ago

Yes, it's probably because of the vlans. These devices use broadcast requests for discovery, so if the broadcast domain (/network) is different to that of those devices, you have to add them manually.

keawepoo commented 1 year ago

Yes, it's probably because of the vlans. These devices use broadcast requests for discovery, so if the broadcast domain (/network) is different to that of those devices, you have to add them manually.

add them manually - meaning via IP? I did that (where it says host on setup). and still it didnt find it.

keawepoo commented 1 year ago

@rytilahti bump?

run1fast commented 1 year ago

Having this same issue. I have a lot of kasa devices that are working fine with HA. Now trying to add a new KL light bulb and HA is unable to find it.

Edit: I think it might actually be an issue with the kasa Android app. I've been having issues with the app and it showing my plugs and bulbs going offline then online then offline again. I refreshed the app (5 times) and then happen to check HA and my new bulb was now discovered and I was able to set it up in HA.

Madbeefer commented 1 year ago

I have recently added a few more switches and I have the same issue. Mine are not on a VLAN and I've tried adding them manually and HA still doesn't see them.

rytilahti commented 1 year ago

Maybe the new devices are not anymore using the same protocol for communications? At some point TP-Link changed the protocol for some devices but backpedaled from introducing the new protocol across the board, see the unfinished upstream PR.

You could try if you can communicate with your devices by directly using python-kasa. If that is working, then something inside recent homeassistant releases has broken it. If it is not working, it might be that these devices are using a different protocol.

kerygma1517 commented 1 year ago

I'm having the same problem. I have 14 TP-Link HS200 light switches, all running the same firmware. No VLAN. All 14 switches work with the Kasa app and Google Home, but only 7 of the switches have been discovered by HA (20230802.0 - latest). If I manually "Add Entry" and enter the IP addresses in the host field, HA still cannot find them.

keawepoo commented 1 year ago

Ya. To be honest I gave up on HA... Because the stuff I wanted to use it with didn't work or has like almost no support/documentation like this...

On Thu, Aug 17, 2023, 1:07 PM kerygma1517 @.***> wrote:

I'm having the same problem. I have 14 TP-Link HS200 light switches, all running the same firmware. No VLAN. All 14 switches work with the Kasa app and Google Home, but only 7 of the switches have been discovered by HA (20230802.0 - latest). If I manually "Add Entry" and enter the IP addresses in the host field, HA still cannot find them.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/93879#issuecomment-1683091451, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADY26BJDYFQXFI7DKCG7I6DXV2P43ANCNFSM6AAAAAAYWBS7GY . You are receiving this because you authored the thread.Message ID: @.***>

JLACKER commented 1 year ago

I am seeing the same issue. I have 5 TPLink devices connected that have been there for a while and I am trying to add a 6th. It simply wont find it, automatically or manually. No VLan and I am running the latest HA updates. I have to believe this is a widespread problem??

pruchai commented 11 months ago

Same issue here. HS200 works, but HS300 does not work neither by discovery nor IP

zepplen commented 11 months ago

I just acquired 4 new EP25 smart plugs, and they are not showing up in home assistant. No VLANs. My existing EP25's hardware version 1.0 firmware version 1.0.9 The new EP25's hardware version 2.6 firmware version 1.0.1 Build 230614 Rel. 150219

nmap of older switch nmap 192.168.1.227 Starting Nmap 7.80 ( https://nmap.org ) at 2023-11-21 17:38 UTC Nmap scan report for 192.168.1.227 Host is up (0.072s latency). Not shown: 999 closed ports PORT STATE SERVICE 9999/tcp open abyss

nmap of the newer switch shows nmap 192.168.1.57 Starting Nmap 7.80 ( https://nmap.org ) at 2023-11-21 17:36 UTC Nmap scan report for 192.168.1.57 Host is up (0.035s latency). Not shown: 999 closed ports PORT STATE SERVICE 80/tcp open http

rytilahti commented 11 months ago

Looks like some newer EP25 devices do not use the same protocol for communications, see https://github.com/python-kasa/python-kasa/discussions/548

falseunity commented 11 months ago

Same issue with KS205 ? Matter switch. It's using wifi and works in the app, Google Home, etc, but HA won't find it auto or manual IP entry...

rytilahti commented 11 months ago

Could be, the matter devices are known to use a different protocol as mentioned above. The first preliminary steps to adding support for that protocol are already happening in https://github.com/python-kasa/python-kasa/pull/552

falseunity commented 11 months ago

Any testing or help I can provide with the KS205, all you have to do is ask. Thanks everyone!

rytilahti commented 11 months ago

If you are comfortable with git & console, you could already try that PR. It won't work correctly until support for the necessary APIs is added (the PR currently implements the support for plugs), but at least it would verify that we are on the correct path. Something like this would work to install the PR locally (as long as you have git & github tools installed):

git clone https://github.com/python-kasa/python-kasa.git
gh pr checkout 552
poetry install

After installation, you can open the newly created virtualenv using poetry shell (or prefix the commands below with poetry run, e.g., poetry run kasa ....

The command to use would be kasa --debug --type tapoplug --username $KASA_TAPO_EMAIL --password $KASA_TAPO_PASSWORD --host 192.168.xx.xx state and you should potentially see some output in the debug logs from the device even when it raises an exception. The commands on and off (instead of state) may also work already.

falseunity commented 11 months ago

I am technical enough to learn the above but never used the tools. If you can point me in the right direction to get things setup I'm more than happy to do this. If it's too much trouble for you, then I also understand ! No worries !

rytilahti commented 11 months ago

Oopsie, actually, now that I tested it locally, it does not work without a change I had implemented on my checkout. The commands above would only work using the current PR after changing the code a bit..

Anyway, it's very raw at the moment and I don't currently have time to help with setting a test environment, so I would suggest waiting for a little bit. But soon enough any help would be very welcome. If the dimmers work anyway similarly to ones using the "legacy" protocol (i.e., they are similar to light bulbs), I may be able to add basic support when I receive a test light bulb soon :-)

dpiessens commented 11 months ago

I have several EP25s running in my home and after running the above it correctly connects and identifies the state. I also ran the kasa command without arguments but with username and password and it discovered the devices. I'll take a look at running your PR and see if it works. This will be my first development run into HA so it may take a little longer to figure out.

rytilahti commented 11 months ago

The support for the EP25s using the new protocol is now merged but there are still things to do before cutting a new python-kasa release. After that, the homeassistant integration needs modifications to support inputting credentials, you can follow #100356 to track the progress on that.

sdb9696 commented 8 months ago

The issues here relating to newer device firmware are addressed in the latest HA release 2024.02

sdb9696 commented 8 months ago

@home-assistant close

sresam89 commented 8 months ago

@sdb9696 Tested this on the latest release, still unable to find devices

Using homeassistant docker version 2024.2.3 configured for "network_mode: host" running on a RPI4 64-bit OS

image

image

Tried getting into the docker container and tried executing kasa discover Same result -> no devices found image

However if I run kasa --target 192.168.79.255 I am able to find all the devices from within the docker container

Let me know if you need a tcpdump or my docker-compose config

python-kasa discover works just fine from another windows host machine of the same version Finds 8 devices

rytilahti commented 8 months ago

If your host device has multiple network interfaces, this happens if a wrong one is used for the discovery broadcasts (discovery works by sending packets to 255.255.255.255). You can configure the used interface(s) in the network settings, the integration will automatically try discovery on all selected ones.

sresam89 commented 8 months ago

False alarm, my router got an software update and they stock OS snuck in blocking mDNS over the network. Was the last place to check. Took a while to figure out, this thread helped Sorry Again