Use base EntityStateAttribute for device tracker coordinates - #176191
Merged
Conversation
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>
epenet
commented
Jul 10, 2026
| class TrackerEntityStateAttribute(StrEnum): | ||
| class TrackerEntityStateAttribute( | ||
| StrEnum, | ||
| metaclass=EnumWithDeprecatedMembers, |
Contributor
Author
There was a problem hiding this comment.
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
marked this pull request as ready for review
July 10, 2026 08:15
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>
frenck
approved these changes
Jul 10, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Breaking change
Proposed change
Follow-up to #174633 and #176119, which introduced the base
EntityStateAttributeenum and movedlatitude/longitudeonto it.TrackerEntityand the legacy device tracker write/read their coordinates throughTrackerEntityStateAttribute.LATITUDE/TrackerEntityStateAttribute.LONGITUDE. Now thatlatitude/longitudelive on the base enum, they are written/read throughEntityStateAttribute.LATITUDE/EntityStateAttribute.LONGITUDE, and the platform-specific enum members are deprecated (viaEnumWithDeprecatedMembers, breaking in 2027.2) in favour of the base enum.TrackerEntityStateAttribute.GPS_ACCURACYis unchanged.entity.py/legacy.py: write and restore-read coordinates via the base enumtesla_fleet/device_tracker.py: the one other core consumer of the deprecated members, migrated to the base enumconst.py: deprecateTrackerEntityStateAttribute.LATITUDE/LONGITUDEThe device tracker
.ambrsnapshots are regenerated: the state-attribute dict keys switch fromTrackerEntityStateAttribute.LATITUDE/LONGITUDEtoEntityStateAttribute.LATITUDE/LONGITUDE(same string values).No behaviour change: these enums are
StrEnums, so the resolved keys are identical.Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests:
🤖 Generated with Claude Code