Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tractive Activity and Goal Unavailable (API change) #114349

Closed
AdamSutch opened this issue Mar 28, 2024 · 2 comments · Fixed by #114380
Closed

Tractive Activity and Goal Unavailable (API change) #114349

AdamSutch opened this issue Mar 28, 2024 · 2 comments · Fixed by #114380

Comments

@AdamSutch
Copy link

The problem

It looks like the achieved_minutes and goal_minutes have changed in the Tractive API.

I recently got a notification about upcoming "improvements" to activity tracking (don't remember the details) and then the above failed to update (might have been before, but it was around the time of the notification).

Debug logs example:

2024-03-27 21:42:18.378 DEBUG (MainThread) [homeassistant.components.tractive] Received event: 
{'pet_id': 'REDACTED', 'wellness': {'score': 60, 'activity_label': 'GOOD', 'sleep_label': 'OK', 'rest_label': None, 'remaining_days_until_score': 0}, 'activity': {'hourly_distribution': [0, 0, 2, 1, 0, 4, 4, 23, 17, 27, 16, 35, 15, 14, 10, 21, 44, 39, 48, 45, 0, 0, 0, 0], 'minutes_active': 353, 'minutes_rest': 83, 'minutes_goal': 220, 'calories': 2271, 'average_minutes_active': 241, 'average_minutes_rest': 149, 'current_streak': 3, 'best_day': False}, 'sleep': {'minutes_night_sleep': 439, 'minutes_day_sleep': 163, 'sleep_phases': [{'time_offset': 0, 'time_span': 433, 'type': 'NIGHT'}, {'time_offset': 423, 'time_span': 1, 'type': 'OTHER'}, {'time_offset': 433, 'time_span': 92, 'type': 'OTHER'}, {'time_offset': 525, 'time_span': 13, 'type': 'NIGHT'}, {'time_offset': 538, 'time_span': 60, 'type': 'OTHER'}, {'time_offset': 598, 'time_span': 2, 'type': 'NIGHT'}, {'time_offset': 600, 'time_span': 17, 'type': 'DAY'}, {'time_offset': 617, 'time_span': 27, 'type': 'OTHER'}, {'time_offset': 644, 'time_span': 13, 'type': 'DAY'}, {'time_offset': 657, 'time_span': 82, 'type': 'OTHER'}, {'time_offset': 659, 'time_span': 1, 'type': 'DAY'}, {'time_offset': 739, 'time_span': 71, 'type': 'DAY'}, {'time_offset': 810, 'time_span': 22, 'type': 'OTHER'}, {'time_offset': 832, 'time_span': 49, 'type': 'DAY'}, {'time_offset': 881, 'time_span': 13, 'type': 'OTHER'}, {'time_offset': 894, 'time_span': 14, 'type': 'DAY'}, {'time_offset': 908, 'time_span': 284, 'type': 'OTHER'}], 'sleep_phases_time_span': 1440}, 'bark': {'level': None, 'no_data_reason': 'NOT_SUPPORTED', 'intense_barking_alert_timestamp': None}, 'health_monitoring_status': [{'alert_type': 'ACTIVITY_DEGRADATION', 'alert_status': 'MONITORED'}, {'alert_type': 'LONG_TERM_ACTIVITY_DEGRADATION', 'alert_status': 'MONITORED'}, {'alert_type': 'SLEEP_INTERRUPTIONS', 'alert_status': 'MONITORED'}], 'associated_data': ['WELLNESS_WEEKLY_REPORT'], 'message': 'wellness_overview'}

Looks like the code here needs changing.
https://github.com/home-assistant/core/blob/4d7a43425474da09a2d8b24a766db5193e9e2b16/homeassistant/components/tractive/__init__.py#L295C1-L298C10

Not sure how HA works but I think

            ATTR_MINUTES_ACTIVE: event["progress"]["achieved_minutes"],
            ATTR_DAILY_GOAL: event["progress"]["goal_minutes"],

should become

            ATTR_MINUTES_ACTIVE: event["activity"]["minutes_active"],
            ATTR_DAILY_GOAL: event["activity"]["minutes_goal"],

Looks like someone else noticed this as well and reported upstream. (so it's not just me)
zhulik/aiotractive#31

What version of Home Assistant Core has the issue?

core-2024.3.3

What was the last working version of Home Assistant Core?

core-2024.3.3

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Tractive

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tractive

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @Danielhiversen, @zhulik, @bieniu, mind taking a look at this issue as it has been labeled with an integration (tractive) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tractive can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign tractive Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tractive documentation
tractive source
(message by IssueLinks)

@bieniu
Copy link
Member

bieniu commented Mar 28, 2024

I can confirm the issue, I'll prepare a PR to fix this. Thanks for reporting.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants