I need a user friendly way to create/delete user accounts for HA from the dashboard, and if possible select which of my 3 dashboards will be visible for the newly created user. Is this even possible ?
I found online that I can write a python script to create new users but it didn’t work, someone told me that HA has migrated to the websocket api instead of REST API, So maybe that’s why it didn’t work.
import requests
import json
url = "http://192.168.1.1:8123/api/onboarding/users"
payload = json.dumps({
"client_id": "http://192.168.1.1:8123/",
"name": "test",
"username": "test",
"password": "12345",
"language": "en"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer <your_long_lived_access_token>'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)