HAP-python icon indicating copy to clipboard operation
HAP-python copied to clipboard

Best Approach to Integrate with Existing Pi Django Server

Open cerahmed opened this issue 1 year ago • 0 comments

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.

  1. I'm thinking of having a method on the server that calls driver.start(). However start() 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?

  2. 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.

cerahmed avatar Aug 01 '23 09:08 cerahmed