I ended up using cloudfree switches which use tasmota instead and worked fine CloudFree Motion Light Switch - CloudFree
It sounds like it is a limitation of the Kasa local API to not be able to access motion events/etc. Is this true? If so, will look for another switch since it will be unlikely that the HA integration will ever be able to get motion status. This is so close to an ideal switch with sensors!
The current integration is polling. There doesn’t seem to be a push local api. Even if we can figure out a way to poll for motion state the experience would likely be subpar since it would have up to a 5 second delay.
Unless tplink decides to publish docs for a local push api, I would look elsewhere for a similar device
I’d be okay with polling, for example it’s good enough for a security system.
Is there a way to control the config on this switch via HA? I see that python-kasa does support it.
@AJolly what type of configuration changes would you like to see? Feel free to open an issue in python-kasa project and perhaps we can make it happen.
If running kasa --host <addr> feature lists the wanted configuration, adding support requires just modifying some homeassistant code to define the metadata (like icons, translations, etc.). If it is not yet exposed through that “feature” interface, it will require a bit more work but the main hurdle is to know what is useful to expose.
It would be cool if PIR entities could be exposed in Home Assistant so that one can turn the motion sensor on/off from the automations.
The use case would be enabling/disabling the PIR-based cloud actions depending on the state of other switches and external motion sensors.
Another use case for me would be toggling the PIR sensor on/off as sometimes it stops working and I need to toggle it in the Kasa app to make it work again.
Fair enough and that should be doable. Adding support for this requires changes to the backend library as well as to homeassistant, the first step is to add it to python-kasa and make sure it works. I just created Expose PIR enabled setting for iot dimmers by rytilahti · Pull Request #1174 · python-kasa/python-kasa · GitHub to add support to python-kasa, it would be great if you could test it using the python-kasa’s cli tool.
If you need help with setting up the test environment, please let me know. I am also available on the homeassistant discord under alias ‘rytilahti’, feel free to contact me privately there if you want.
Thanks, I messaged you in Discord.
Is there any way to control if the light turns on/off when the PIR is triggered? Specifically it would be nice if the PIR detection and light turning on were completely independent
Any progress on this making it into the integration? I can see that this got merged into python-kasa 0.7.7, and that got merged into HASS 2024.11.0, but I’ve still got no joy in the front end.
I did enable debugging for a minute and see that PIR and LAS come up for my KS200M, but that’s as far as my skill set takes me.
Looks like the PIR setting hasn’t been added completely yet to python-kasa Add ADC Value to PIR Enabled Switches by ryenitcher · Pull Request #1263 · python-kasa/python-kasa · GitHub
I assume once they work out the final issues with that we will get something in the TP-Link integration.
Looking at the commit history for the integration, only toggling the PIR sensor has been added.
Also you will likely not see any actual changes to your frontend until a new version of home assistant releases since it is an official Home Assistant integration.
I am excited to see that we are finally getting this feature, a huge thanks to the team working on the integration and python-kasa! Also thanks TP-Link for opening up the firmware so we can have access to the sensors!
Thanks, I hadn’t seen that PR. I too am excited that progress is being made, I’d like to put the Tapo app to sleep. The team deserves huge kudos for keeping this integration native to HA with a Platinum score (although that’s soon to change).
I’ll hold off on thanking TP-Link until they fix/open up their camera firmware for the HACS - Tapo Cameras Control integration.
Please everybody vote here for it on kasa’s site
OK I’m confused, I thought that the limitation is on the kasa hardware/firmware side. If there is ANY way at all to get the PIR then there is hope. If the information is availalbe to python, i can see if i can make time to make it available for the masses. IF i can find the time
The information is already available in python but you can see this PR #1490 for more information.
After this or something similar is merged and the corresponding entity is added to the integration, it will require a new version of home assistant to be released since TP-Link Smart Home is an official integration.
It looks like that PR hasn’t had any updates since February. It’s there some ongoing discussion of what needs to happen to get this merged? Thanks for pushing this forward!
I haven’t received a response from the developers so I’m not sure if there is a separate discussion taking place regarding the TP Link integration and the event API.
Home Assistant newbie here looking for support and education.
When I add the entry, tplink_pir_patch: to the configuration.yaml how should it be entered, just the text tplink_pir_patch: or is there a tag before it?
Thanks for the support.
UPDATE: I have the HACS working, pretty easy actually.
- I updated the configuration.yaml with just the text, tplink_pir_patch:
- I was able to create an automation via the automation UI to trigger off my ES20M.
- In my initial effort I had also entered the sample automation into the automation.yaml so I had two automations, one entered via the UI, the other taken from GitHub documentation and modified. The GitHub version worked so I kept it and deleted my other automation created via the UI.
Great work. I originally had one Kasa / TP-Link motion switch, and know that I know that HA works with it, I’ll be purchasing more.
Thanks.
