Antoni-Czaplicki / vulcan-for-hassio

Vulcan inegration for home assistamt
26 stars 3 forks source link

Error when adding integration #15

Closed astan00 closed 3 years ago

astan00 commented 3 years ago

Version: 0.9.1 HA Version: core-2021.3.4

I get an error when adding new integration. The integration on new device is set as REGISTERED on my Vulcan account, but the integration is not set up due to error.

Logger: aiohttp.server Source: custom_components/vulcan/config_flow.py:52


Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 129, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 150, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 158, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 216, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/config/custom_components/vulcan/config_flow.py", line 52, in async_step_user
    self._students = await client.get_students()
  File "/usr/local/lib/python3.8/site-packages/vulcan/_client.py", line 61, in get_students
    self._students = await Student.get(self._api)
  File "/usr/local/lib/python3.8/site-packages/vulcan/model/_student.py", line 77, in get
    return list(Student.load(student) for student in data)
  File "/usr/local/lib/python3.8/site-packages/vulcan/model/_student.py", line 77, in <genexpr>
    return list(Student.load(student) for student in data)
  File "/usr/local/lib/python3.8/site-packages/vulcan/model/_serializable.py", line 49, in load
    return to_model(cls, data)
  File "/usr/local/lib/python3.8/site-packages/related/functions.py", line 104, in to_model
    value = cls(**value)
  File "<attrs generated init vulcan.model._student.Student>", line 6, in __init__
    _setattr('unit', __attr_converter_unit(unit))
  File "/usr/local/lib/python3.8/site-packages/related/converters.py", line 40, in __call__
    return to_model(self.cls, value)
  File "/usr/local/lib/python3.8/site-packages/related/functions.py", line 104, in to_model
    value = cls(**value)
  File "<attrs generated init vulcan.model._unit.Unit>", line 16, in __init__
    __attr_validator_address(self, __attr_address, self.address)
  File "/usr/local/lib/python3.8/site-packages/attr/validators.py", line 35, in __call__
    raise TypeError(
TypeError: ("'address' must be (<class 'str'>,) (got None that is a <class 'NoneType'>).", Attribute(name='address', default=NOTHING, validator=<instance_of validator for type (<class 'str'>,)>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({'key': 'Address'}), type=<class 'str'>, converter=<function str_if_not_none at 0x7fec42f74af0>, kw_only=False), (<class 'str'>,), None)```
Antoni-Czaplicki commented 3 years ago

This is a known issue but has already been fixed - we are currently waiting for a new version of the API to be released.

maciej-szalaj commented 3 years ago

Same issue here. PC account shows Home Assistant as added but integration configuration failed. Should I wait for new API release or is there something I can do to fix it?

Antoni-Czaplicki commented 3 years ago

Same issue here. PC account shows Home Assistant as added but integration configuration failed. Should I wait for new API release or is there something I can do to fix it?

Unfortunately, you should wait for the API update. Could you send me the error code? It can be very similar, but it is often about something else.

Antoni-Czaplicki commented 3 years ago

If you don't want to wait for API update there is one more option: manually edit API files at your home Assistant device

maciej-szalaj commented 3 years ago

That is how it looks like:

image

Antoni-Czaplicki commented 3 years ago

That is how it looks like:

image

What's in the logs?

maciej-szalaj commented 3 years ago
2021-03-25 20:00:35 INFO (SyncWorker_49) [client] Generating key pair...
2021-03-25 20:00:35 INFO (SyncWorker_49) [client] Getting Firebase token...
2021-03-25 20:00:35 INFO (SyncWorker_49) [client] Generated for Home Assistant, sha1: *********************************
2021-03-25 20:00:35 INFO (MainThread) [client] Getting Vulcan components...
2021-03-25 20:00:35 INFO (MainThread) [client] Registering to *******...
2021-03-25 20:00:36 INFO (MainThread) [client] Successfully registered as *************@gmail.com
2021-03-25 20:00:36 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_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 129, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 150, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 158, in async_configure
result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 216, in _async_handle_step
result: Dict = await getattr(flow, method)(user_input)
File "/config/custom_components/vulcan/config_flow.py", line 80, in async_step_user
self._students = await client.get_students()
File "/usr/local/lib/python3.8/site-packages/vulcan/_client.py", line 61, in get_students
self._students = await Student.get(self._api)
File "/usr/local/lib/python3.8/site-packages/vulcan/model/_student.py", line 77, in get
return list(Student.load(student) for student in data)
File "/usr/local/lib/python3.8/site-packages/vulcan/model/_student.py", line 77, in <genexpr>
return list(Student.load(student) for student in data)
File "/usr/local/lib/python3.8/site-packages/vulcan/model/_serializable.py", line 49, in load
return to_model(cls, data)
File "/usr/local/lib/python3.8/site-packages/related/functions.py", line 104, in to_model
value = cls(**value)
File "<attrs generated init vulcan.model._student.Student>", line 6, in __init__
_setattr('unit', __attr_converter_unit(unit))
File "/usr/local/lib/python3.8/site-packages/related/converters.py", line 40, in __call__
return to_model(self.cls, value)
File "/usr/local/lib/python3.8/site-packages/related/functions.py", line 104, in to_model
value = cls(**value)
File "<attrs generated init vulcan.model._unit.Unit>", line 16, in __init__
__attr_validator_address(self, __attr_address, self.address)
File "/usr/local/lib/python3.8/site-packages/attr/validators.py", line 35, in __call__
raise TypeError(
TypeError: ("'address' must be (<class 'str'>,) (got None that is a <class 'NoneType'>).", Attribute(name='address', default=NOTHING, validator=<instance_of validator for type (<class 'str'>,)>, repr=True, eq=True, order=True, hash=None, init=True, metadata=mappingproxy({'key': 'Address'}), type=<class 'str'>, converter=<function str_if_not_none at 0xa8ae6da8>, kw_only=False), (<class 'str'>,), None)
Antoni-Czaplicki commented 3 years ago

Fixed in latest release

maciej-szalaj commented 3 years ago

Installed! Works great! Thanks!

astan00 commented 3 years ago

Selection of student works great. Thnx so much.

In addition, there is a possibility to add second student using already stored credentials, great UX, there is no need to get additional token from Uonet.

dlt7 commented 3 years ago

Hi,

I get an similar error when adding new integration

Version: 0.10.1 HA Version: core-2021.6.3

2021-06-09 14:36:51 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 76, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 63, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 202, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 260, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/config/custom_components/vulcan/config_flow.py", line 89, in async_step_auth
    _students = await client.get_students()
  File "/usr/local/lib/python3.8/site-packages/vulcan/_client.py", line 61, in get_students
    self._students = await Student.get(self._api)
  File "/usr/local/lib/python3.8/site-packages/vulcan/model/_student.py", line 77, in get
    return list(Student.load(student) for student in data)
  File "/usr/local/lib/python3.8/site-packages/vulcan/model/_student.py", line 77, in <genexpr>
    return list(Student.load(student) for student in data)
  File "/usr/local/lib/python3.8/site-packages/vulcan/model/_serializable.py", line 49, in load
    return to_model(cls, data)
  File "/usr/local/lib/python3.8/site-packages/related/functions.py", line 104, in to_model
    value = cls(**value)
  File "<attrs generated init vulcan.model._student.Student>", line 7, in __init__
    _setattr('school', __attr_converter_school(school))
  File "/usr/local/lib/python3.8/site-packages/related/converters.py", line 40, in __call__
    return to_model(self.cls, value)
  File "/usr/local/lib/python3.8/site-packages/related/functions.py", line 104, in to_model
    value = cls(**value)
  File "<attrs generated init vulcan.model._school.School>", line 11, in __init__
    __attr_validator_address(self, __attr_address, self.address)
  File "/usr/local/lib/python3.8/site-packages/attr/validators.py", line 35, in __call__
    raise TypeError(
TypeError: ("'address' must be (<class 'str'>,) (got None that is a <class 'NoneType'>).", Attribute(name='address', default=NOTHING, validator=<instance_of validator for type (<class 'str'>,)>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({'key': 'Address'}), type=<class 'str'>, converter=<function 
str_if_not_none at 0x7f066d532a60>, kw_only=False, inherited=False, on_setattr=None), (<class 'str'>,), None)

Can You give me some advice to solve it?

Antoni-Czaplicki commented 3 years ago

This problem is related to the API that the integration uses - I will fix it soon and release a new version of m