Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read and write? #2

Open
freekeys opened this issue Jun 2, 2018 · 7 comments
Open

Read and write? #2

freekeys opened this issue Jun 2, 2018 · 7 comments

Comments

@freekeys
Copy link

freekeys commented Jun 2, 2018

Hi, this looks awesome! Does this allow you to set the state (eg locked / unlocked) or just read the state? Thanks :)

@rcastberg
Copy link
Owner

Read only at the moment, shouldn't be hard to implement, but not on my list of priorities at the moment.

@minusreality
Copy link

minusreality commented Sep 29, 2018

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?

@mctom987
Copy link

I've got 3 dogs, and I would love to be able to have something like "let the dogs in" via the API

@rcastberg
Copy link
Owner

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.

@minusreality
Copy link

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

@minusreality
Copy link

minusreality commented Oct 10, 2018

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" }}

@strix-technica
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants