A command-line utility for interacting with the SurePet API. Monitor your pets and control pet flaps through both interactive menus and direct CLI commands.
- π± Pet Management: List pets, check locations, and set pet locations
- πͺ Basic Device Control: Lock/unlock pet flaps and check device status
- π History Access: View feeding, drinking, and activity history
- π― Two Modes: Interactive menu-driven interface or direct CLI commands
- π Secure Authentication: Token-based auth with automatic persistence
git clone https://github.com/da-ar/rusty_pet.git
cd rusty_pet
cargo build --releaseThe binary will be available at target/release/rusty_pet.
- Rust 2021 Edition or later
- SurePet account with API access
Rusty Pet supports multiple authentication methods with automatic fallback:
-
Environment Variable (highest priority):
export SUREHUB_TOKEN="your_token_here" rusty_pet status
-
Saved Token File: Tokens are automatically saved to
~/.rusty_pet_tokenafter interactive login -
Interactive Login: If no token is found, you'll be prompted to log in
Run any command to trigger the authentication flow:
rusty_pet statusYou'll be prompted for your SurePet credentials, and the token will be saved for future use.
Rusty Pet operates in two modes:
Run without any commands to enter the interactive menu:
rusty_petThis provides a user-friendly menu system for browsing pets, checking status, and managing basic settings.
Execute specific commands directly:
# Check system status and devices
rusty_pet status
# List all pets
rusty_pet list
# List pets with filters
rusty_pet list --name "Fluffy" --location inside
# Set a pet's location
rusty_pet set-location "Fluffy" inside
rusty_pet set-location "Max" outside
# Control pet flaps
rusty_pet lock "Pet Door"
rusty_pet unlock "Pet Door"
rusty_pet lock-in "Pet Door" # Pets can exit but not enter
rusty_pet lock-out "Pet Door" # Pets can enter but not exit
# View history
rusty_pet feeding-history "Fluffy" --range week
rusty_pet drinking-history "Max" --range today
rusty_pet activity-history "Fluffy" --range month# List all pets
rusty_pet list
# List pets with filters
rusty_pet list --name "Flu" --location inside --sort activity
# Set pet location
rusty_pet set-location "Fluffy" inside
rusty_pet set-location "Max" outside
# Mark pet as indoor/outdoor
rusty_pet set-indoor "Fluffy"
rusty_pet set-outdoor "Max"# Lock pet flap completely (no access)
rusty_pet lock "Pet Door"
# Unlock pet flap (free access)
rusty_pet unlock "Pet Door"
# Keep pets inside (can exit, can't enter)
rusty_pet lock-in "Pet Door"
# Keep pets outside (can enter, can't exit)
rusty_pet lock-out "Pet Door"
# Set curfew times
rusty_pet set-curfew "Pet Door" --lock-time 22:00 --unlock-time 06:00
# Disable curfew
rusty_pet set-curfew "Pet Door" --disable# Get feeding history
rusty_pet feeding-history "Fluffy" --range today
rusty_pet feeding-history "Fluffy" --range week
rusty_pet feeding-history "Fluffy" --range 2024-01-01,2024-01-31
# Get drinking history
rusty_pet drinking-history "Max" --range month
# Get activity history
rusty_pet activity-history "Fluffy" --range week# Check system status and device information
rusty_pet status
# Clear saved token (logout)
rusty_pet logout
# Reset configuration to defaults
rusty_pet reset-config --yesrusty_pet listProvides formatted, colorized output perfect for terminal viewing.
rusty_pet list --jsonMachine-readable JSON format ideal for scripting and automation.
rusty_pet status --verboseIncludes debug information and detailed logging.
Configuration is stored in src/assets/client_config.toml and includes API endpoints and request settings.
Rusty Pet provides clear error messages and suggestions:
# Invalid pet name
rusty_pet set-location "NonExistent" inside
# Error: No pet found with name or ID 'NonExistent'
# Multiple matches
rusty_pet set-location "Fl" inside
# Error: Multiple pets match 'Fl': Fluffy (ID: 123), Flint (ID: 456). Please be more specific or use the pet ID.#!/bin/bash
# Check pet status
rusty_pet status
# List all pets and their locations
rusty_pet list
# Set pet locations
rusty_pet set-location "Fluffy" inside
rusty_pet set-location "Max" outside
# Check recent feeding activity
rusty_pet feeding-history "Fluffy" --range today#!/bin/bash
# Lock pet flap for the night
rusty_pet lock "Main Door"
# Set up evening curfew
rusty_pet set-curfew "Main Door" --lock-time 22:00 --unlock-time 06:00
# Check device status
rusty_pet status --verbose# Clear saved token and re-authenticate
rusty_pet logout
rusty_pet status # Will prompt for new login# Check system status with verbose output
rusty_pet status --verbose# Reset to default configuration
rusty_pet reset-config --yesgit clone https://github.com/da-ar/rusty_pet.git
cd rusty_pet
cargo build --releasecargo testcargo run -- status --verbose- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- π Check the command help:
rusty_pet --help - π Report issues on GitHub
- π‘ Request features through GitHub issues
- Initial release
- Interactive and CLI modes
- Pet and device management
- Basic history access
- Token-based authentication