Skip to content

Body Battery occasionally records incorrect value after Garmin API 502/503 errors #536

Description

@ngraham1993

System Health details

Environment:

  • Home Assistant: [your version]
  • Garmin Connect integration: [integration version]
  • Installation: HACS

Issue:
Occasionally the Body Battery sensor records a single incorrect value before immediately returning to the correct value.

Example:
07:30:49
100% -> 33% -> 100%

Garmin Connect itself does not show this dip. The Body Battery graph in the Garmin app is smooth.

Home Assistant History records the incorrect state, so the sensor itself is changing rather than the graph rendering incorrectly.

At almost the same time, the integration logs repeated Garmin API failures:

502 Server Error
503 Server Error
API call _get_user_summary_raw failed after 3 retries

This suggests the integration may be updating entities with incomplete or invalid data after an API failure instead of retaining the previous valid state.

Expected behaviour:
If the Garmin API request fails or returns incomplete data, the integration should keep the previous Body Battery value (or mark the entity unavailable) rather than publishing an incorrect value.

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of any previous issues..

Describe the issue

Environment:

  • Home Assistant: [your version]
  • Garmin Connect integration: [integration version]
  • Installation: HACS

Issue:
Occasionally the Body Battery sensor records a single incorrect value before immediately returning to the correct value.

Example:
07:30:49
100% -> 33% -> 100%

Garmin Connect itself does not show this dip. The Body Battery graph in the Garmin app is smooth.

Home Assistant History records the incorrect state, so the sensor itself is changing rather than the graph rendering incorrectly.

At almost the same time, the integration logs repeated Garmin API failures:

502 Server Error
503 Server Error
API call _get_user_summary_raw failed after 3 retries

This suggests the integration may be updating entities with incomplete or invalid data after an API failure instead of retaining the previous valid state.

Expected behaviour:
If the Garmin API request fails or returns incomplete data, the integration should keep the previous Body Battery value (or mark the entity unavailable) rather than publishing an incorrect value.

Reproduction steps

...

Debug logs

Na

Diagnostics dump

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions