#Kasa python

1 messages · Page 1 of 1 (latest)

trail wing
#

Probably not the right place - but I have an automation that just runs a simple python script that requires a python module to be installed. I cannot figure out how to get this module to install and stay available. If I pip install it from the HAOS command line it still doesn't work. I'm running HAOS 15.2 2025.4.4 and I have HACS isntalled. Yes, there's a TP-Link Kasa addon, but that relies on kasa cloud - which I'm trying to avoid (it's slow sometimes). Any guidance?

spare bobcat
trail wing
#

The kasa integration reqruies you to login to TP-Link cloud

spare bobcat
#

i have some kasa stuff and (although i am moving away from it ASAP) and with older version it doesnt request it

trail wing
#

Odd - because if my internet is down not a single kasa device works in automation, but if I call the kasa python directly with --host <ip> I can still control the device

spare bobcat
#

yeah its a really awkward midpoint currently. during the setup handshake the plug asks for authentication. but also doesnt nessasarily need it

trail wing
#

I'd prefer to not use the TP-Link integration and just use custom scripts for the devices I want to control

spare bobcat
#

if you run the script from within the context of the home assistant container then the library should be there

trail wing
#

the 'kasa' command is non-existent from terminal

#

pip install python-kasa and suddenly it's available... until an update and it goes away

spare bobcat
#

then you are not in the context of the home assistant container

#

ensure that your terminal is not in protected mode then run
docker exec -it homeassistant /bin/bash

trail wing
#

I have HAOS running in a VM

#

I'm accessing cli via the 'terminal' add-on

spare bobcat
#

ok so make sure the terminal is not running in protected mode

#

then go to the terminal and type as above

#

like this

#

protected mode is inside the terminal addon settings

trail wing
#

it's off

spare bobcat
#

its on by default

#

if you just switched it off you will need to restart the addon

trail wing
#

no, I switched it off a year ago

spare bobcat
#

ok

#

ha core runs within a container which has the dependencies inside it. in this case python-kasa. once you switch to that container context you will be able to use it

#

kasa command should definetly be there

#

tp-link are a pain in the arse and are slowly locking down kasa stuff. i would definetly avoid it in future and consider replacing what you have

#

they are slowly changing stuff so they don't totally break old setups but new setups can be used without cloud and at some point they are just gunna fuck everyone over by the looks of things