This python interface enables you to gather information about your dogs whereabouts, your user details and any bases you may have.
NOTE: Since this interacts with undocumented APIs, this may change without notice.
To install this package, use pip
python -m pip install "pytryfi"
TryFi uses Graphql for its APIs. Essentially, you will use your username (email address) and password to retrieve a unique username specific for API calls which in turn will be used for the duration to retrieve data.
# Export env variables
export fi_user=user@user.com
export fi_pass=secretpassword
# When running in Dev container, uncomment & use the args in the `launch.json` file for vscode or set manually in your workspace terminal
export fi_user=user@user.com
export fi_pass=secretpassword
# run script in terminal
python login.py
# Alternatively run script in debugger and set breakpoints as needed (recommended to set one on line 31 of login.py for an example)
hit F5 to start the debugger
#this will create the object and gather all the necessary data
tryfi = PyTryFi(username, password)
print(tryfi)
#this will perform a complete refresh of all Pets and data points
tryfi.updatePets()
#this will perform a complete refresh of all Bases and data points
tryfi.updateBases()
#this will perform an update on both Pets and Bases and their associated data points
tryfi.update()
#this will update the last reported location of a bet
tryfi.pets[0].updatePetLocation(tryfi.session)
#this will update the stats of the pet
tryfi.pets[0].updateStats(tryfi.session)
#this will update rest (nap/sleep) stats of the pet
tryfi.pets[0].updateRestStats(tryfi.session)
#update the device/collar details for the given pet
tryfi.pets[0].updateDeviceDetails(tryfi.session)
#update the all details for a given pet
tryfi.pets[0].updateAllDetails(tryfi.session)
#this will set the light color of the collar
tryfi.pets[0].setLedColorCode(tryfi.session, 2)
#this will turn on the LED light on the color
tryfi.pets[0].turnOnOffLed(tryfi.session,True)
#or turn it off
tryfi.pets[0].turnOnOffLed(tryfi.session,False)
#this will turn on the lost dog mode
tryfi.pets[0].setLostDogMode(tryfi.session,True)
#or turn it off
tryfi.pets[0].setLostDogMode(tryfi.session,False)
#this will get the lost dog mode status/state currently in the object
tryfi.pets[0].isLost
#this will query sleep stats for given pet
tryfi.pets[0].dailySleep
tryfi.pets[0].weeklySleep
tryfi.pets[0].monthlySleep
#this will query nap stats for given pet
tryfi.pets[0].dailyNap
tryfi.pets[0].weeklyNap
tryfi.pets[0].monthlyNap
The following updates/enhancements were made:
Initial version of the TryFi interface that gathered basic information about the pets, collars and bases.