#control home assistant using python

22 messages · Page 1 of 1 (latest)

final fjord
#

I heard I can control my home assistant using python but I don't know how can I do that

sharp wharf
#

That's a very open ended question - how exactly are you trying to control it?

spiral mica
#

There are at least 4 ways you can “control” HA from Python: the python_script integration, pyscript, AppDaemon, or via REST/Websockets API and external scripts. But, to @sharp wharf’s question. What do you want or need to do?

final fjord
spiral mica
#

lol it’s not, but whatever works for you works! 😊

final fjord
spiral mica
#

No worries. Not sure why you need a Python script for that though. You can do that through a simple automation.

final fjord
#

what kind of automation?

sharp wharf
#

Basically implement your script as a home assistant automation

spiral mica
#

It’s a simple motion lighting automation. There’s even a blueprint for that included in HA.

final fjord
sharp wharf
#

You can, but I meant just remake the functionality

final fjord
#

I see

final fjord
spiral mica
#

The concept is the same.

sharp wharf
#

How is it detecting humans?

spiral mica
#

Most likely it’s a Tuya mmWave sensor. They’re the only ones I know of that use “human presence” as a marketing thing. lol

final fjord
#

(in the code I used hungarian language)

#

now it works with wled because I can call an api request

sharp wharf
#

Gotcha, fun.
For that I would recommend linking it into home assistant with mqtt https://pypi.org/project/paho-mqtt/
This would allow you to publish "person detected" and "no person detected" directly into a home assistant sensor which you can use to control the lights