Skip to content

Use base EntityStateAttribute for device tracker coordinates - #176191

Merged
frenck merged 2 commits into
devfrom
epenet/20260710-device_tracker-base-coordinates
Jul 10, 2026
Merged

Use base EntityStateAttribute for device tracker coordinates#176191
frenck merged 2 commits into
devfrom
epenet/20260710-device_tracker-base-coordinates

Conversation

@epenet

@epenet epenet commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Breaking change

Proposed change

Follow-up to #174633 and #176119, which introduced the base EntityStateAttribute enum and moved latitude/longitude onto it.

TrackerEntity and the legacy device tracker write/read their coordinates through TrackerEntityStateAttribute.LATITUDE / TrackerEntityStateAttribute.LONGITUDE. Now that latitude/longitude live on the base enum, they are written/read through EntityStateAttribute.LATITUDE / EntityStateAttribute.LONGITUDE, and the platform-specific enum members are deprecated (via EnumWithDeprecatedMembers, breaking in 2027.2) in favour of the base enum. TrackerEntityStateAttribute.GPS_ACCURACY is unchanged.

  • entity.py / legacy.py: write and restore-read coordinates via the base enum
  • tesla_fleet/device_tracker.py: the one other core consumer of the deprecated members, migrated to the base enum
  • const.py: deprecate TrackerEntityStateAttribute.LATITUDE / LONGITUDE

The device tracker .ambr snapshots are regenerated: the state-attribute dict keys switch from TrackerEntityStateAttribute.LATITUDE/LONGITUDE to EntityStateAttribute.LATITUDE/LONGITUDE (same string values).

No behaviour change: these enums are StrEnums, so the resolved keys are identical.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

🤖 Generated with Claude Code

Following #176119, latitude/longitude live on the base EntityStateAttribute
enum. Write/read them through it in TrackerEntity and the legacy device
tracker, migrate tesla_fleet's restore read, and deprecate the
TrackerEntityStateAttribute.LATITUDE/LONGITUDE members (2027.2).
gps_accuracy stays on TrackerEntityStateAttribute.

Device tracker snapshots are regenerated for the enum key rename.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 10, 2026 07:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@epenet epenet added this to the 2026.8.0b0 milestone Jul 10, 2026
class TrackerEntityStateAttribute(StrEnum):
class TrackerEntityStateAttribute(
StrEnum,
metaclass=EnumWithDeprecatedMembers,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need to bother with deprecation...
They were only added in 2026.7 and I doubt many integrations have started using the new enum, but I've implemented anyway just in case.

@epenet
epenet marked this pull request as ready for review July 10, 2026 08:15
@epenet
epenet requested review from a team, Danielhiversen, bachya and bieniu as code owners July 10, 2026 08:15
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 10, 2026 08:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@frenck frenck removed this from the 2026.8.0b0 milestone Jul 10, 2026

@frenck frenck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @epenet 👍

../Frenck

                       

Blogging my personal ramblings at frenck.dev

@frenck
frenck merged commit c43ab4d into dev Jul 10, 2026
83 of 85 checks passed
@frenck
frenck deleted the epenet/20260710-device_tracker-base-coordinates branch July 10, 2026 15:26
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants