TP-Link Kasa on an internal WiFi network

Tags: #<Tag:0x00007f173cc3a320>

If you’re trying to configure a TP-Link device on a Wifi without internet access, here’s how.

Download the Kasa app to your phone. Go through the wizard normally, and when you get to network selection, tell the device to connect to your “internal” network. The device light will go blue to tell you it connected, but the app will say it failed (because the device can’t phone home to TP Link’s server). This is fine. You’re done with the TP Link app.

Now, use whatever utility you have to find the device’s IP Address. Mine showed up as HS-103. Note the IP address.

Now, in the Paper UI, (and with “TP-Link Smart Home Binding” installed) attempt to manually add the device. You provide your desired name and the IP address, and just put some random string in the “Device ID” field. Save this, and after a few moments, the device will show “offline” with an error that the DeviceID you entered doesn’t match the device’s id of “correct-id-of-the-device”. Just copy this correct ID back into the configuration and voila, it should connect. You’re good to go create your items (in my case, just a switch).

Background:

I don’t like devices “phoning home” when I don’t need to use their cloud service. I have one SSID on my network for IOT that can connect on the LAN but is blocked from the internet, and another that can ONLY connect to the internet.

Since the KASA device is IP, I wanted to put it in the IOT-Internal-Only group and stop it from connecting to TP Link servers. I know that means it can’t be used from the app, and that’s fine by me because I want OpenHab to “own” it. So I bootstrapped it with the Kasa app, and connected it to OpenHAB as described above.

1 Like

I would think this step could be simpler by just using discovery in PaperUI. Then it just find the ip address and will also set the id directly. And even if you would add it manually leave the id field blank and it will be set by the binding to the correct value.

My kasa app does not let me do this, I have no internet on my wifi network and I cannot connect to my switch (hs-200) for anything.

@Racerflea: Bear in mind that without internet access, the Kasa app will report an error after you tell the device to connect to your network. You can ignore that … Kasa is throwing an error because it couldn’t connect to it’s cloud server. If you gave it the correct wifi credentials, the device should be on your network, despite the error. If your router has a web UI that lists clients, you should see it there, or you could use something like Advanced IP Scanner to look for it. I added an HS103 and a KP400 using this method, no sweat.

@hilbrand: Ahhhh, better. I’ll try that when I add the next one. Thanks!

@hilbrand I just tried it using discovery, but it didn’t work. Not surprising, since it is on a separate VLAN from the OH server. Not really an issue to add it manually, though. Thanks!

Just curious what you all use for refresh rate in the paper UI ?, does 1 sec mean it is updating the device every second as this seems excessive ?

My Kasas are set to one second, only because I never thought to monkey with the default value. There’s no discernable impact on my WiFi network, and I have about 10-15 of them in play. I assume Hilbrand had a reason for making that the default.

Only the switches are on 1 second, to get fast feedback if someone uses the switch.

2 Likes

You can easily configure your TP-LINK Kasa wifi connection using the NODE-based tplink-smarthome-api (GitHub - plasticrake/tplink-smarthome-api: TP-Link Smarthome WiFi API) cli and a computer with wifi. This is tested with EU HS100 and HS110 and E27 LB110 and LB120. To configure the devices, proceed as follows:

  1. Short reset the device so it sets into connection mode (3 power on cycles for the bulbs and pressing the cog button till wifi LED turns to orange). Then, the device will create a open wifi AP named “TP-LINK_Smart Plug/Bulb_[MAC_5_6]”.
  2. Connect the computer wifi to that AP. If using Windows 10, it will think twice before connecting to that wifi.
  3. Using the terminal issue the following command, replacing SSID and password second fields with the correct values. The IP must be 192.168.0.1 and I had to escape all the quotation marks to make it work:
    tplink-smarthome-api send -u -D 192.168.0.1 "{\"netif\":{\"set_stainfo\": {\"ssid\":\"SSID\",\"password\":\"password\",\"key_type\":3}}}}"
  4. The device will start connecting to the new network and if it is successful, the wifi LED will turn into green (for plugs) or fade out and in (for bulbs).

This works like a charm and saves me plenty of time when any of the bulbs reset due to too fast power on and off cycles.