Can't get my wifi switches (TP-LINK KASA) to execute rules from the physical switches, only works on app

I am new to Hubitat. I'm coming from Smartthings, so I do have a basic understanding of rules. I've installed the Kasa Integration app and imported all of my switches (19 in total). I'm attempting to setup a rule where all the switches in my kitchen turn each other on and off. When I run the rule from the app, it works perfectly. When I go to the physical switches, all they do is control themselves, not the other ones defined in the rule. Am I doing something wrong, or is there something I'm overlooking?

Ok so they work fine from the device page itself. Can you post the rule that you are using to try and run them?

What do you have the pollInterval set at on the virtual device pages?

When you physically change a Kasa switch (not through Hubitat), it can take as long as the pollInterval for the change to be recognized by Hubitat, since the devices don't push real-time updates to Hubitat based on their changes.

You could drop the poll interval to something shorter, or you could call the Refresh command on some interval (in case you have a loop like that running for other polled devices).

Ultimately, because they are polled, Kasa devices may not be the best to use as triggers for automations. They are excellent for local control, though.

4 Likes

This definitely sounds like a polling issue as it can take a little bit for the Hubitat to catch up to a manual press of the switch.

The other thing I recommend is to possibly look at Switch Bindings ([RELEASE] Switch Bindings) that might help slightly compared to a rule. It’s not going to solve your polling issue, but works really well for syncing switch together.

3 Likes

Oh that's awful news. It doesn't make financial sense to replace 19 switches, so I think I'll have to return the Hubitat unfortunately, as they're all tied to each other through different automations. The lowest the polling goes is 5 seconds, and that's still quite a bit too slow. I've really grown to loathe Smartthings, but it looks like I'll have to go crawling back for now.

Thank you guys for the information.

You could customize the polling to be faster, as @djgutheinz's integration is open-source.

You'd just have to install it as a custom integration as opposed to a built-in one, but that's really no big deal. He may have an opinion on the impact to Hubitat hub load of polling that many switches too quickly, though.

Out of curiosity, does it appear that SmartThings is getting real-time updates, or is it also polled? EDIT: from a quick skim, it appears the "official" ST integration is a cloud-cloud integration, so it's entirely likely that they are getting real-time updates that other integrations (HA, Hubitat, etc) aren't able to get, albeit with a dependence on two separate cloud connections.

3 Likes

You could do a hybrid approach. Use the Kasa app to bind the syncing of the switches and Hubitat for the rules (when to turn on/off, set dimmer level, etc…).

2 Likes

That's not a bad idea, but unfortunately the whole reason I moved away from Smartthings was to keep everything local. I realize that's a limitation of the Kasa switches and not Hubitat, and wish I would have thought about that before purchasing. Hubitat seems like an awesome product!

1 Like

Developer here. The Switches all have the command "Set Poll Interval" (said earlier). That was designed for just your case. Set it to 5 seconds on the switches. (Hub load is minimal). Then try activating the switch manually. You should see the switch attribute change to on (off) and the rule should fire based on the switch value. It is all local.

Page location:
image

3 Likes

The problem there is that it potentially takes up to 5 seconds for the rest of the lights to turn on (once the device’s status is polled), whereas we’re used to it taking less than a second. I know that doesn’t sound like much, but it’s much less seamless feeling.

So, after the wifi device executes the sendEvent command, it takes up to five seconds for the rules to turn on other devices. If that is the case, then this is not the wifi device's issue.

I think what they are saying is that they use the attribute state change as a trigger to automate other lights.

So, you turn on one light and it takes up to 5 sec for the state to change. And then the rest of the lights turn on.

Because the Kasa lights are polled there is nothing that could be improved (short of making the polling interval even more frequent than 5 sec).

2 Likes

but he stated it was after the polling (therefore, the 5 seconds was not applicable).

That's not how I understood @user6183's comment. Perhaps they can clarify?

1 Like

Sorry for any confusion. My problem is that I use each light switch to trigger the other light switches. If I turn on or off the switch, if it’s at the beginning of a polling period it could end up taking up to 5 seconds before the device is polled again, which is what triggers the other switches to turn on.

I don't have any Kasa, so I can't offer direct advice as to how laggy/delayed they are in real life or whether that is normal, or how to handle that side of things.

To easily solve this issue, why can't you use a button device to activate the Kasa switches (via a rule) to turn all Kasa at once?

Use something like the Zooz Zen34 button controller next to your existing Kasa. If you want all lights on, use the button device, and just use the individual Kasa to turn only themselves on. That would give you both individual and group control over these switches and reduce the delay to almost nothing.

A Pico Remote also would work great for this, but the cost of entry for only one button device is quite steep because of the Lutron ProBridge that you need. If you were going to add multiple button devices, the Pico is a great and low cost (average per device including the Bridge) option.

Both the Zen34 and the Pico can be mounted with no electrical box, and with a double gang wall plate would look like they are supposed to be there.

3 Likes

Honestly, if you want to move to Hubitat, then just do it and bind the switches via Kasa or Smartthings. If you do the latter, you could use [RELEASE] HubiThings Replica to bring the binding into Hubitat. Utilizing a Zwave or Zigbee button would work too. Later you could slowly start to replace the key Kasa switches with something that works better for your situation and with Hubitat.

2 Likes

That’s a good suggestion. Thanks!

Not a bad idea!