Skip to content
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

Registering mobile app causes error in person integration #31816

Closed
balloob opened this issue Feb 14, 2020 · 7 comments · Fixed by #31829
Closed

Registering mobile app causes error in person integration #31816

balloob opened this issue Feb 14, 2020 · 7 comments · Fixed by #31829

Comments

@balloob
Copy link
Member

balloob commented Feb 14, 2020

@dshokouhi i get this in the log...

Error handling request
9:58 AM components/person/__init__.py (ERROR)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 50, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/mobile_app/http_api.py", line 80, in post
    DOMAIN, data=data, context={"source": "registration"}
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 109, in async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 172, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/mobile_app/config_flow.py", line 47, in async_step_registration
    self.hass, user_input[CONF_USER_ID], devt_entry.entity_id
  File "/usr/src/homeassistant/homeassistant/components/person/__init__.py", line 108, in async_add_user_device_tracker
    if device_tracker_entity_id in device_trackers:
TypeError: argument of type 'NoneType' is not iterable

Originally posted by @tbar05 in #30565 (comment)

@balloob
Copy link
Member Author

balloob commented Feb 14, 2020

@tbar05 and @pangkoksiong, what persons do you have configured and when did you configure them (Home Assistant version). Would you be able to share your <config>/.storage/person file. Especially interested in the "device_trackers" field.

@pangapp
Copy link

pangapp commented Feb 14, 2020

my example as stated below. "device_trackers" is null.
{ "data": { "persons": [ { "device_trackers": null, "id": "2be2a63f90e44633befc4aecf271cc3a", "name": "admin", "user_id": "837df8f9b42246dd993a19e724dabfd4" } ] }, "key": "person", "version": 1 }

@pangapp
Copy link

pangapp commented Feb 14, 2020

The error went away after updating the "Track Device" in "Configuration->Persons"

@tbar05
Copy link

tbar05 commented Feb 14, 2020

here is my .storage/person....

{ "data": { "items": [ { "device_trackers": [ "device_tracker.galaxy_s10", "device_tracker.sm_g973f_2" ], "id": "79639c3182bxxxxxxx2c95667afb2cc", "name": "tbar05", "user_id": "b9c2f65092xxxxxxxdaa63f833bb75b" } ] }, "key": "person", "version": 2 }

i also tried what @pangkoksiong said and re-selected device_tracker.galaxy_s10 in track device -> Configuration -> persons and now the app is working

@balloob
Copy link
Member Author

balloob commented Feb 14, 2020

When did you create your person, was this a long time ago ?

@tbar05
Copy link

tbar05 commented Feb 14, 2020

@balloob yes it would have been a long time ago... i actually dont remember ever creating this person, is there a default person set up for the user login? ive been using HA for 18 months + so could have been that long ago

@balloob
Copy link
Member Author

balloob commented Feb 14, 2020

Found the issue, should work now for other people without having to edit persons in the UI first 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants