Skip to content

Conversation

@ajacques
Copy link
Contributor

This pull request adds a bunch of test cases for pytryfi and for the Home Assistant integration flow

Adam Jacob Muller and others added 30 commits August 10, 2025 11:51
This is a clean implementation that only adds new functionality without
reverting any of @ajacques' optimizations:

1. Added getPetHealthTrends() function to query.py for fetching behavior data
2. Added behavior tracking to fiPet.py as purely additive methods:
   - updateBehaviorStats() - fetches behavior data for Series 3+ collars
   - setBehaviorStatsFromTrends() - parses the API response
   - Added behavior properties (dailyBarkingCount, etc.)
   - Modified updateAllDetails() to call updateBehaviorStats() without
     changing the existing GraphQL batching optimization
3. Added PetBehaviorSensor class to sensor.py for Home Assistant entities

Key points:
- NO changes to updatePets() - preserves batched updates
- NO changes to error handling - preserves @ajacques' improvements
- NO removal of type hints
- updateAllDetails() still uses getPetAllInfo() for batched GraphQL
- Behavior tracking is purely additive, only called for Series 3+ collars
- All tests pass

Co-authored-by: @ajacques
Per @ajacques' review comments:
- Removed sentry_sdk imports
- Removed all capture_exception() calls
- Libraries should not initialize Sentry as it can conflict with user applications
- Errors should bubble up naturally for proper error handling

This addresses the inline review comments about Sentry usage in the library.
ajacques and others added 12 commits August 31, 2025 12:02
…info (tryfi#15)

1. Added getPetHealthTrends() function to query.py for fetching behavior data
2. Added behavior tracking to fiPet.py as purely additive methods:
   - updateBehaviorStats() - fetches behavior data for Series 3+ collars
   - setBehaviorStatsFromTrends() - parses the API response
   - Added behavior properties (dailyBarkingCount, etc.)
   - Modified updateAllDetails() to call updateBehaviorStats() without
     changing the existing GraphQL batching optimization
3. Added PetBehaviorSensor class to sensor.py for Home Assistant entities

---------

Co-authored-by: Adam Jacob Muller <adam@adam.gs>
Co-authored-by: Adam Jacques <ajacques@users.noreply.github.com>
getHouseholds already gives us the information we need to bootstrap
the FiUser, so no point in making a call just for the current user.
@ajacques ajacques closed this Sep 13, 2025
@ajacques ajacques deleted the pytest-phase1 branch September 19, 2025 17:33
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

Successfully merging this pull request may close these issues.

2 participants