How to combine Persons with Users?

I have some Users in my household that use HA, as a user (not admin). How do I add these existing users as a Person, so I can use the User Pictures? Creating a new Person allows selecting whether this new Person can log in, followed by the Create User dialogue. But I have existing Users that I want to retain. Is it possible?

Secondary to this: Why are there 2 content types for this? No complaint, just trying to understand :slight_smile:

1 Like

Have solved that? I also looking on the same issue…

@dariusz, @Maverick did you solve this issue? I have the same problem of wanting to create a person based on a user.

No, I’m still waiting/looking for some posts explaining how to do that…

Same here, not investigated further. Would like to know how that works :grinning:

  1. Shutdown HA.
  2. Set the user_id field in .storage/person to the matching value from .storage/auth
  3. Restart HA.

e.g.
.storage/auth:

{   
    "version": 1,
    "key": "auth",
    "data": {
        "users": [
            ...
            {   
                "id": "<long-hex-string-user-id>",   # <--- this
                "group_ids": [
                    "system-users" 
                ],  
                "is_owner": false,
                "is_active": true,
                "name": "Guest User",
                "system_generated": false
            },  

.storage/person:

{
    "version": 2,
    "key": "person",
    "data": {
        "items": [
            {   
                "device_trackers": [
                  ...
                ],
                "id": "guest",
                "name": "Guest User",
                "user_id": "<a-long-hex-string-user-id>",   # <-- should be set here
                "picture": null
            },

(Have I mentioned before what a stupid idea .storage is?)

12 Likes

Thanks, it worked. I just used the File Editor Add-on and edit the files like you said, and then restart Hassio!!

1 Like

If anyone stumble upon this, as I did, be aware this adjustment bricked my hass install. Maybe I made a typo or maybe not, roll the dice but before you do make a full backup.

1 Like

Post the file, guaranteed a typo

What I believe happened was the way I saved it, or the permissions, I edited it afterwards back to default values to no avail. It is gone now.

I had a similar issue where a Person and a User somehow became unlinked. After reading the suggestion to manually edit the storage data, I found that the same re-association can be done via the UI:

  1. Delete the “User” that you wish to associate with a “Person”. If you don’t know the password associated to the user, you’ll have to create a new password to allow the user to login.
  2. Update the “Person” to have permissions to login.

The “User” has now been recreated and linked to the “Person”.

I would also like to add a word of caution. As Johnny_tried bricked his install, so did I.

I believe the problem was that I forgot the quotation marks.
I double clicked the hex string in the auth file, then copying it. I then went to the person file and double clicked null as user_id, pasting the hex string. When doing so, no quotation marks (") was pasted, and none was inserted by me either. After restarting the server it was completely bricked.

Luckily I have automatic Google Drive backup, so I lost an hour of my time and a day worth of sensor data. But that was about it.

I dared to try it again with quotation marks now when writing this post, and that worked successfully!

1 Like