-
-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed source priority for Person #21479
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test and this will be ok to merge
Changed test for rounding of coordinates.
Awesome 🎉 Please make a PR to update the docs to describe the new behavior. |
for entity_id in self._config.get(CONF_DEVICE_TRACKERS, []): | ||
state = self.hass.states.get(entity_id) | ||
|
||
if not state or state.state in IGNORE_STATES: | ||
continue | ||
|
||
if latest is None or state.last_updated > latest.last_updated: | ||
latest = state | ||
if state.attributes.get(ATTR_SOURCE_TYPE) == SOURCE_TYPE_GPS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking source GPS first, before state home, doesn't match the PR description. Is the logic correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MartinHjelmare, yes. If there are other non-GPS devices, which shown 'home', they'll be got prior to GPS in next conditions block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be clarified in the PR description and in the docs, if it's not done already.
Also, it would help to add examples that explain why this logic is better than the previous logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if state.attributes.get(ATTR_SOURCE_TYPE) == SOURCE_TYPE_GPS: | ||
latest_gps = self._get_latest(latest_gps, state) | ||
elif state.state == STATE_HOME: | ||
latest_home = self._get_latest(latest_home, state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we call this latest_non_gps_home
or something? Since we're excluding GPS from this group.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #21528
@balloob @MartinHjelmare The PR was merged before I could comment. Maybe I am missing something, but it looks like this is the opposite of what we should be doing. GPS trackers are more accurate and should be prioritized over wifi and BT trackers. However, it seems, we are doing the opposite here. Based on the examples, we are using the less accurate trackers ( So, when we are |
We should open a new architecture issue to discuss this. I definitely think this needs more discussion. But I don't know myself that the new logic is worse. But I think we should discuss it. There were some comments mentioning a similar logic as is now implemented in the old architecture issue. |
@arsaboo, when |
I am happy to test the new logic out in the beta, as I am still using the meta tracker script for all my presence and can compare the two. However, with the logic in this PR, the tracker will behave only in the most optimistic case. In the more realistic scenario or if any of the trackers misbehave, we will certainly have worse outcomes. For example, based on the docs PR, I have not played with Google Maps tracker and may be that is an issue with that specific tracker. I am currently using iOS app, Owntracks, Geofency, Life360, and Unifi trackers. Overall, in my experience and in discussions with other users, GPS trackers are significantly more accurate. We should not penalize all GPS trackers just because one tracker is misbehaving. In fact, your experience raises another issue. May be we need to let users decide the priority based on how well these trackers work for them. I, for one, would certainly like to prioritize GPS over others. |
@arsaboo, in new logic we prioritize not all stationary trackers against GPS, but only in question of detecting |
It would be better if we can continue discussion in an architecture issue. Please open one. |
I created one to get our discussion started home-assistant/architecture#163 |
Hey |
Hi there, @sbienia, please don't comment on merged/closed PR's. If you suspect an issue, please create one on our main GitHub repository. That will allow us to track it. Thanks! 👍 |
Description:
Added GPS accuracy to Person.
Changed source priority for Person. Status of Person determined next way:
Docs PR:
home-assistant/home-assistant.io#8773
Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: