Open agreulich opened 3 years ago
I added reading mode to get_current_status
via get_pet_location
and modifying update_pet_status
plus some constants. I attach __init__.py
and sp_cli.py
below and tried to keep your coding stlye, thought it might have failed at places :-)
Example:
$ python sp_cli.py ls_pets
cat1 (111111) is Free to leave (outdoor pet) and currently Outside
cat2 (222222) is Free to leave (outdoor pet) and currently Outside
cat3 (333333) is Free to leave (outdoor pet) and currently Outside
$ python sp_cli.py pet_lock cat3
ok
$ python sp_cli.py --update
$ python sp_cli.py ls_pets
cat1 (111111) is Free to leave (outdoor pet) and currently Outside
cat2 (222222) is Free to leave (outdoor pet) and currently Outside
cat3 (333333) is Locked in (indoor pet) and currently Outside
$ python sp_cli.py pet_free cat3
ok
$ python sp_cli.py --update
$ python sp_cli.py ls_pets
cat1 (111111) is Free to leave (outdoor pet) and currently Outside
cat2 (222222) is Free to leave (outdoor pet) and currently Outside
cat3 (333333) is Free to leave (outdoor pet) and currently Outside
I created a pull request for this.
Hi,
I havn't done much with this project since family and job changes happened, i will try to look into this soon.
great project - is it still maintained (2 years old)?
My suggestion is to add code that allows to modify a cat to an "indoor cat", which locks them in, and back to an "outdoor cat", e.g. to keep one cat inside while others can leave (because of being sick, pending vet visit, etc). The app and web frontend allows to do this, but unfortunately without a timer; it is not possible in the app to say "modify cat x to indoor cat at 3am", so the cat can still enter and leave freely until then, but after this, needs to stay inside (because, e.g., a vet visit in the morning), while other cats - I have 3 - can enter and leave freely. Moreover, the feature is hidden deep inside the app and I originally had trouble finding it.
Actually I've already written code that works; feel free to add it in a way that you seem fit, if you like. I did not (yet) figure out how to read the status, because my priority was setting it. Of course you might decide against it, because this involves writing data to the server instead of only readin data.
The main modification is to add a method in
class SurePetFlapMixin
(line 684 of__init__.py
) like this:And adding to
sp_cli.py
You might want to rename things and/or change code style. It basically
PUT
s to an URL.../device/<flap-id>/tag/<pet-tag-id>
with a json{"profile": 3}
to lock in, and{"profile": 2}
to free (I don't know if other profile values might have different effects).PS: It is possible to read the status via URL
_URL_DEV
and parameters toThe last record in
data
list then has atags
list (of all pets), each withid
== pet tag-id andprofile
set to 2 or 3 (plus update timestamp inupdated_at
)