[DEPRECATED] Kasa Plug, Switch, and Bulb integration

It can control all of the TP-Link Kasa bulbs, plugs, and switches. Installation instructions with drivers to load for each device type are at the link in the first post of this thread...

G'day Dave,

I feel like I may have asked this before but can't find it in the thread, so hey, why not ask again... :slight_smile:

Any chance of getting the Poll Interval setting as an Attribute rather than a State Variable?

Reason for asking is I would like to get a little smarter with my Wifi polling, both for my Kasa devices and other Wi-Fi devices running on my C-4. I intend to setup some rules to adjust the polling in different modes and based on other criteria. I would therefore like to keep an eye on these settings to make sure they are set correctly, but need this as an attribute to do that (I think). I'm thinking of using Device Manager reports or something similar.

Happy to consider other ideas apart from the solution I've put forward.... Also happy to accept an answer of no, can appreciate time and effort required to develop a driver like this, so don't want to add any additional pressure, this isn't a necessity for me.

Thanks,
Simon

1 Like

Perhaps the thing I have mentioned before is that when I refresh devices via the app, which I did recently, the polling intervals get reset to the default of 30 minutes. Any chance they could retain their current polInterval setting? Bit of a pain to reset them all to the settings I want.

That said, I intend to setup some rules to adjust the poll interval for most of my Kasa plugs during certain modes or based on certain logic, such as entering a room.

Thanks,
Simon

They should be retaining the current poll interval when refresh via the Kasa Integration App. What version of the driver/app are you on?

Dave

Both the app code and em plug driver are 6.3.3, the led update from the 28th of July.

I could be wrong about the process that is resetting the interval, was assuming it was the update process in the app....

I am on version 6.3.3 also and I just checked my devices and the pollInterval is reset to 30mins, not sure when it got reset. I had one device at 5 minutes and one at 10 minutes. My new device is at 10 minutes where I set it after adding it, just the older ones got reset so I am thinking maybe when I added a device they all got reset to the defaults?

1 Like

I just completed installing 50+ of these switches. Everything is working GREAT and I have built a multitude of rules and all of the devices are now heavily integrated into my various apps / routines.

After completing my project it then dawned on me "dummy - you should have created a separate VLAN for all of these devices!".

Good news is I meticulously recorded all of the MAC address and created DHCP reservations for everything in my UDM pro router so moving the devices to a dedicated IOT VLAN isn't a big deal.

In reading above I believe the app is smart enough to recover from device IP address changes as it will refresh the device with the new IP but what about this PLUS a VLAN change. The app also has an option to enter a separate VLAN / subnet.

So what exactly would be the procedure to change over to a new VLAN in my case? Do I simply enter the new VLAN in the app UI page, update DHCP so the they get moved over, reboot the switches so they get the new IP, and then do something to refresh everything in Hubitat? The last thing I want to do is have to rip all of the devices out and start over as that would wreck all of my rules, buttons, etc...

Bonus question - I noticed when installing the switches initially the Kasa App displayed multiple versions of my SSID with the same name. I assumed this is because I am running both 2 & 5Ghz on the same SSID (not sure why sometimes four identical SSIDs were displayed in the UI to pick from and sometimes just two) - I just selected the first one each time never knowing if I was hitting the 2Ghz radio.

I am 99% sure with my all Unifi network I can maintain my existing SSID as DHCP is smart enough to assign these devices to the proper VLAN but this doesn't guarantee I am hitting the correct frequency / radio. My thought is to create a separate SSID just for IOT devices with only 2Ghz enabled. Is it even possible to move these switches to a new SSID without factory resetting them and starting over?

Thanks for any help in advance,

Domenic

Several responses:

Recovery of IP address. If a device detects three consecutive comms errors, it will call the app to poll for devices. The app will automatically update the IP address of all devices it discovers in this process. Limitation: Can only run app recovery once every 30 minutes and it will not be called from a device that has greater than four comms errors (to prevent a real mess in processing). You can reset error count by running a savePreferences on the device; allowing a second recovery attempt.

Change over to VLAN. Not sure how this will work. Design indicates that it should work. I would try on one or two devices first.

  • Move device over to VLAN.
  • Open my app and change to an alternate LAN address, doing a add/update lan function.
    • This should update the IP addresses for the two devices.
  • See if the device IPs have changed for the two devices.
  • Note 1: While in this configuration, the devices on the other LAN will not recover IP addresses. The APP only checks the LAN you have entered .
  • Note 2: Kasa Phone App may have trouble going to VLAN. I do not know how Kasa Phone App will react to changing to a VLAN. You could experiment on this at the same time.

Four SSIDs. Most routers have GUEST wifi networks (one on 2.4 and one on 5). My guess is that the other two SSIDs are some of these networks. I disable mine and then enable when I have a guest in the house. No issue either way; however, you can set up the Guest networks to have limited access that may "break" communications.

Moving device to other SSID's on same LAN segment should not impact performance. Adding a segment - I do not know.

Dave

i am going to need some logs. I tried against all drivers (except dimming switch) and could not duplicate either on savePreferences nor on running the app / add devices, update devices without any changes.

Note: The only way to automatically change pollInterval is during the updated method in the device. This is accessed through the app when you update devices and through the device's edit page on Save Preferences.

  • select "debug logging" in Preferences then do a Save Preferences
  • open a NEW log window
  • Set poll interval to 1 minute.
  • Select Save Preferences
  • Send me the log AND your observation of Poll Interval (change or not).

Dave

Many thanks for your reply and awesome application! I am waiting on some new access points and once I get an opportunity to test I will report back for everyone's benefit and future reference.

I'll try and get some logs as well.

Question on the suggested migration process regarding your Note 1 above. If the app can only "see" one VLAN at a time are you saying I will need to move over a few devices, switch back to the other VLAN, rinse & repeat?

- EDIT -

Discovered a deal breaker for such a "conversion" process. With Unifi at least (probably all major AP brands) you cannot ride multiple VLANs over a single SSID without resorting to RADIUS VLAN assignment so you need to create a dedicated SSID for each VLAN - shouldn't be an issue here but as beast as I can tell through asking the Internet the ONLY way to change the SSID on the Kasa switches is to completely factory reset and re-adopt one at a time.

Assuming this is true and at a minimum I would need to run around to each of my 55 newly installed switches resetting them is there any way to minimize the pain on the Hubitat side? Off the top of my head I am thinking I would first need to remove all of the switch devices via your app but then that would break many of my rules and other places I have references to the devices.

By chance is there a way I could reset the switch without telling Hubitat / your app and perhaps as long as I use the same name during the re-adoption process it would just work since the MAC is the same? I know crazy wishful thinking.

Is there something exposed via the API I could leverage via a Python script that could just hit all of the switches and flip the SSID info?

- EDIT #2 -

I found found an AWESOME set of tools based on Python allowing you to do just about anything with these switches. Looks like it will even provision the switches from scratch without the Kasa App.

Changing the SSID without having to reset to factory default seems trivial with this command - kasa --host IPADDRESS wifi join SSID

2 Likes

Odd scenerio I have here....

I was out of town all last week and I got an alert that Zwave was down. That needs a shut and power disconnect which I couldn't do remotely. I had the idea of using one of my HS103s and binding it back to cloud control and then in future I can just go in to the Kasa app directly and cycle the hub power.

Is there anything else I need to do? I ask because when I turn those on and save I test it by turning off wifi on my phone and I get errors about device being unreachable (in Kasa mobile app).

You must have the username and password in the Kasa Integration App. That gets the hook to allow binding the device to the cloud.

@djgutheinz Recommendation to update documentation.

Use Alternate Lan segments states that used when Hubitat is on one LAN segment and the devices on another.

I have a setup where I had to use Alternate Lan segments even though the Hubitat and TP-Link plugs were on the same segment.

My setup:
IP addresses start at 10.0.0.0. IP Subnet mask 255.255.254.0.

This means that I can have devices on 10.0.0.x and 10.0.1.x in the same network. I put my fixed IP devices on 10.0.1.x. Both the Hubitat and the TP-Link plugs were on 10.0.1.x, but Kasa Integration app couldn't find the devices unless the alternate lan segments line had 10.0.1. Call it a bug or a feature, but it does mean that the documentation is a bit off.

Thanks very much for your excellent work!

1 Like

Same here.
My hub was on 192.168.1.x and the Kasa was on 192.168.2.x and my subnet mask covers both, had to set Alternate Lan segments for it to work

1 Like

Hi, sorry for a noob question, but I am just getting going with Hubitat. I've reviewed the thread and haven't found an answer, though it seems like my situation is pretty basic.

I just installed my HE, upgraded the firmware, installed the Hubitat Package Manager, and installed the Kasa Integration package (not the deprecated one; I went through some false starts with manual installs and such, but cleaned that out and started fresh). I have verified that the app code and drivers are there. I have two HS103 plugs. Both are set to fixed IP addresses, on the same LAN segment as the HE. When I follow the install steps, I see 0 devices available. Here are the debug logs:

app:82021-08-28 12:26:41.508 pm info[KasaInt/6.3.3]: initialize

app:82021-08-28 12:26:36.186 pm info[KasaInt/6.3.3]: starting Kasa Integration, Version 6.3.3

app:82021-08-28 12:26:35.561 pm debug[KasaInt/6.3.3]: updateChildDeviceData

app:82021-08-28 12:26:25.386 pm info[KasaInt/6.3.3]: findDevices: Searching for LAN deivces on IP Segment = 192.168.1

app:82021-08-28 12:26:25.382 pm debug[KasaInt/6.3.3]: addDevicesPage

app:82021-08-28 12:26:21.019 pm info[KasaInt/6.3.3]: starting Kasa Integration, Version 6.3.3

app:82021-08-28 12:26:13.930 pm info[KasaInt/6.3.3]: initialize

Any ideas?

Is there a way to trigger a KL430 scene from anywhere other than TP Link?

I know that 4-5 presets can be saved to each device but I've never been able to trigger them without the app. I use webcore and I tried triggering preset 1,2,3, etc. I've been unsuccessful and I was wondering if this wasn't possible or am I missing something.

Ifttt has proven to be too slow for bridging the triggers.

It currently does not do scenes nor presets. Maybe in the future?

1 Like

Check and verify the devices / hub are not on a guest/protected wifi network. If on a protected wifi network, you may not be able to access them. (most routers allow creation of "guest" wifi networks with options to limit access.)

Try again. If it still can not work, try the Cloud Options in the App and driver. See the instructions on the gitHub site for further instructions.