[DEPRECATED] Kasa Plug, Switch, and Bulb integration

Has anyone else noticed some weird behavior with HS220 dimmer recently? I have them all connected to NR via MakerAPI, and have been using the same motion sensor flow for years now but recently (unfortunately I cannot pin down exactly when) and at infrequent intervals, when I activate the motion sensors, the lights turn on as expected, then they turn off immediately.

My current theory is that there is a race condition between my 5s polling and the motion/digital on. I have the manual press of the switch factored into the flow so that I can turn other lights on and set the correct level for the mode if manually switched on. I have noticed a similar condition with my Vizio TV where if I virtually turn it off it turns off, but then when it polls the tv (tv on a smart plug to detect off/on by remote), it seems to return that it is still on which starts the on logic reverting the off logic.

@djgutheinz Is there a reason for these lines in the device drivers? It's a minor annoyance that I need to turn this option off again every time the driver version is updated. I don't mind it checking for a null value, but I don't think it should be overriding a false value.

if (!infoLog || infoLog == null) { // library marker davegut.kasaCommon, line 59
	device.updateSetting("infoLog", [type:"bool", value: true]) // library marker davegut.kasaCommon, line 60

I've got a KP200 that I still want to control through the Kasa app. I'm having trouble getting the Kasa cloud binding and or use Kasa cloud for device control to stick.

Ideas?

When polling an energy monitoring device, does it check the devices state?

This is plugged into an HS300 and a separate rule will turn the plug off if the TV is turned on. Sometimes though, the plug the air purifier is plugged into doesn't turn back on, but the device in HE will show the state as on. I'm just wondering if you can update the state when energy monitoring is enabled? Because I think would trigger my rule to run again.

Are these devices (such as the HS220) then also controlled by HE and your app via the Kasa Cloud as well? IOW, are they totally local control such that if internet access were to be lost (but local LAN and Wifi maintained), they can still be controlled by Hubitat? TIA for any further insight into this, and thanks for your great work on this!

No, The ones I have encountered are the light strips. When you unbind from the Kasa Cloud, the Kasa phone app can not control the device at all. I assume cloud control will not work at all either. LAN control still works.

Rebinding to Kasa Cloud requires you enter your credentials in the Hubitat Kasa App and then bind through the preferences section.

When I recover fully, I will investigate further. Again, it is just the latest released devices and I do not buy samples of each device - so I can not tell which are impacted unless I buy the device.

I will explore this after I have fully recovered from recent health issues.

Dave

It checks the device state as a part of the code. That is part of the design:

Check device state. Parse device state. If em is enabled, check energy state, Parse energy state.

1 Like

Thanks Dave. Take care of yourself and feel better soon.

3 Likes

I just tested by turning off the plug via the kasa app, and sure enough after a little bit it refreshed the device in HE and it showed off, and then my rule ran and turned the plug back on. I verified through the kasa app.

I guess I need to investigate further how the plug ends up in the off state for hours sometimes. Maybe next time it happens, instead of fixing it in the Kasa app, I'll come look at the logs in HE and see what I can find.

LAN connected? or Cloud connected. If LAN connected:

Have you set up a static IP address in you router for your device? If not, the router may change the IP address when the lease is up. Then the address in hubitat is no longer valid.

My design checks this every once in a while and updates the IP address to the current value; however, it will still cause major delays in detecting the state change.

Also, 1 minute polling (command setPollInterval) works great and has very low cost to Hubitat processing. I allow polling down to five seconds - which may be best for you rule.

If you encounter a not updated value again, try: open logging and press refresh on the device's edit page. That should indicate what the exact issues are (there are not very many).

Getting an error trying to go to the cloud setup page

Looks like a typo
image

I did a repair on HPM and that fixed it, must have been a patch I missed or I got bad code somehow.

Some hot topics for the integration.

ISSUES: If you have issues, the first thing to do is read the instruction/help available by the ? icon in the app and Kasa Help button in the devices. Major sections for problem resolution is "Troubleshooting".

Kasa two factor identification. When required to use the cloud installation, you must first disable two factor identification in the Kasa Phone app. Note the cloud integration is under review due to issues with null token returns.

Dave

Our, developer error. It is always assumed developer error!

Searched through the thread but not sure... Does this integration support strip lighting such as the KL420L5? The KL420L5 is an RGBIC - multi color at once strip. How about the KL400L5? Or the KL430? Sorry, but I was having trouble finding the list of compatible devices. Thanks!

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.