Skip to main content

Provides ability to connect and control a PetSafe Smart Feed device using the PetSafe-SmartFeed API.

Project description

PetSafe Smart Feed - Python API

Connect and control a PetSafe Smart Feed device using the PetSafe-SmartFeed API.

API Throttle Warning

NOTE: PetSafe will lock your account if you request data more often than once per 5 minutes.

Installation

python setup.py install

Login token

You must get a login token to use the PetSafe Smart-Feed API.
There are two methods to retrieve a token:

Get token using command line

  1. Execute python -m petsafe_smartfeed [email_address] to request an email code.
  2. Check your email for an email code from PetSafe.
  3. Execute python -m petsafe_smartfeed [email_address] -t [email_code] to generate a token.

Get token using Python

import petsafe_smartfeed as sf

# replace with your email address
email = 'email@example.com'
sf.api.request_code(email)

# check your email for a code
code = input('enter email code (include any dashes): ')
token = sf.api.request_token_from_code(email, code)

print(token)

Example usage

List devices

import petsafe_smartfeed as sf

token = 'YOUR TOKEN HERE'
devices = sf.devices.get_feeders(token)

# print all feeders
for device in devices:
    print(device)

Feed 1/8 cup at normal speed

import petsafe_smartfeed as sf

token = 'YOUR TOKEN HERE'
devices = sf.devices.get_feeders(token)

# get the first feeder
feeder = devices[0]
feeder.feed(amount=1, slow_feed=False)

Get current battery level (0 - 100)

import petsafe_smartfeed as sf

token = 'YOUR TOKEN HERE'
devices = sf.devices.get_feeders(token)

# get the first feeder
feeder = devices[0]
print(feeder.battery_level)

Get current food level

import petsafe_smartfeed as sf

token = 'YOUR TOKEN HERE'
devices = sf.devices.get_feeders(token)

# get the first feeder
feeder = devices[0]
status = feeder.food_low_status

if status == 0:
    print('Feeder has food.')
elif status == 1:
    print('Feeder is low on food.')
elif status == 2:
    print('Feeder is out of food.')

Contributing

All contributions are welcome. Please, feel free to create a pull request!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

petsafe_smartfeed-1.3.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

petsafe_smartfeed-1.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file petsafe_smartfeed-1.3.tar.gz.

File metadata

  • Download URL: petsafe_smartfeed-1.3.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for petsafe_smartfeed-1.3.tar.gz
Algorithm Hash digest
SHA256 5ec2e471d143fdbb5220e91f88e200f972b4fa2be7b2ebc3c4919ad80507df2d
MD5 86324612743a9fe69ed3dd34b06af7b9
BLAKE2b-256 d1b77cbec01060b850e00d9550e357cb42ce377b0567be2c2d8e304004e0e612

See more details on using hashes here.

File details

Details for the file petsafe_smartfeed-1.3-py3-none-any.whl.

File metadata

  • Download URL: petsafe_smartfeed-1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for petsafe_smartfeed-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3ddf6c464695933a4d7ec8412062e8f2d8e74b0cafe277ce7060a94ace9d4ac1
MD5 f7de20a889e04d4624dbe03f95d4b828
BLAKE2b-256 8fb2f7cbb7e933960c0f33835949bdec8651ec382374f661419402ab8b6b9b53

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page