Skip to content

Misleading warning: reads source attribute instead of source_type (always reports 'None') #113

Description

@kenshinjonin

Summary

When a device tracker momentarily has no coordinates (e.g. the entity goes unavailable while the Companion App re-registers), the integration logs:

The choosen device tracker (device_tracker.xxx) is emitting a 'None' source type which typically does not have coordinates. Please change the device tracker to one that provides GPS coordinates.

The advice is misleading: the tracker is a GPS tracker, and there is nothing to change. The warning reads an attribute name that never exists.

Root cause

custom_components/dawarich/sensor.py (line 274 on main, 211 in 0.8.6):

if latitude is None or longitude is None:
    if new_data.get("source") != SourceType.GPS:
        _LOGGER.warning(
            (
                "The choosen device tracker (%s) is emitting a '%s' "
                "source type which typically does not have coordinates. "
                "Please change the device tracker to one that provides GPS coordinates."
            ),
            self._mobile_app,
            new_data.get("source"),
        )

Home Assistant exposes the attribute as source_type, not source — see homeassistant/components/device_tracker/const.py:

ATTR_SOURCE_TYPE: Final = "source_type"

which is the very module this integration already imports SourceType from (sensor.py line 6).

So new_data.get("source") is always None. Consequently:

  • None != SourceType.GPS is always true, so the warning fires for any tracker whenever coordinates are momentarily missing — including perfectly configured GPS ones;
  • the reported source type is always 'None', never the real value.

Evidence

Actual attributes of the affected entity (a mobile_app GPS tracker), read from the recorder database:

{"tracking_type": "position", "in_zones": [], "source_type": "gps",
 "latitude": <redacted>, "longitude": <redacted>, "gps_accuracy": 19.0,
 "altitude": 98.0, "friendly_name": "..."}

There is no source key. The warnings appeared only during the exact seconds the entity was unavailable (an unavailable entity carries no attributes at all, hence no latitude/longitude), and stopped as soon as GPS updates resumed. So the trigger is a transient gap, not a wrong source type.

Suggested fix

from homeassistant.components.device_tracker.const import ATTR_SOURCE_TYPE, SourceType
...
if new_data.get(ATTR_SOURCE_TYPE) != SourceType.GPS:

Optionally, also skip the warning when the state is unavailable/unknown: a brief gap is expected on restarts or app re-registration and is not a configuration problem.

Versions

  • Dawarich integration: 0.8.6 (bug still present on main)
  • Home Assistant: 2026.7.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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