Open freekeys opened 6 years ago
Read only at the moment, shouldn't be hard to implement, but not on my list of priorities at the moment.
I would love to have "hey google, let the dogs in". What would it take to get the ability to lock and unlock the door via api?
I've got 3 dogs, and I would love to be able to have something like "let the dogs in" via the API
It shouldn't be too hard, i haven't had any need for this so haven't worked on it, and haven't had much time to work on the code.
Patches are welcome.
I don't yet know python, but here is an allegedly working example of changing the door lock configuration in PHP: https://github.com/alextoft/sureflap
Here is how it's being done by alextoft in PHP:
it's an HTTP PUT to
$endpoint/api/device/PET_FLAP_ID/control
containing the following json:
$json = { locking: $lock }
possible values for $lock:
0 = none (unlocked)
1 = out
2 = in
3 = both
and the following header:
Content-Type: application/json
Content-Length: strlen($json)
Authorization: Bearer $token
and the response will be
{ data: { locking: "0-3 lock value" }}
This Issue has attracted some attention, including on reddit.
Demands on my and René's time are such that neither of us are likely to add write support to the API in any case but, even if I did have the time, I don't want to be responsible for causing trouble for Sure Petcare or for users of this API by fouling up their accounts by making inappropriate state-altering API calls.
Moreover, I don't want to encourage API users to jeopardise their accounts with Sure by putting excessive load on their infrastructure (which is why I added aggressive caching logic). Further still and last I knew, Sure Petcare was not yet ready to open up their API to the public. They've made it clear to me that use of this API is contrary to terms and conditions.
If and when that changes, I hope Sure Petcare will reach out to the open source community for development of bindings for their public API. I'll be happy to help as and when I can. They know how to get in touch with me.
Meanwhile, tread carefully and be responsible.
Hi, this looks awesome! Does this allow you to set the state (eg locked / unlocked) or just read the state? Thanks :)