Add support for TryFi Series 3+ behavior metrics and enhanced device info#8
Open
adamjacobmuller wants to merge 3 commits intomasterfrom
Open
Add support for TryFi Series 3+ behavior metrics and enhanced device info#8adamjacobmuller wants to merge 3 commits intomasterfrom
adamjacobmuller wants to merge 3 commits intomasterfrom
Conversation
…info - Add behavior tracking for barking, licking, scratching, eating, and drinking - Add daily, weekly, and monthly metrics for each behavior type - Add enhanced device fields: firmware/hardware version, GPS accuracy, signal info - Add backward compatibility for older collar models - Update GraphQL fragments and queries for new data - Initialize behavior metrics to 0 for all pets Fixes #7
adamjacobmuller
pushed a commit
to tryfi/hass-tryfi
that referenced
this pull request
Aug 5, 2025
…info - Update embedded pytryfi with Series 3+ support - Add behavior sensors for barking, licking, scratching, eating, drinking - Add daily, weekly, monthly metrics for each behavior - Add enhanced device sensors: firmware/hardware version, GPS accuracy - Add PetBehaviorSensor class for behavior data handling - Update constants with new behavior types - All changes are backward compatible with older collars Related to tryfi/pytryfi#7 and tryfi/pytryfi#8
Author
Update: Actual API Investigation ResultsAfter testing with a real Series 3+ collar, I've discovered that the behavior tracking features are not available in the current API. This PR has been updated to implement only the fields that actually exist. Actually Implemented FeaturesThis PR now adds support for the following real Series 3+ fields:
Removed Features (Not Available in API)The following features were removed from this PR as they don't exist in the API:
Code Changes
The implementation is now based on actual API responses rather than speculation. Note on TemperatureThe temperature value appears to be a raw sensor reading rather than Celsius. Further investigation needed to determine the proper conversion formula. |
added 2 commits
August 5, 2025 13:21
- Add device fields: batteryVoltage, temperature, uptime, hardwareRevision - Add device statistics fields: wifiNetworkNames, capabilityFlags, deviceStats, etc. - Fix handling of pets without devices (returns None gracefully) - Add proper error handling in query methods - Remove commented behavior tracking code (not available in API) - Add logging for device info fields to aid future development
- Enable behavior stats update in updatePets() method - Add health trends API support for behavior metrics (barking, licking, scratching, eating, drinking) - Map cleaning_self:DAY to licking behavior - Support both Series3+ and prod1 hardware revisions - Clean up all debug logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TryFi Series 3+ Support
Overview
This branch adds support for new metrics available in the TryFi Series 3+ collar.
New Features Added
Behavior Tracking
The Series 3+ collar includes AI-powered behavior detection. This update adds support for tracking:
Enhanced Device Information
New device properties for Series 3+ collars:
API Changes
New GraphQL Fragment
Added
FRAGMENT_BEHAVIOR_DETAILSto query behavior metrics with daily, weekly, and monthly breakdowns.New Query Method
Added
getCurrentPetBehaviorStats()to fetch behavior data from the API.FiPet Class Updates
setBehaviorStats()method to parse behavior dataupdateBehaviorStats()method to fetch latest behavior datadailyBarkingCount,weeklyLickingDuration, etc.)FiDevice Class Updates
Backward Compatibility
All changes are backward compatible. Older collar models will:
Usage Example
Testing
Due to the lack of access to a Series 3+ collar, these changes are based on TryFi's documentation and anticipated API structure. Testing with an actual Series 3+ collar is recommended to verify the GraphQL queries and response parsing.