frontend icon indicating copy to clipboard operation
frontend copied to clipboard

Unable to remove device tracker from Person

Open Midnitte opened this issue 2 years ago • 20 comments

The problem

When viewing a person and clicking the "x" to remove a device and clicking update, the device is not removed when viewing the person again.

What version of Home Assistant Core has the issue?

core-2022.6.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Person

Link to integration documentation on our website

https://www.home-assistant.io/integrations/person/

Diagnostics information

homeassistant_companion_log_6-7-2022_5-14-7.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-07-07 05:21:02 INFO (MainThread) [hass_nabucasa.google_report_state] Connected
2022-07-07 05:21:18 DEBUG (MainThread) [homeassistant.components.person] Subscribe to device trackers for person.chris
2022-07-07 05:21:23 DEBUG (MainThread) [homeassistant.components.person] Subscribe to device trackers for person.chris

Additional information

Others also seem to have the same issue: https://community.home-assistant.io/t/cannot-delete-tracked-devices-for-person-anymore/400348/22

I've recorded a video of the behavior as well: https://user-images.githubusercontent.com/49769850/177741747-3fefbbf4-821c-4fb6-b07e-fd6557fc4ac9.mp4

Full device info:

System Health

version core-2022.6.7
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.9.12
os_name Linux
os_version 5.15.45
arch aarch64
timezone America/New_York
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.25.5
Stage running
Available Repositories 1070
Downloaded Repositories 10
Home Assistant Cloud
logged_in true
subscription_expiration July 18, 2022 at 8:00 PM
relayer_connected true
remote_enabled true
remote_connected true
alexa_enabled true
google_enabled true
remote_server us-east-1-0.ui.nabu.casa
can_reach_cert_server ok
can_reach_cloud_auth failed to load: timeout
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 8.2
update_channel stable
supervisor_version supervisor-2022.06.2
agent_version 1.2.1
docker_version 20.10.14
disk_total 113.9 GB
disk_used 8.9 GB
healthy true
supported true
board odroid-n2
supervisor_api ok
version_api ok
installed_addons Z-Wave JS (0.1.64), File editor (5.3.3), Git pull (7.13.1), Terminal & SSH (9.6.0), Node-RED (12.0.2), Glances (0.16.0), Home Assistant Google Drive Backup (0.108.2), Mosquitto broker (6.1.2), InfluxDB (4.5.0), Samba share (10.0.0)
Dashboards
dashboards 1
resources 5
views 2
mode storage
Recorder
oldest_recorder_run June 27, 2022 at 12:26 AM
current_recorder_run July 7, 2022 at 5:20 AM
estimated_db_size 123.62 MiB
database_engine sqlite
database_version 3.34.1

Midnitte avatar Jul 07 '22 09:07 Midnitte

person documentation person source (message by IssueLinks)

Seems like upgrading to 2022.7.X has resolved the issue for me (or rebooting several times).

Midnitte avatar Jul 11 '22 23:07 Midnitte

Its not fixed for me with 2022.7.3, also after several reboots. I have fixed it with a workaround, by replacing the entity with another entity, but can't remove it.

DJaeger avatar Jul 12 '22 07:07 DJaeger

I have fixed it with a workaround, by replacing the entity with another entity, but can't remove it.

Another workaround could be to use device with a mouse to remove the entity. I found the issue only occurred for me when using touch screens. It occurred on both Windows and iOS with touch, and did not occur on both when using a mouse/trackpad.

Daneish avatar Jul 12 '22 08:07 Daneish

You are right, can remove it with click, but not touch. But these are workarounds, no solutions, so the issue should be reopened

DJaeger avatar Jul 12 '22 09:07 DJaeger

Seems like it's still occurring, specifically involving touch.

Midnitte avatar Jul 12 '22 09:07 Midnitte

Thanks for reopening.

The issue occurs when attempting to remove entities that belong to a person entity. Using touch screen the UI updates, this indicates (to me) the change should have been made. However, rather than remove the entity, it actually appears to just clear the text box. Looking at the debug logs confirms no change has been made. Using a mouse to remove the entity the UI behaves slightly differently and the entity is actually removed.

The issues occur using a browser (Edge on Windows, or Safari on iOS), or using the iOS app.

Steps to recreate the issue and show the work around of using a mouse:

Settings > People > Person > Select the devices that belong to this person.

On a touch screen (iOS or Windows) when removing an entity (Danes Pixel 4) by tapping the X on the dropdown card, the entity name disappears and is replaced with Track Device, the dropdown card that had the entity does not disappear. (It behaves just as if the contents of the text box have been selected and deleted.)

Clicking Update closes the dialog box, but opening the person properties again, the entity is back.

However, when using a mouse (iOS or Windows) and clicking the X, results in different behaviour. The whole dropdown card disappears and the empty one below it moves up the screen.

Reopening the Person shows the change has been made successfully.

I first started documenting this issue when I was running 2022.6.6 but according to the community forum the issue has been happening since 09/03/22. Edit: Updated link/date.

It's still occurring for me on the latest stable: Home Assistant 2022.7.3 Supervisor 2022.07.0 Operating System 8.2 Frontend 20220707.0 - latest

Debug logs below.

Using touch - device_tracker.danes_pixel_4 should be removed but is not:

2022-06-26 01:55:05 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547535660752] Received {'type': 'person/update', 'person_id': 'dane', 'name': 'Dane', 'device_trackers': ['device_tracker.danes_iphone11_app_location', 'device_tracker.danes_iphone11_wifi', 'device_tracker.danes_pixel_4'], 'user_id': 'redacted', 'picture': '/api/image/serve/6a9322551ee9a4dad42b6355a263a2ff/512x512', 'id': 45}
2022-06-26 01:55:05 DEBUG (MainThread) [homeassistant.components.person] Subscribe to device trackers for person.dane
2022-06-26 01:55:05 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547535660752] Sending {"id":45,"type":"result","success":true,"result":{"name":"Dane","user_id":"redacted","device_trackers":["device_tracker.danes_iphone11_app_location","device_tracker.danes_iphone11_wifi","device_tracker.danes_pixel_4"],"id":"dane","picture":"/api/image/serve/6a9322551ee9a4dad42b6355a263a2ff/512x512"}}

Using mouse - device_tracker.danes_pixel_4 is removed:

2022-06-26 02:56:03 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547039678128] Received {'type': 'person/update', 'person_id': 'dane', 'name': 'Dane', 'device_trackers': ['device_tracker.danes_iphone11_app_location', 'device_tracker.danes_iphone11_wifi'], 'user_id': 'redacted', 'picture': '/api/image/serve/6a9322551ee9a4dad42b6355a263a2ff/512x512', 'id': 44}
2022-06-26 02:56:03 DEBUG (MainThread) [homeassistant.components.person] Subscribe to device trackers for person.dane
2022-06-26 02:56:03 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [547039678128] Sending {"id":44,"type":"result","success":true,"result":{"name":"Dane","user_id":"redacted","device_trackers":["device_tracker.danes_iphone11_app_location","device_tracker.danes_iphone11_wifi"],"id":"dane","picture":"/api/image/serve/6a9322551ee9a4dad42b6355a263a2ff/512x512"}}

Please let me know if I can provide any more information or testing to help resolve the issue.

Edit: Updated community forum link and date - had the wrong one.

Daneish avatar Jul 12 '22 12:07 Daneish

Me pasa exactamente lo mismo,no puedo eliminar rastreador desde la app android

maiflaii avatar Jul 16 '22 10:07 maiflaii

Same problem here on Android app under v.2022.7.5

tintin814 avatar Jul 22 '22 08:07 tintin814

Same problem 2022.7.7 and android

poupouproject avatar Aug 02 '22 03:08 poupouproject

Same issue here on 2022.8.1:

When I remove a tracking device from a person entity it gets removed after saving the person entity. But, it returns after a while and is connected to that person again.

smarthomejunkie avatar Aug 06 '22 13:08 smarthomejunkie

It seems the issue occurs in apps only. Login HA with a browser and delete the device in Person, it works.

tintin814 avatar Aug 07 '22 10:08 tintin814

It seems the issue occurs in apps only. Login HA with a browser and delete the device in Person, it works.

This is not true. At first it seems that it is saved correctly on desktop, but after a while the old state returns.

smarthomejunkie avatar Aug 07 '22 10:08 smarthomejunkie

I don't encounter this issue. Which broswer did you use? I heard that Edge will reproduce the issue. I use Chrome and Firefox which both are fine

tintin814 avatar Aug 07 '22 10:08 tintin814

I use Chrome

smarthomejunkie avatar Aug 07 '22 10:08 smarthomejunkie

But, it returns after a while and is connected to that person again. At first it seems that it is saved correctly on desktop, but after a while the old state returns.

Hi Smarthomejunkie, I wonder if your report could be conflating two separate issues. The issue reported here is when a device is removed from a Person using a touch device (like the App), the device returns immediately (as it is never actually removed).

There is another issue/feature that people have experienced (myself included in the past), that when an App is logged in for the first time (or it has to re-authenticate), the App’s device is automatically added to the Person that logged in.

This is documented in a feature request and Issue https://github.com/home-assistant/core/issues/63876.

Could that be the issue you are having? How long after you remove the device, does it return for you?

Daneish avatar Aug 07 '22 12:08 Daneish

But, it returns after a while and is connected to that person again. At first it seems that it is saved correctly on desktop, but after a while the old state returns.

Hi Smarthomejunkie, I wonder if your report could be conflating two separate issues. The issue reported here is when a device is removed from a Person using a touch device (like the App), the device returns immediately (as it is never actually removed).

There is another issue/feature that people have experienced (myself included in the past), that when an App is logged in for the first time (or it has to re-authenticate), the App’s device is automatically added to the Person that logged in.

This is documented in a feature request and Issue home-assistant/core#63876.

Could that be the issue you are having? How long after you remove the device, does it return for you?

Hi @Daneish, I see that my device is connected to my son (being the person). I indeed tested something and logged in as my son on my phone, so that might be the reason why my phone is connected to him (as a person). But, after I remove my phone from his person entity, it seems to be removed. Then, after a while, my phone is again connected to his person entity.

I'm not sure after how much time this occurs. I am trying to create a reproduction path so that it can be reproduced every time, but I did not find it yet. As soon as I find a reproduction path I will let you know.

smarthomejunkie avatar Aug 07 '22 15:08 smarthomejunkie

Ah! I found the reproduction path!

  1. Log in with another person's username than yourself on your phone (HA companion app)
  2. Your phone is added to that person's entity
  3. Log out with the other person's username from your phone
  4. Log in with your own username on your phone
  5. Close the Home Assistant Companion app
  6. Go to Desktop and log into Home Assistant with your own username
  7. Check the other person's entity
  8. You will see that your phone is connected to this other person's entity
  9. Remove your phone from the other person's entity
  10. Update the person's entity
  11. Your phone is now removed from the other person's entity.
  12. Go back to your phone
  13. Open the HA Companion app
  14. At that moment your phone is again added to the other person's entity <= THIS SHOULD NOT HAPPEN

smarthomejunkie avatar Aug 07 '22 16:08 smarthomejunkie

I created another issue for this: https://github.com/home-assistant/core/issues/76397

smarthomejunkie avatar Aug 07 '22 16:08 smarthomejunkie

Ah! I found the reproduction path!

Nice, glad to hear you were able to pin it down further! Thanks for raising the new issue.

Daneish avatar Aug 12 '22 15:08 Daneish

Still seeing this behaviour with 2022.8.4 - cannot remove any device tracker from a person using the Android app.

dunxd avatar Aug 16 '22 09:08 dunxd

What I don't understand is why devices are added automatically to the person. I should be able to click on the person and say track this device. I was told in the forum that that is how it was designed.

bschatzow avatar Aug 16 '22 17:08 bschatzow

What I don't understand is why devices are added automatically to the person.

I agree it would be nice if it was optional instead of mandatory. That said, to keep the conversation in this Issue focused on original bug, we should continue the conversation of Automatic devices being added to a Person over on this feature request.

Daneish avatar Aug 19 '22 05:08 Daneish

@Daneish I read the feature request that you linked to and am not sure how my comment is not related to this issue "Unable to remove device tracker from Person #13351". Of course I voted on the feature but not sure that that forum is the right place either. I understand the original logic making it mandatory for mobile apps to add to the person tracker, but there are many times when this does not work and it should be easy to remove them. The way it works now is I can't track my tablet and phone. If I leave my tablet home HA believes I am home as my tablet is connected to my router.
If I loan someone one of my devices (tablet / phone) I can't remove it from the person. I don't want the same tracking on a person I loaned it to as I do to me. Maybe there is another GitHub discussion about system design? If there is, I can't find it.

bschatzow avatar Aug 20 '22 08:08 bschatzow

@Daneish I read the feature request that you linked to and am not sure how my comment is not related to this issue "Unable to remove device tracker from Person #13351". Of course I voted on the feature but not sure that that forum is the right place either. I understand the original logic making it mandatory for mobile apps to add to the person tracker, but there are many times when this does not work and it should be easy to remove them. The way it works now is I can't track my tablet and phone. If I leave my tablet home HA believes I am home as my tablet is connected to my router. If I loan someone one of my devices (tablet / phone) I can't remove it from the person. I don't want the same tracking on a person I loaned it to as I do to me. Maybe there is another GitHub discussion about system design? If there is, I can't find it.

You can remove it from the person by uninstalling and installing the companion app after you removed the device tracker from that person on desktop. See my comment in the other issue that I linked to in the discussion above.

https://github.com/home-assistant/core/issues/76397

smarthomejunkie avatar Aug 20 '22 08:08 smarthomejunkie

The issue I see is inability to remove any devices for a person using the Android app. Most of the people in my household have more than one device associated with them - I'm not having an issue with removing the only one. I am having an issue removing any of them whether they are related to companion app or an IP address tracker etc. It doesn't have anything to do with automatic association of devices with people.

This is only with the Android app. The workaround is to use a desktop browser.

Edit: reading the thread, in some cases devices based on the companion app get added back the next time the device logs in. But in all cases the device can't be removed using the companion app. These feel like two separate issues to me.

dunxd avatar Aug 20 '22 10:08 dunxd

@dunxd My issue with all the customization allowed in HA how the mobile app has a mandatory condition to add it to the person. I like adding tracker to all my devices so I can always see where they are. I do not want them attached to a person.

bschatzow avatar Aug 20 '22 14:08 bschatzow

I read the feature request that you linked to and am not sure how my comment is not related to this issue "Unable to remove device tracker from Person #13351".

If I loan someone one of my devices (tablet / phone) I can't remove it from the person.

@bschatzow reading your additional comments I may have misunderstood your issue.

To recap the Issue we are tracking here, as @dunxd mentioned, this occurs when trying to remove any device from a Person using a touchscreen. This can be Android, iOS, or Windows, as long as the action is done performed via the touchscreen. There appears to be a bug in the frontend when a user tries to remove a device from a Person, the frontend appears like the device has been removed, however it does not actually remove it. Opening the Person entity again, shows the device has not been removed.

If this is the same issue you are having, apologies on sending you over to the feature request, this issue is the right place, and the workaround of using a mouse/touchpad to remove the device should get things working again for you, until the bug is patched.

However, if the app is reinstalled, or needs to re-authenticate, the device may get added to the Person again. I had this issue a few months ago with my tablet being assigned to my ‘Person’ but after removing it, in the few months since, it hasn’t re-added itself again.

According to https://github.com/home-assistant/core/issues/63876, this appears to be designed behaviour.

To request a change be made to this behaviour, again, the Feature Request to make it optional would probably be the best place to discuss.

Daneish avatar Aug 21 '22 07:08 Daneish

My device kept re-adding when removed via either my phone or tablet. Seems to work from my computer. All devices are using Chrome. @Daneish I re-read the issue 63876 and see it is closed. Seems very short sighted as most people I know have many devices and on most you can install the mobile app for many useful sensors. Seems silly to mandate that a device tracker be added on devices that don't leave home.

bschatzow avatar Aug 21 '22 17:08 bschatzow

Same issue with 2022.8.7 and iOS devices. I don't have any non-Apple ones.

Stooovie avatar Sep 06 '22 14:09 Stooovie