[DEPRECATED] Kasa Plug, Switch, and Bulb integration

I think Inovelli dimmers have a smart bulb mode where they disable the internal relays.

1 Like

Hi folks, I have searched and browsed, but I cannot find reference to support for the Kasa Smart Plug Power Strip. Is this not supported? It seems like a promising solution for my rat's nest of an AV system.

Four Kasa multi-plugs are supported. See top link in this thread for exact part numbers.

If there is a model that is not on the list, please inform me. I try to keep up with the Kasa product line; however, I only see US products.

Finally, TAPO products are not currently supported. They use different android software and therefore require a different program interface. When someone has one, I will be able to set up a quick test and add if the devices work.

Dave

Link:

Just moved my Kasa devices over from SmartThings a couple days ago. I was having issues with my HS300's. They kept missing commands and giving rawSocket errors in the logs. I just tried rolling back the EM-Multi-Plug driver to version 5.2.1 and it seems to be working much better and even faster now.

Btw, thank you Dave for your hard work. I am so glad you made drivers for Hubitat as well. Samsung is making me nervous about their upcoming changes and I am happy that I have a viable alternative.

Welcome to the community. Did you use my custom SmartThings integration or the official integration over there?

Thanks for both the kind words and the information.

My experience: I use a HS300 and have zero errors in the past errors log. I do about 15 on/off activities a day (I am developing a soundbar driver and need to turn off / on as part of the development testing). Additionally, I turn 3 switched on or off whenever I start my media center.

Concern: Quick Polling. Were you using it?

  • If so, on how many of the outlets?
  • If you were, I recommend you use quick polling only when absolutely necessary.
  • It is also recommended to limit this to two of the HS300 outlets. Faster and the commands begin to collide at the HS300 interface preventing a response and causing the error.

For other readers with HS300's: Are any of you seeing this raw socket errors in your past logs. Occasional do not bother me, but a lot do. If you do, report back with severity and how many quick polls you have enabled.

Dave

1 Like

I had been using yours, but went ahead and switched to the official integration when I heard about them eventually moving away from groovy. I had stopped using energy monitoring on my Kasa devices anyway. Both integrations were working perfectly on SmartThings for me.

Not that I am aware of. Also, "Set Poll Freq" was left blank. The strip that I am having issues with is about 25 feet away from the Wi-Fi router with one wall in between. I mainly had issues when powering on/off all the outlets at the same time. Even setting a 1s delay between actions didn't help. At least 1 or 2 outlets wouldn't receive the command and would give a rawSocket error. Using the 5.2.1 driver seems to work every time. I haven't had a single dropped command using it yet.

Has anyone noticed recently a large delay for their HS110 plugs in the neighborhood of 2+ seconds?

Here is my debug log:

dev:652020-10-02 11:45:56.096 pm infoGreat Room - Fireplace pollResp: power = 1312
dev:652020-10-02 11:45:56.090 pm debugGreat Room - Fireplace setPower: status = [current:11.260565, total:0.605000, err_code:0, power:1311.566270, voltage:116.536548]
dev:652020-10-02 11:45:56.088 pm infoGreat Room - Fireplace setSysInfo: switch: off
dev:652020-10-02 11:45:56.085 pm debugGreat Room - Fireplace setSysInfo: status = [dev_name:Wi-Fi Smart Plug With Energy Monitoring, hw_ver:1.0, rssi:-37, latitude:33.423148, err_code:0, type:IOT.SMARTPLUGSWITCH, deviceId:80064BEB9F2FAC3E2D50304CD03B76AF184DDDF4, mac:50:C7:BF:4D:41:74, icon_hash:, active_mode:schedule, updating:0, led_off:0, on_time:0, feature:TIM:ENE, relay_state:0, oemId:FFF22CFF774A0B89F7624BFC6F50D5DE, alias:Great Room - Fireplace, model:HS110(US), hwId:60FF6B258734EA6880E186F8C96DDC61, fwId:00000000000000000000000000000000, sw_ver:1.2.5 Build 171206 Rel.085954, longitude:-117.614363]
dev:652020-10-02 11:45:56.060 pm debugGreat Room - Fireplace distResp: response length = 1528
dev:652020-10-02 11:45:55.817 pm debugGreat Room - Fireplace socketStatus: Socket Established
dev:652020-10-02 11:45:55.666 pm debugGreat Room - Fireplace sendCmd: Attempting to connect.....
dev:652020-10-02 11:45:55.664 pm debugGreat Room - Fireplace sendCmd
dev:652020-10-02 11:45:55.661 pm debugGreat Room - Fireplace rawSocketTimeout: attempt = 1
dev:652020-10-02 11:45:53.642 pm debugGreat Room - Fireplace sendCmd
dev:652020-10-02 11:45:53.639 pm debugGreat Room - Fireplace off
dev:652020-10-02 11:45:41.250 pm debugGreat Room - Fireplace setPower: status = [current:0.015702, total:0.600000, err_code:0, power:0, voltage:121.029906]
dev:652020-10-02 11:45:41.247 pm infoGreat Room - Fireplace setSysInfo: switch: on
dev:652020-10-02 11:45:41.244 pm debugGreat Room - Fireplace setSysInfo: status = [dev_name:Wi-Fi Smart Plug With Energy Monitoring, hw_ver:1.0, rssi:-35, latitude:33.423148, err_code:0, type:IOT.SMARTPLUGSWITCH, deviceId:80064BEB9F2FAC3E2D50304CD03B76AF184DDDF4, mac:50:C7:BF:4D:41:74, icon_hash:, active_mode:schedule, updating:0, led_off:0, on_time:0, feature:TIM:ENE, relay_state:1, oemId:FFF22CFF774A0B89F7624BFC6F50D5DE, alias:Great Room - Fireplace, model:HS110(US), hwId:60FF6B258734EA6880E186F8C96DDC61, fwId:00000000000000000000000000000000, sw_ver:1.2.5 Build 171206 Rel.085954, longitude:-117.614363]
dev:652020-10-02 11:45:41.212 pm debugGreat Room - Fireplace distResp: response length = 1506
dev:652020-10-02 11:45:40.939 pm debugGreat Room - Fireplace socketStatus: Socket Established
dev:652020-10-02 11:45:40.821 pm debugGreat Room - Fireplace sendCmd: Attempting to connect.....
dev:652020-10-02 11:45:40.814 pm debugGreat Room - Fireplace sendCmd
dev:652020-10-02 11:45:40.811 pm debugGreat Room - Fireplace rawSocketTimeout: attempt = 1
dev:652020-10-02 11:45:38.772 pm debugGreat Room - Fireplace sendCmd
dev:652020-10-02 11:45:38.768 pm debugGreat Room - Fireplace on

My HS220 switches are near instantaneous, but both of my plugs seem extremely sluggish and that 2 second delay seems to be constant and repeatable. If you need any other logs to please let me know.

FYI: I did a software reboot via the Kasa Integration App, as well as a physical reboot by unplugging and re-plugging, but neither helped.

The slowdown is due to the error. The error is caused by a command not being processed by the HS300 because it is busy working another command. My drivers detect this error and automatically try again. This is the case for both the new and for the legacy driver.

I have encountered this in the past. I usually unplugged and plugged back in the HS300 to correct it (it gets into some wierd state).

I do not want to go back to UDP commands. Some of the Kasa device responses are in two IP packets and UDP does not pass the second packet through to the parsing. Raw socket does and I can concatenate the returns to get a complete message to parse.

Dave

Y

ou are getting raw socket timeouts on the device that causes error processing to occur. I will update the HS110 driver in the next week to fix this issue. It is an easy fix. Below is a temporary fix that should work..

Line 420 current: device.name == "HS100" || device.name == "HS200") {

Line 420 corrected: device.name == "HS110" ) {

Dave

1 Like

Gracias, worked perfectly, I changed it to: device.name == "HS100" || device.name == "HS200" || device.name == "HS110") {

1 Like

One other thing, If you have not completely closed your smartThings, be sure to remove the Kasa integration from SmartThings through the App. If still enabled, SmartThings will be still accessing your device for status along with the Kasa Cloud.

1 Like

I didn't think that would be an issue. I'm almost done moving my Kasa automations over. Once I do, I will disconnect it from SmartThings and test the 5.3.1 driver again. I think I will disconnect the Alexa skill as well.

You do not need either Alexa nor SmartThings if you use the Hubitat Alexa Skill. It actually can confuse Alexa because she will have two devices for each of your outlets.. Be sure to unplug the HS300 and replug it. I think it may be confused.

1 Like

What I tried:

  • Disabled Alexa Skill and SmartThings integration
  • Updated Kasa EM Multi Plug driver to 5.3.1
  • Unplugged HS300, waited 10 seconds and plugged it back in
  • Clicked "Save Preferences" on each outlet
  • Quick polling and energy monitoring are disabled for all outlets
  • Ran WebCoRe piston that worked fine with 5.2.1
  • Ran modified piston that adds 1 second between actions

Even after all that, I get rawSocketTimeout errors on one or more outlets when all outlets are turned on or off within a short period of time.

Thanks. I used to get the equivalent error with the 5.2 version UDP. The device probably needs a buffering command queue. I will look at that in the smart app.

Dave

Is it possible to control from the Kasa app or a TP-Link router, and at the same time get status in HE?

I have a Deco M5 that I was previously able to get client MAC address connect/disconnect status, and in turn trigger an IFTTT applet to close a virtual switch. But since TP-Link dropped the IFTTT support in July, my only way to do that with the same router is to close a Kasa switch or outlet.

Ordered a KP303 and I'm hoping I'll be able to get the status of an outlet in HE when it's controlled by a TP-Link automation. Sound plausible? My obvious backup plan if that won't work is to close a relay when power to the outlet comes ON, and that will in turn close a Zigbee contact sensor. I would prefer the former though. Much simpler to achieve and no extra components needed.

The driver is coded to support user-selected polling between 5 and 30 seconds (or no polling). Each outlet can have it's own setting.
Code can be modified to one second polling. I currently limit to avoid the chance of Hubitat performance issues (I have seen none).
Caution is the impact on HE for the additional load - but is YOUR hub, so I do not mind updating for you. Just be aware if you have performance problems, the first troubleshoot is to turn of the quick polling.
I can provide line-by-line instructions for this update.

If you want to do this, tell me. I will update and provide a link. This will be a unique driver with the update annotated in this.

1 Like

Thanks. Can I call a manual refresh to get status? For me this would work if possible, since I am just using this as one of three conditions for my door unlock rule. I have a motion sensor at the door, so that could initiate a refresh at 1 second intervals when the second of the three conditions is also true, and then stop refreshing after the door unlocks.

I have not tried it, but the quick polling is designed to be controllable through the rule machine. Turn on motion then off on door unlock. Using refresh would also work. My current implementation uses Raw Socket. Aside from the rule-machine activation overhead/delay, the system impact is the same for the polling.

1 Like

Perfect. I'm not overly concerned about performance impact if there were any. I have four hubs, so it will not be on one that has any end devices or complicated automations on it. This sounds like it will do the trick. Much appreciated!

1 Like