You might find a template switch helpful. Using that switch (which is conditional based upon the result of the “current_power_w”, you can then avoid polling. I just call the homeassistant.update before turning a switch on or off (Havent yet figured out how to build that into the template switch) which makes my automations read a lot simpler.
@Bruce0 could you elaborate a bit on “I just call the homeassistant.update before turning a switch on or off” ?
I am currently trying to have an automation whenever my record player (connected to the TP-Link plug) turns on (meaning when the plug registers current_power_w > 1.5). But currently the HA pulls every 30 seconds, and unless I create a running timer (every 2 seconds) I am not sure how else I could catch the “before turning the switch on-off”.
Key element here is that I want to turn the record player on/off, and not the plug
Hey I figured out a node red solution to this tp link problem that works for me. I have a poll state node, on my switch that is set to poll every 3 seconds it then goes to a [current state] node with domain: home assistant and the service update_entity: switch.tplink then a [RBE] Node then [switch] node then call service to a lamp on or off depending on the original state. it is not the best and i doubt polling is the best thing but its better than the 30 plus seconds i have to wait to get this thing to work originally
@ AlexKalopsia Apologies for the very long delay, I have been away. Here is an example, the first service assures that the status the switch is currently reporting is used.
i’m super new to HA. my coding level is like a 4/10. i’m trying to do a similar thing to OP, i have a switch, when i turn it on, i want a group of switches to come on, and then also a group of switches turn off when the switch is off.
i did it, no problem, but there is a 20-30 second delay which is just really annoying and confusing to guest who will turn the light on and off a few times thinking my system is broken.
my biggest question, is where am i typing this in. i know its a super noob question but i’ve been at this for about 2 weeks and the documentation is very limited (mainly navigation of home assistant)
i added the add-on file editor, i typed in a similar line to this:
customize_glob:
switch.light_1:
scan_interval: 5
i get an error for project name. i guess i’m just asking if anyone can link me or just really dumb down the basic starting point of where to and how to change my scan interval for my TP link switch.
i’m a visual person and i haven’t seen a solid sketch to give me a road map. thanks
on the TP link side, 24 hs200s and 3 hs220s, about to be 3, 3 way switches as well. when I select on the panel on in the ha app, its almost instant. its when you manually toggle the switch, it takes up to 20-30 seconds to show on HA and to trigger the events. as soon as the events register on HA the automation happens. I’ve been reading and apparently the default scan for TP link is 30 seconds. on Smartthings, it was almost 5 min.
ultimately i’m trying to get past the 3 automation limit in the tp link app and also control some off brand lights I have hung around the house.
I just spent $600+ and 3 days hooking them up. They have potential aside from the shit Kasa app. 3 automations should have been posted in more places or else I would have gone another route. But these are the best looking and go online less than any other switch I’ve tried.
I am running into the same issues. I don’t have quite any many tp link devices (5 currently) but it’s very annoying and frustrating issue. When having tp link connected to my smartthings app, smartthings app notices almost instantly. I physically turn a switch off, the app shows it off within a second or two. I do that same thing with HA and HA will show it off at some point, maybe a minute.
If you’ve figured out a solution or workaround let me know please.
Thanks!
I wish that I would have seen this before I spent a couple of K redoing all of my home with the TPLink switches and dimmers. They seem to work fine other than this. I only have a few that need this function but they are a critical few. The three limit is ridiculous for automation.
Had a problem with Kasa Automation between a Kasa Wall Switch + Kasa Outlet Plug, probably due to a recent AWS outage.
Was able to set up an automation via the UI that just updates the Wall Switch status every 2 seconds.
Based off the earlier post with the YAML settings by @JustMaier Triggers
Trigger type: Time Pattern
Hour: Blank
Minutes: Blank
Seconds: /3
Actions
Action Type: Call service
Service: homeassistant.update_entity
Entity: (add your switch entity)
As per Home Assistant release 2020.6, there is option to disable the polling of the integration completely, thereby fully residing on your own polling frequency: 2021.6: A little bit of everything - Home Assistant
This gives a small performance benefit: each 30 seconds, an unneeded poll is done via the integration itself, on top of your own defined schedule. By disabling this, you prevent a double poll: 5s single poll > 10s single poll >15s single poll >20s single poll >25s single poll >30s double poll > 35s single poll >etc.
Note: in the release party of 2021.6 (youtube stream), it was mentioned that you should never increase the polling rate as compared to the integration native setting (lower is ok, higher not). Reason being that each integration is already having the optimal value and going higher would introduce negative side-effects. I don’t think this is true for the TP-Link Kasa Smart integration: i think the native setting is suboptimal. I have not seen any negative side effects of a poll once-every-5-seconds.
Is there a way to disable the integration polling from within the automation?
30sec polling is ok for me most of the time, and saves space in my HA database. But occasionally I want higher resolution current consumption data, and I’ll toggle the automation on you mentioned to give me 5sec polling interval.
Is there a way to temporarily disable the native polling in the same automation?
@clinta@pimw Hey this is exactly what I was looking for! A couple automations were running so slow because of the polling time. Did either of you see any negative side effects? I have 35 switches and dimmers and I just might do this. I wonder if that would push the limit.