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:
1 parent
7260cada90
commit
3da0f5e384
2 files changed
+15
-2
No files matched your search
@@ -411,6 +411,19 @@ async def test_location_update(hass, context):
|
||||
"""Test the update of a location."""
|
||||
await send_message(hass, LOCATION_TOPIC, LOCATION_MESSAGE)
|
||||
|
||||
assert_location_source_type(hass, 'gps')
|
||||
assert_location_latitude(hass, LOCATION_MESSAGE['lat'])
|
||||
assert_location_accuracy(hass, LOCATION_MESSAGE['acc'])
|
||||
assert_location_state(hass, 'outer')
|
||||
|
||||
|
||||
async def test_location_update_no_t_key(hass, context):
|
||||
"""Test the update of a location when message does not contain 't'."""
|
||||
message = LOCATION_MESSAGE.copy()
|
||||
message.pop('t')
|
||||
await send_message(hass, LOCATION_TOPIC, message)
|
||||
|
||||
assert_location_source_type(hass, 'gps')
|
||||
assert_location_latitude(hass, LOCATION_MESSAGE['lat'])
|
||||
assert_location_accuracy(hass, LOCATION_MESSAGE['acc'])
|
||||
assert_location_state(hass, 'outer')
|
||||
|
||||
Reference in new issue
Block a user