Closed kionei closed 2 years ago
Just for confirmation, as I couldn't find anything in the documentation related to this - but there isn't support for controlling the locking status of a flap, is there?
Currently only read operations are supported, but i am planning to expand the functionality of this API wrapper in the near future. If you want, I can focus on implementing the update of the locking state first.
Not being a PHP or Python developer myself, I could probably figure this all out on my own but it would take far longer than I would want it to. I'm pleased to find someone working on a simple REST API for it. I'm mainly looking for something that can control locking so that I setup more complex routines than what the official apps allow. I'm content to wait, and I'm happy to help test. I have a DualScan with multiple pets.
You described the intention of this project - a simple, easy-to-use and well documented REST API for SureFlap products. I will have a look into the implemenation of setting the different locking states.
Hey @kionei, take a look at the newly added PATCH endpoint "/devices/{device_id}/control", which let you set the lock mode of a specific flap to one of the 4 available lock modes (Only in, Only out, both in and out, and none). On my flap, it is working fine. Please let me know if it does for you as well.
In addition I published the entire OpenAPI Documentation publicly at https://fabieu.github.io/sureflap-api/. There you can find additional example how to call this endpoint correctly.
Unfortunately I can't test it yet. I locally built a new Docker image and while the container runs the API is unavailable and the container logs are just repeating:
[Errno 2] No such file or directory: b'/bin/--' at /usr/local/lib/python3.10/os.py:607 in _execvpe 603│ path_list = map(fsencode, path_list) 604│ for dir in path_list: 605│ fullname = path.join(dir, file) 606│ try: → 607│ exec_func(fullname, *argrest) 608│ except (FileNotFoundError, NotADirectoryError) as e: 609│ last_exc = e 610│ except OSError as e: 611│ last_exc = e
Unfortunately I can't test it yet. I locally built a new Docker image and while the container runs the API is unavailable and the container logs are just repeating:
Sorry for the inconvenience, I tested all REST API features, but not the docker images - lessons learned. I realeased a fix for this issue just now. Feel free to share, if its working for you now.
Confirmed that the Docker image is running as expected, and the device control endpoint is working. Personally I find the mode backwards, e.g. out = lock pets out, in = lock pets in, etc., but that may just be my perspective. Regardless, I can work with that.
I appreciate the quick work and updates!
Confirmed that the Docker image is running as expected, and the device control endpoint is working. Personally I find the mode backwards, e.g. out = lock pets out, in = lock pets in, etc., but that may just be my perspective. Regardless, I can work with that.
I appreciate the quick work and updates!
Good point, with the lock mode. I will take a look at this!
Just for confirmation, as I couldn't find anything in the documentation related to this - but there isn't support for controlling the locking status of a flap, is there?