[DEPRECATED] Kasa Plug, Switch, and Bulb integration

It supports the Kasa single-color light strips. The multi-segment strips are controlled as single color (I believe). Because of the large range of Kasa products (international and US), I do not generate a compatible device list.

1 Like

That's really helpful. Thanks for your work on this. I had put away my pre-Hubitat Kasa stuff and recently pulled it out and placed it in to service. Works great!

1 Like

I am using automations to trigger my front porch lights (Kasa HS200 Smart Switch) when my Eufy doorbell detects motion. Due to compatibility, I have to create this automation using Alexa (which turns the Kasa switch on just fine)

When using HE to control the automation to turn off after 3 minute, I am receiving an error where the device doesn't "report back" that a trigger has turned the device on, and thus doesn't turn off. The default seems to be set at 30 minutes and every time I change this to 5 seconds, for example, it reverts back.

For reference, I am not getting this issue with HA when an automation (but am using HA on my PC and not a PI, so the Hubitat is naturally the better option).

EDIT: If I change 30 minutes to 5 seconds in a few areas of the Kasa Integration APP programming I can get it to default to 5 seconds and the automation works flawlessly. Is this something that you could implement in future patches of Kasa Integration?

Thank you for all the hard work you put into your Kasa works <3

The Kasa Integration App has nothing to do with individual device polling. The individual plugs and switches have a command setPollInterval. For help on this, open the device's page and select "Kasa Help" at the top-right if the page.

If you have the Hubitat Skill enabled in Alexa and the Kasa Switch selected in the Hubitat Amazon Echo Skill, then you can turn on directly through Hubitat. After testing this, you should delete the Kasa Skill from Hubitat or you will confuse poor Alexa.

3 Likes

Thank you, now I am understanding a bit more on the "Quick Polling," from your Kasa Help and the setPollInterval variable. When I tried to change it last night I wasn't actually making a change until I pressed the "set Poll Interval" button.

1 Like

Sorry for the delay. Out of pocket for several days/week. The dimmer may not display this state in the Kasa Phone App.

ISSUE with binding. There is a relatively new issue with binding. Some of the devices do not allow you to rebind the device through the Kasa Phone App (I experienced this with a light strip). Once unbound, these new devices can not be controlled at all through the Kasa Phone App. You can rebind by entering your credentials into my Kasa Integration App and then bind via the device's page. That is the only way other than re-installing the device.

Cloud Integration Issue.

There is now a confirmed issue that popped-up on my testing of the CLOUD integration. This just started.

Issue: on refreshing the kasaToken, the KasaCloud returns a rate limit exceeded error. The current implementation then sets the token to null and throws a warning. This causes Hubitat control of the devices to fail.

Fixes: I am working on a temporary fix. Until then, make sure you minimize the number of Kasa Integrations on your various controllers (Hubitat, Habitat, Alexa, Google, IFTTT, etc.).

Future: I am working on a fix where the token is not nulled and the request for a new kasaToken is repeated in 5 minutes if there is a failure.

Update: A review in Homey indicates that this is a general problem across multiple platforms using CLOUD integration.

1 Like

Version 6.6.1 Update Available

Issues addressed:

  • App: rate-limit error on attempting to get error due to Kasa imposing rate limits.
  • Drivers: Fixed help link to new Link readme.

Update:

  • Update app and all drivers you use either via HPM on Manually.
  • After code update, run the App and the select DONE (no other actions required). This will:
    • initialize the new processing in the app
    • update the IPs for all LAN discoverable devices
    • run Save Preferences on all devices.

Alright, it's happening now. The air purifier won't turn back on because the plug on the HS300 is off. I can see this in the Kasa app.

All the ones with the square plug icons are on the HS300. Here is the IP information as shown in the router.

In HE, the device seems to know the switch is off

I turned on logging for my rule I posted above and debug logging for the air purifier and waited for an update.

The rule never triggered because the plug is already off.

So thinking about where the problem could lie...The Kasa device seems to be updating properly. So this means the command to turn the plug back on from the rule I posted above probably didn't get received properly by the HS300, and there's no way for us to know this from the HE.

So is there a way to write a rule that checks for IS instead of becomes? So the rule would be Air Purifier IS off instead of TURNS off? This might be outside the scope of this post and warrant a new thread...

The parse logs indicate that the air purifier switch is indeed off in both instances. I do not see any log for trying to turn on the device nor for the detection of the device on.

To verify Kasa Integration functionality: Go to the device's edit page in Hubitat and turn on the device. See if the value of switch changes to "on". If so, then the error is somewhere in your rule, not in the Kasa Integration.

Send me a readable copy of your rule. I am NOT a rule expert, but I may see something.

Screenshot up above in this post. Super simple rule. If the switch turns off, wait 5 seconds and turn it on. It's made in Basic Rules.

Go to the device's edit page in Hubitat and turn on the device. See if the value of switch changes to "on".

Yes, it does so. It also immediately turns off if I click off or a rule turns it off. This mismatch is what I was hoping would make my rule work even if a command gets missed. What could happen is

  1. TV turns on. Sometime in less than 1 minute HE should realize this.
  2. Sends an off command to the Air Purifier. The device in HE should report off at this time. (this part never fails)
  3. The rule triggers and waits 5 seconds; sends an on command. The device in HE should now say on.
  4. For whatever reason, the plug didn't get the on command. When it's polled for its energy usage again, the switch should revert back to off.
  5. This should trigger step 3 and 4 to repeat until the switch is actually on.

So it seems to be an issue unrelated to your app/driver. I think I'm going to make a separate thread about this issue.

EDIT: Thread made

Trying to update but getting this error

“ Be sure the package is not in use with devices.”

Any work around?

Do I install the new driver first? Delete original driver first?
Confused

Another issue I find is that after some time the devices forget their driver….
Error says no driver installed even though there is and it initially installed with it.

Nothing in my code would cause a device to forget their driver completely. You can reload a "missing" driver on the driver's edit page, "Device Information", "Type". You would scroll down to the driver for the TP Link Device.

I was able to get it to update after “matching”apps in HPM. Not sure if that’s why I’m also experiencing issues with my drivers.
I may have added driver manually but now it’s wanting to update it through HPM

I looked on device page. The Kasa plug switch driver is selected

For some reason even though I’m updated to 6.61 the device still says 6.6.0

Check your Driver Code page/list, you possibly have the driver installed twice, and the device is pointing to the old outdated copy. You may also have the app installed twice now.

Easiest way to fix if you do not have a ton of devices is to switch the driver they are on. You might also have success by deleting the not in use driver and any duplicated app code as well, going to HPM and doing an UNMATCH on all Kasa instances, then Matchup again and make sure it matches up the app and drivers.

Only 1 driver noted
Only 1 app noted.

How do you UNMATCH in HPM?

After you do this, run the MatchUp again, do not tell it everything is updated, then run an update and it should reinstall (update) everything it just matched up. Then I believe the process after that is to go into the Kasa APP and click DONE at the bottom, this should refresh all the devices, etc...

  • Screen Shot 2022-07-25 at 2.04.40 PM
  • Screen Shot 2022-06-12 at 7.47.25 AM

The feature is found in Package Manager Settings, at the very bottom. Click it and you're offered a list of your packages.

Thanks for the in depth explanation. Unfortunately still running into same situation where driver is unknown, n/a

This is second time it happened to me. Previously I just deleted everything and started from scratch but now I have more devices and rules with these switches :confused:

I am getting these errors

errorjava.lang.IllegalArgumentException: null on line 216 (method updated)

errorjava.lang.IllegalArgumentException: null on line 295 (method updated)

dev:2112022-07-28 09:48:52.047 pm debugJosh bathroom light 6.6.1: sendLanCmd: [ip: 192.168.68.65, commsTo: 3, cmd: {"system":{"get_sysinfo":{}}}]