Fix owntracks source_type for location messages with default trigger (#24503)

Some location update messages do not contain the 't' (trigger) key. Before the change in 0.94 to
entity based trackers, these would default to source_type of 'gps' (due to default parameter
value in async_see method.) To mirror this behavior in the new entity based tracker, the
source_type property should default to SOURCE_TYPE_GPS under the same conditions.
This commit is contained in:
Phil Bruckner authored and Paulus Schoutsen committed 2019-06-12 22:47:56 -07:00
1 parent 7260cada90
commit 3da0f5e384
2 files changed
+15 -2

No files matched your search

@@ -9,7 +9,7 @@ from homeassistant.const import (
ATTR_BATTERY_LEVEL,
)
from homeassistant.components.device_tracker.const import (
ENTITY_ID_FORMAT, ATTR_SOURCE_TYPE)
ENTITY_ID_FORMAT, ATTR_SOURCE_TYPE, SOURCE_TYPE_GPS)
from homeassistant.components.device_tracker.config_entry import (
DeviceTrackerEntity
)
@@ -127,7 +127,7 @@ class OwnTracksEntity(DeviceTrackerEntity, RestoreEntity):
@property
def source_type(self):
"""Return the source type, eg gps or router, of the device."""
return self._data.get('source_type')
return self._data.get('source_type', SOURCE_TYPE_GPS)
@property
def device_info(self):