[DEPRECATED] Kasa Plug, Switch, and Bulb integration

I got an error in HPM:

Tested. No errors found on my development Hub. Already had done on my active hub successfully.

If it is a single driver, you can go the driver's edit page and do an "import".

1 Like

Thats weird, when I went into it, it appears updated:

Go figure. HPM has a mind of it's own, and it's mind's goal is to drive me crazier!

Perhaps I am just over looking it. How do I update the device names if I changed them in the Kasa Mobile App? I tried discover again and they didn't change. Do I need to reset the database?

Easy way is to rename on the device's edit page. Or uninstall and reinstall the devices.

I do not have the device name coordination programmed. It was an issues of which is the one the user actually wants as the name in Hubitat. Technically feasible (and tested by me) to do either way (Hubitat - device or device - Hubitat), but I never figured a way to determine the user's intent.

When I did a test, I added a preference SyncName for the device with options Hubitat Master or Device Master. Then it would update the other name as you saved preferences. I could implement in the next version - not hard and with libraries actually a lot easier.

1 Like

I discovered this thread and want to share a little from my experience on this issue with the comm errors.
I'm a recently converted hubitat user since July 2021 moving from smartthings. At the time I had 2 TP-Link devices. One HS100 and one HS200. when I set my Hub I didn't see an app for Kasa Intergration until some weeks later. I installed the app and all was working great and these two device continue to work well with no comm errors.
Fast forward to early september 2021 when I purchased 3 more HS200 devices. These installed without issue but within days started to drop out with comm errors. Only way to get them back was to reproram in kasa and then the intergration app would see them again.
The two original devices continue to work flawlessly. The only difference with these and the new ones are version and firmware.
Original working HS200 is Version 3.0 Firmware 1.1.5
Newer (3 ea.) HS200 are Version 5.0 Firmware 1.2.5
To further test my hypothesis that version and firmware had something to do with my issue, I purchased off ebay a new but old version of an HS200. This one was a version 2.0 Firmware 1.2.5 and it works without any comm errors.
Maybe this info helps.

Thanks. Great information. I have been pulling my hair (what little I have left) on this.

UPDATE
Some help would be appreciated the next time it occurs - before you reset everything. Using the latest integration version (for the tool):

  • Try the Applications IP Comms Test Tool. I am interested in ping and the through comms data.
    • Then try the control again.
  • Then try the reboot. It may clear the error.
    • Try to control the device again.
  • Then see if you can control the device using the Kasa Phone App.

Objective is to determine if there is a way I can auto-recover from this error condition (without user intervention. A ping clearing it up would be great. A boot, OK (takes 5 seconds).

PS: This may also be a hubitat problem on version 2.2.8. One of the 2.2.9 fixes was to fix their wifi discover issues (related?). You may not discover the errors anymore. That is of interest also.
Dave

2 Likes

Updated Kasa App and ran the IP comm test tool. Got this back.

Communications Testing Results for IP = 192.168.1.55, Version 6.4.2-R1

Ping Test Time(min): 2.933 Time(max): 4.994 Success(%): 100% Device Command Test: FAIL

I have not had any issues with kasa controlling any of the devices nor have I had a any problems with my ip scanner discovering the devices either.

Rebooted Hub and still can't control the device but kasa can.

My hub is currently running version: 2.2.8.156

Update hub to 2.2.9. The wifi discovery test was fixed in 2.2.9 (which is now stable). Then try again.

Hubitat can see the device.

UDP Comms are not working. Either Kasa is locking them out for some reason, or the Hub problem fixed in 2.2.9 is causing the problem (I suspect it is Kasa, but need to confirm).

If still broken, tell me. For now you will have to go to Cloud control for the newer HS200 devices. Once you confirm that Hub 2.2.9 does not fix the issue, I will start to examine alternative LAN control techniques (raw Lan or raw TCP).

Dave

I have developed/tested a test driver using a different Hubitat Comms Method (raw socket vs UDP). Need to see if this will solve the problem you are encountering.

Link: https://github.com/DaveGut/Hubitat-TP-Link-Integration-DEPRECATED/edit/master/rawSocketTest.groovy

Instructions:

  • Install the device driver
  • Create a Virtual Device using "A rawSocket Kasa" as the type.
  • Enter the IP address of one of the new HS200's in the preferences section
  • Save Preferences.
  • Test with an on/off cycle looking at the attributes to change as you send the commands.
  • If this works,
    • Wait until the next comms failure on one of the devices.
    • Open the virtual device
    • Test and see if this communications works.

If this fixes the problem, I will have an update in a few days that uses this method. It will probably have a Preference "Use Alternate LAN Comms" to allow you to change over for the individual device.

Dave

1 Like

I updated my hub to the latest firmware. The Raw Socket driver was installed and a virtual device created with an ip for one of the newer Hs200 devices. The virtual device will turn the hs200 on and off. Now we wait to see if i get a comm error.
I have polling set on the devices at 1 minute.

One additional bit of info. After completed the test set up as instructed I needed to have the hub see the kasa devices again. All I needed to do was remove the hs200's from kasa and reprogram in the app. The devices in the hub reestablished communications.

I am a bit confused on the final state. With the Hubitat firmware update, are the new HS200 devices working as installed by my Kasa Integration App (using the original driver). If so, then raw socket will not be necessary. If not, I will go through the effort to integrate the raw socket comms into the baseline. About 20 hours of work.

Maybe I read too much into what you wanted me to do. The new Kasa devices are working with the Kasa intergration using the original driver. I thought you wanted a virtual device setup using one of the kasa device ips as a mirror using the raw socket driver. I will remove the virtual device.

1 Like

I did want that if you still had problems with the HS200 under the new Hubitat firmware. It is good to know that the raw socket (the other item) works - may come in handy if you encounter further issues.

If you have further issues, try the raw socket test driver again and contact me. I will then integrate the alternate comms into the baseline.

Dave

Will let you know one way or the other.
Thanks
Rich

1 Like

I checked the 3 newer HS200's this morning and all 3 logged comm errors within a minute of each other at 6:52 AM. The comm errors are still active and none of the switches can be controlled via hubitat. I then tried the Virtual Device setup using the raw socket driver and it was able to control the HS200 with the ip of one of the newer switches.

I will have an updated driver for plug-switch (HS200) tomorrow as a test for you. It will update the control type options to use the Alternate LAN comms. I will provide a link and instructions for activating.

Thanks for helping me keep the product viable.
dave
d\

1 Like

Installed test code on impacted HS200 switches and observed Current States-connection is "AltLAN". On/Off cycle works normally and status on/off changes.
Installed test code on one of the not impacted switches. Did not select "Alt Lan Comms". Tested On/Off and switch operated normally.
I will report back in a few days my observations. If all goes well then I will report back in a couple weeks.
Thanks
Rich

2 Likes