Android: Edit Device name during intial registeration

Created on 12 Feb 2020  路  11Comments  路  Source: home-assistant/android

It would be nice to have the option to specify the device name during first time registration.
Waiting for the registration to complete and then renaming the device will require restarting HA to update the notification service.

enhancement onboarding

Most helpful comment

I understand all of this and it really makes sense, but for easier use, why couldn't we simply have a "enter device name" field in onboarding, so that in HA the device_id immediately is device_tracker.john_doe_phone, not device_tracker.g8441 (that's what I get when I register my Xperia).

All 11 comments

+1 for this. Current implementation is painful and you have to remember to go into settings and change it. It should be asked immediately upon mobile_app registration.

While I agree it would be nice to ask for the device name during onboarding, the user will always need to restart HA in order for the service call to load. So not only should we prompt the user to enter the device name but we should also remind the user they need to restart HA for notifications to work. Also keep in mind the device name is taken from Settings > About Phone so you can easily set it there and not have to worry about it next time you need to clear data in the app.

Choosing the device name during onboarding affects the name of the device, the device_tracker entity and the notification service name.
For me I prefer to use a different name as device name in HA than the one I set in my mobile. Also not all users are familiar with changing the mobile name in the phone Settings.

Also keep in mind the device name is taken from Settings > About Phone so you can easily set it there and not have to worry about it next time you need to clear data in the app.

On my phone the name seems to come from "Model" not the "Unit name" that i can set my self.
My device_tracker is allways named "device_tracker.oneplus_a6013" until i rename it.

I'm aware that we must restart HA to get the changes applied, but would it be possible to not restart HA? Not so long ago we couldn't reload services, now we can (at least some of them)

Not being able to set the device name from the outset has caused me real headaches tonight - My wife and I have the same model phone, and when editing the device name after logging in the 'integration' name in HA still shows the original name.
This means that notifications do not work on one handset, as they both get registered with the same name in the 'integrations' section and only one service call is created for notify_app.

I'm aware that we must restart HA to get the changes applied, but would it be possible to not restart HA? Not so long ago we couldn't reload services, now we can (at least some of them)

This needs to be done in the HA core side as the notify domain needs to allow it, I think.

On my phone the name seems to come from "Model" not the "Unit name" that i can set my self.
My device_tracker is allways named "device_tracker.oneplus_a6013" until i rename it.

Looking back I may have been incorrect with the device name, it could be the model. On my Pixel 4 XL both device name and model are the same.

Not being able to set the device name from the outset has caused me real headaches tonight - My wife and I have the same model phone, and when editing the device name after logging in the 'integration' name in HA still shows the original name.
This means that notifications do not work on one handset, as they both get registered with the same name in the 'integrations' section and only one service call is created for notify_app.

So once you rename the device in app configuration, you need to restart HA for the notify service to update its name so you avoid this conflict. Thats the interim fix until we update the device name during registration.

I understand all of this and it really makes sense, but for easier use, why couldn't we simply have a "enter device name" field in onboarding, so that in HA the device_id immediately is device_tracker.john_doe_phone, not device_tracker.g8441 (that's what I get when I register my Xperia).

So once you rename the device in app configuration, you need to restart HA for the notify service to update its name so you avoid this conflict. Thats the interim fix until we update the device name during registration.

For me, this procedure didn't work - I renamed the device within the app, force closed and restarted. Restarted HA (multiple times) and it still retained the same name.
In the end I managed to fix the issue by manually editing the config_entries file for HA.

I have an issue where one of my phones gets an error and no device_tracker is created under HA, and it looks like it is caused by the app which can't retrieve phone model (undefined/empty field seems to cause an error at registration).

So I ask you: what about the device_tracker using the username for registration instead of the phone model? Most of the time it wouldn't require any change on HA side, because it would be easier to identify in automations.
Still have to deal with multiple device_trackers for one user, but adding a random id after username could fix that easily.

PS: I must mention that I'm not 100% percent sure of the cause of the issue I met, but some evidence lead to this. I am sure you will ask for a specific issue, but this "enhancement" would solve it. I followed all the recommendations given to reset the settings of the app and the ha side one, with no success. This is not the point in this thread.

@mathieu-mp you should file a separate defect for your error and device tracker missing issue. That is separate from this issue and should be corrected. This issue is a feature request to allow the user to change the name before the sensor is registered. The device name will still attempt to pull the phone model and you will hit the error again so we should try to solve it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Anonym-tsk picture Anonym-tsk  路  3Comments

Knoxie picture Knoxie  路  5Comments

simbesh picture simbesh  路  3Comments

Hypfer picture Hypfer  路  3Comments

N-Schaef picture N-Schaef  路  5Comments