Fix google maps device_tracker same last seen timestamp (#99963)
* Update device_tracker.py This fix the google_maps does not show current location when HA started/restarted and also fix unnecessary update when last_seen timestamp is the same. Unnecessary update is causing proximity sensor switching from between stationary and certain direction. * Remove elif * Fix Black check * fix black check * Update device_tracker.py Better patch * Update device_tracker.py * Update device_tracker.py Fix Black * Update device_tracker.py change warning to debugpull/101386/head
parent
9ab340047d
commit
81e8ca130f
|
@ -112,12 +112,22 @@ class GoogleMapsScanner:
|
|||
|
||||
last_seen = dt_util.as_utc(person.datetime)
|
||||
if last_seen < self._prev_seen.get(dev_id, last_seen):
|
||||
_LOGGER.warning(
|
||||
_LOGGER.debug(
|
||||
"Ignoring %s update because timestamp is older than last timestamp",
|
||||
person.nickname,
|
||||
)
|
||||
_LOGGER.debug("%s < %s", last_seen, self._prev_seen[dev_id])
|
||||
continue
|
||||
if last_seen == self._prev_seen.get(dev_id, last_seen) and hasattr(
|
||||
self, "success_init"
|
||||
):
|
||||
_LOGGER.debug(
|
||||
"Ignoring %s update because timestamp "
|
||||
"is the same as the last timestamp %s",
|
||||
person.nickname,
|
||||
last_seen,
|
||||
)
|
||||
continue
|
||||
self._prev_seen[dev_id] = last_seen
|
||||
|
||||
attrs = {
|
||||
|
|
Loading…
Reference in New Issue