HAP-python
HAP-python copied to clipboard
Best Approach to Integrate with Existing Pi Django Server
Hi there,
Thanks for the great library!
I'm quite familiar with how the library works as a stand alone program.
However, I need some assistance in order to integrate it with my existing django server that I run on the Pi to control some relays and sensors around the home.
-
I'm thinking of having a method on the server that calls
driver.start()
. Howeverstart()
runs a loop that blocks further code execution. Is it best to run it on a new process/thread? Or is there a better way to go about it? -
Also, since the user (myself) of the server can choose which existing device to show on Homekit, I couldn't figure out a way to "remove" an accessory from the bridge/driver. Case: a user could potentially choose to remove a sensor from homekit (using the django front end), in which case I'm thinking I should stop the running service -> "remove" the accessory from the bridge -> re-start() the driver.
Appreciate any piece of advice you could provide.
Thanks again for the great tool.